package cz.moneta.test.system.harness;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.testautomationpage.TestAutomationPageHome;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import org.junit.jupiter.api.Assertions;

@TestScenario(name = "Open Harness test page")
public class HarnessTest {

    private static final String PAGE_TITLE = "Hello Harness";

    @TestCase(name = "Check most used annotations on Harness test page")
    public void openTestPage(Harness harness) {
        harness.withTestAutomationPage()
                .openHomePage()
                .selectCombobox("Combobox 3")
                .typeIntoTextfield("test")
                .checkCheckbox()
                .checkElementPresent()
                .checkElementContent(PAGE_TITLE)
                .executeJavaScript()
                .acceptAlert()
                .executeJavaScript()
                .dismissAlert()
                .log()
                .storeElementContent()
                .customAction()
                .keyPressTab()
                .clickSubmitButton();

        Assertions.assertEquals(PAGE_TITLE, harness.get(TestAutomationPageHome.STORE_KEY));
    }
}