Search in sources :

Example 26 with Then

use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.

the class EditorSteps method checkAlertDialogDetails.

@Then("^check that alert dialog contains details \"([^\"]*)\"$")
public void checkAlertDialogDetails(String expectedDetailsText) {
    SelenideElement alertElemet = editor.getDangerAlertElemet();
    alertElemet.find(By.tagName("button")).click();
    assertThat(alertElemet.find(By.tagName("pre")).getText()).isEqualTo(expectedDetailsText);
}
Also used : SelenideElement(com.codeborne.selenide.SelenideElement) Then(io.cucumber.java.en.Then)

Example 27 with Then

use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.

the class EditorSteps method checkAlertDialog.

@Then("^check that alert dialog contains text \"([^\"]*)\"$")
public void checkAlertDialog(String expectedText) {
    ElementsCollection spans = editor.getDangerAlertElemet().findAll(By.tagName("span"));
    assertThat(spans.stream().anyMatch(span -> span.getText().contains(expectedText))).isTrue().as("In the alert dialog is not expected text.");
}
Also used : Then(io.cucumber.java.en.Then) ModalDialogPage(io.syndesis.qe.pages.ModalDialogPage) When(io.cucumber.java.en.When) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Condition.visible(com.codeborne.selenide.Condition.visible) By(org.openqa.selenium.By) ChooseConnection(io.syndesis.qe.pages.integrations.editor.add.ChooseConnection) TimeoutException(java.util.concurrent.TimeoutException) Editor(io.syndesis.qe.pages.integrations.editor.Editor) SelenideElement(com.codeborne.selenide.SelenideElement) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) Selenide.$(com.codeborne.selenide.Selenide.$) TestUtils(io.syndesis.qe.utils.TestUtils) ByUtils(io.syndesis.qe.utils.ByUtils) IntegrationFlowView(io.syndesis.qe.pages.integrations.fragments.IntegrationFlowView) Condition(com.codeborne.selenide.Condition) ElementsCollection(com.codeborne.selenide.ElementsCollection) Assert.assertEquals(org.junit.Assert.assertEquals) DataTable(io.cucumber.datatable.DataTable) OpenShiftWaitUtils(io.syndesis.qe.wait.OpenShiftWaitUtils) ElementsCollection(com.codeborne.selenide.ElementsCollection) Then(io.cucumber.java.en.Then)

Example 28 with Then

use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.

the class ApiProviderSteps method verifyTheDisplayedURLMatchesHttpITodoIntegrationApi$.

@Then("^verify the displayed API Provider URL matches regex (.*)$")
public void verifyTheDisplayedURLMatchesHttpITodoIntegrationApi$(String regex) {
    String apiUrl = new Details().getApiUrl();
    assertThat(apiUrl).matches(regex);
}
Also used : Details(io.syndesis.qe.pages.integrations.summary.Details) Then(io.cucumber.java.en.Then)

Example 29 with Then

use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.

the class ConnectionSteps method checkAllVisibleKebabMenus.

@Then("^check visibility of unveiled kebab menu of all connections, each of this menu consist of \"(\\w+)\", \"(\\w+)\" and \"(\\w+)\" actions$")
public void checkAllVisibleKebabMenus(String action1, String action2, String action3) {
    List<String> actions = new ArrayList<>(Arrays.asList(action1, action2, action3));
    for (SelenideElement connection : connectionsPage.getAllConnections()) {
        KebabMenu kebabMenu = new KebabMenu(connection.$(ByUtils.dataTestId("button", "connection-card-kebab")).shouldBe(visible));
        try {
            kebabMenu.open();
            TestUtils.sleepIgnoreInterrupt(1000);
            for (String item : actions) {
                if (!kebabMenu.isItemElementVisible(item)) {
                    kebabMenu.open();
                    assertTrue(kebabMenu.isItemElementVisible(item));
                }
            }
        } catch (org.openqa.selenium.StaleElementReferenceException e) {
            kebabMenu = new KebabMenu(connection.$(By.xpath(".//button")).shouldBe(visible));
            kebabMenu.open();
            for (String item : actions) {
                kebabMenu.getItemElement(item).shouldBe(visible);
            }
        }
    }
}
Also used : SelenideElement(com.codeborne.selenide.SelenideElement) ArrayList(java.util.ArrayList) KebabMenu(io.syndesis.qe.fragments.common.menu.KebabMenu) Then(io.cucumber.java.en.Then)

Example 30 with Then

use of io.cucumber.java.en.Then in project syndesis-qe by syndesisio.

the class ConnectionSteps method testAuthenticationType.

@Then("^check that connection authentication type has (\\d+) options? and contains text \"([^\"]*)\"$")
public void testAuthenticationType(int expectedSize, String expectedString) {
    ElementsCollection optionsFound = $(By.id("authenticationType")).shouldBe(visible).$$(By.tagName("option"));
    assertThat(optionsFound).hasSize(expectedSize);
    boolean expectedTextIsPresent = false;
    for (SelenideElement e : optionsFound) {
        expectedTextIsPresent = e.getText().contains(expectedString);
    }
    assertThat(expectedTextIsPresent).isTrue();
}
Also used : ElementsCollection(com.codeborne.selenide.ElementsCollection) SelenideElement(com.codeborne.selenide.SelenideElement) Then(io.cucumber.java.en.Then)

Aggregations

Then (io.cucumber.java.en.Then)124 SelenideElement (com.codeborne.selenide.SelenideElement)20 AttributeType (com.vaticle.typedb.core.concept.type.AttributeType)16 List (java.util.List)13 HashMap (java.util.HashMap)10 SyndesisRootPage (io.syndesis.qe.pages.SyndesisRootPage)9 Map (java.util.Map)9 ThingType (com.vaticle.typedb.core.concept.type.ThingType)8 DataTable (io.cucumber.datatable.DataTable)8 When (io.cucumber.java.en.When)8 Pod (io.fabric8.kubernetes.api.model.Pod)8 Quantity (io.fabric8.kubernetes.api.model.Quantity)8 ArrayList (java.util.ArrayList)8 Date (java.util.Date)8 TimeoutException (java.util.concurrent.TimeoutException)8 TestUtils (io.syndesis.qe.utils.TestUtils)7 HTTPResponse (io.syndesis.qe.utils.http.HTTPResponse)7 OpenShiftWaitUtils (io.syndesis.qe.wait.OpenShiftWaitUtils)7 Slf4j (lombok.extern.slf4j.Slf4j)7 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)7