Search in sources :

Example 26 with When

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

the class ConnectionSteps method clickOnKebabMenuButtonOfConnection.

@When("^click on the \"([^\"]*)\" kebab menu button of \"([^\"]*)\"$")
public void clickOnKebabMenuButtonOfConnection(String button, String connectionName) throws Throwable {
    KebabMenu kebabMenu = new KebabMenu(connectionsPage.getConnection(connectionName).$(By.xpath(".//button")).shouldBe(visible));
    kebabMenu.open();
    kebabMenu.getItemElement(button).shouldBe(visible).click();
}
Also used : KebabMenu(io.syndesis.qe.fragments.common.menu.KebabMenu) When(io.cucumber.java.en.When)

Example 27 with When

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

the class ApicurioSteps method removeOperation.

@ExcludeFromSelectorReports
@When("^remove an operation via apicurio gui$")
public void removeOperation() {
    $(Elements.PATH_SECTION).shouldBe(visible).$(Elements.OPERATION).shouldBe(visible).click();
    $(Elements.OPERATION_KEBAB).shouldBe(visible).click();
    SelenideElement kebabMenu = $(Elements.OPERATION_KEBAB_MENU);
    try {
        kebabMenu.$(Elements.OPERATION_KEBAB_MENU_DELETE).shouldBe(visible).click();
    } catch (org.openqa.selenium.StaleElementReferenceException e) {
        $(Elements.OPERATION_KEBAB_MENU).$(Elements.OPERATION_KEBAB_MENU_DELETE).shouldBe(visible).click();
    }
}
Also used : SelenideElement(com.codeborne.selenide.SelenideElement) When(io.cucumber.java.en.When) ExcludeFromSelectorReports(io.syndesis.qe.report.selector.ExcludeFromSelectorReports)

Example 28 with When

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

the class ApicurioSteps method addSecuritySchema.

@ExcludeFromSelectorReports
@When("^add security schema (BASIC|API Key|OAuth 2) via apicurio gui$")
public void addSecuritySchema(String schemeType) {
    // child span element selected so the click is inside of the element
    $(Elements.SECURITY_SECTION).shouldBe(visible).$(By.tagName("span")).click();
    $(Elements.SECURITY_SECTION).shouldBe(visible).$(Elements.BUTTON_ADD_SCHEME).shouldBe(visible).click();
    SelenideElement nameInput = $(SecurityPageElements.NAME).shouldBe(visible);
    try {
        nameInput.sendKeys("ImmovableName");
    } catch (org.openqa.selenium.StaleElementReferenceException e) {
        $(SecurityPageElements.NAME).shouldBe(visible).sendKeys("ImmovableName");
    }
    // select security option
    $(SecurityPageElements.EDITOR).shouldBe(visible).$(SecurityPageElements.SECURITY_TYPE_DROPDOWN).shouldBe(visible).click();
    $(SecurityPageElements.EDITOR).shouldBe(visible).$(SecurityPageElements.SECURITY_DROPDOWN_MENU).shouldBe(visible).$(By.xpath(".//a[contains(text(), \"" + schemeType + "\")]")).shouldBe(visible).click();
    if ("API Key".equalsIgnoreCase(schemeType)) {
        $(By.className("apiKey-auth")).find(By.id("in20")).click();
        $(By.className("apiKey-auth")).findAll("li").filter(text("HTTP header")).first().click();
        $(By.id("name20")).sendKeys("headerName");
    }
    if ("OAuth 2".equalsIgnoreCase(schemeType)) {
        $(By.id("flow")).shouldBe(visible).click();
        $(By.id("flow")).shouldBe(visible).parent().$(By.xpath(".//a[contains(text(), \"Access Code\")]")).shouldBe(visible).click();
        $(By.id("authorizationUrl")).sendKeys("http://syndesis.io");
        $(By.id("tokenUrl")).sendKeys("https://hihi.com");
    }
    ElementsCollection saveButtons = $(SecurityPageElements.ACTION_HEADER).shouldBe(visible).$$(SecurityPageElements.SAVE);
    assertThat(saveButtons.size()).isEqualTo(1);
    saveButtons.get(0).shouldBe(visible).click();
    $(Elements.BUTTON_ADD_REQUIREMENT).shouldBe(visible).click();
    try {
        OpenShiftWaitUtils.waitFor(() -> $(SecurityPageElements.SECURITY_REQUIREMENT).exists(), 60 * 1000L);
    } catch (InterruptedException | TimeoutException e) {
        fail("Security requirement was not found.");
    }
    ElementsCollection items = $$(SecurityPageElements.SECURITY_REQUIREMENT_ITEMS).shouldBe(sizeGreaterThanOrEqual(1)).filterBy(text("ImmovableName"));
    assertThat(items).hasSize(1);
    items.first().click();
    saveButtons = $(SecurityPageElements.ACTION_HEADER).shouldBe(visible).$$(SecurityPageElements.SAVE);
    assertThat(saveButtons.size()).isEqualTo(1);
    saveButtons.get(0).shouldBe(visible).click();
}
Also used : ElementsCollection(com.codeborne.selenide.ElementsCollection) SelenideElement(com.codeborne.selenide.SelenideElement) TimeoutException(java.util.concurrent.TimeoutException) When(io.cucumber.java.en.When) ExcludeFromSelectorReports(io.syndesis.qe.report.selector.ExcludeFromSelectorReports)

Example 29 with When

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

the class DashboardSteps method deleteIntegrationOnDashboard.

@When("^delete the \"([^\"]*)\" integration in top 5 integrations$")
public void deleteIntegrationOnDashboard(String integrationName) {
    log.info("Trying to delete {} on top 5 integrations table");
    IntegrationsList integrationsList = new IntegrationsList(By.cssSelector("syndesis-dashboard-integrations"));
    integrationsList.invokeActionOnItem(integrationName, ListAction.DELETE);
}
Also used : IntegrationsList(io.syndesis.qe.pages.integrations.fragments.IntegrationsList) When(io.cucumber.java.en.When)

Example 30 with When

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

the class NameConnectionSteps method fillNameConnectionForm.

@When("^fills? Name Connection form$")
public void fillNameConnectionForm(DataTable data) {
    new Form(nameConnectionPage.getRootElement()).fillByLabel(data.asMap(String.class, String.class));
    TestUtils.sleepForJenkinsDelayIfHigher(1);
}
Also used : Form(io.syndesis.qe.fragments.common.form.Form) When(io.cucumber.java.en.When)

Aggregations

When (io.cucumber.java.en.When)111 SelenideElement (com.codeborne.selenide.SelenideElement)23 Map (java.util.Map)10 File (java.io.File)8 AttributeType (com.vaticle.typedb.core.concept.type.AttributeType)7 ModalDialogPage (io.syndesis.qe.pages.ModalDialogPage)7 Attribute (com.vaticle.typedb.core.concept.thing.Attribute)6 Account (io.syndesis.qe.account.Account)6 Form (io.syndesis.qe.fragments.common.form.Form)6 Syndesis (io.syndesis.qe.resource.impl.Syndesis)6 TimeoutException (java.util.concurrent.TimeoutException)6 RoleType (com.vaticle.typedb.core.concept.type.RoleType)5 IOException (java.io.IOException)5 HashMap (java.util.HashMap)5 Slf4j (lombok.extern.slf4j.Slf4j)5 ElementsCollection (com.codeborne.selenide.ElementsCollection)4 DataTable (io.cucumber.datatable.DataTable)4 IntegrationsEndpoint (io.syndesis.qe.endpoint.IntegrationsEndpoint)4 SyndesisRootPage (io.syndesis.qe.pages.SyndesisRootPage)4 List (java.util.List)4