Search in sources :

Example 31 with SelenideElement

use of com.codeborne.selenide.SelenideElement in project syndesis-qe by syndesisio.

the class OAuthSettingsComponent method fillSettingsItemForm.

/**
 * @param itemTitle title of settings entry
 * @param formData object where key is name of input field and value it's content
 */
public void fillSettingsItemForm(String itemTitle, Map<String, String> formData) {
    log.info("filling {} with data '{}'", itemTitle, formData.toString());
    SelenideElement item = this.getSettingsItem(itemTitle);
    for (String key : formData.keySet()) {
        SelenideElement input = item.$(String.format("input[name = \"%s\"]", key));
        item.sendKeys(formData.get(key));
    }
}
Also used : SelenideElement(com.codeborne.selenide.SelenideElement)

Example 32 with SelenideElement

use of com.codeborne.selenide.SelenideElement in project syndesis-qe by syndesisio.

the class CommonSteps method navigateToHelp.

@When("^.*navigates? to the \"([^\"]*)\" page in help menu$")
public void navigateToHelp(String title) {
    SelenideElement helpDropdownMenu = $(By.id("dropdownHelp")).shouldBe(visible);
    if (!helpDropdownMenu.getAttribute("class").contains("open")) {
        helpDropdownMenu.click();
    }
    SelenideElement dropdownElementsTable = $(By.className("dropdown-menu")).shouldBe(visible);
    ElementsCollection dropdownElements = dropdownElementsTable.findAll(By.tagName("a"));
    dropdownElements.filter(text(title)).shouldHaveSize(1).get(0).shouldBe(visible).click();
}
Also used : ElementsCollection(com.codeborne.selenide.ElementsCollection) SelenideElement(com.codeborne.selenide.SelenideElement) When(cucumber.api.java.en.When)

Example 33 with SelenideElement

use of com.codeborne.selenide.SelenideElement in project syndesis-qe by syndesisio.

the class CommonSteps method login.

@Given("^\"([^\"]*)\" logs into the Syndesis$")
public void login(String username) throws Throwable {
    Selenide.open(TestConfiguration.syndesisUrl());
    String currentUrl = WebDriverRunner.getWebDriver().getCurrentUrl();
    if (currentUrl.contains("api.fuse-ignite.openshift.com")) {
        // click only if there is Ignite cluster login page
        SelenideElement login = $(By.className("login-redhat"));
        if (login.isDisplayed()) {
            login.click();
        }
        RHDevLogin rhDevLogin = new RHDevLogin();
        rhDevLogin.login(TestConfiguration.syndesisUsername(), TestConfiguration.syndesisPassword());
    } else if (currentUrl.contains(":8443/login")) {
        log.info("Minishift cluster login page");
        MinishiftLogin minishiftLogin = new MinishiftLogin();
        minishiftLogin.login(TestConfiguration.syndesisUsername(), TestConfiguration.syndesisPassword());
    } else if (currentUrl.contains("github.com/login")) {
        GitHubLogin gitHubLogin = new GitHubLogin();
        gitHubLogin.login(TestConfiguration.syndesisUsername(), TestConfiguration.syndesisPassword());
    }
    currentUrl = WebDriverRunner.getWebDriver().getCurrentUrl();
    if (currentUrl.contains("oauth/authorize/approve")) {
        log.info("Authorize access login page");
        $("input[name=\"approve\"]").shouldBe(visible).click();
    }
}
Also used : MinishiftLogin(io.syndesis.qe.pages.login.MinishiftLogin) RHDevLogin(io.syndesis.qe.pages.login.RHDevLogin) SelenideElement(com.codeborne.selenide.SelenideElement) GitHubLogin(io.syndesis.qe.pages.login.GitHubLogin) Given(cucumber.api.java.en.Given)

Example 34 with SelenideElement

use of com.codeborne.selenide.SelenideElement in project syndesis-qe by syndesisio.

the class CommonSteps method expectTableTitlePresent.

public void expectTableTitlePresent(String tableTitle) {
    SelenideElement table = new SyndesisRootPage().getTitleByText(tableTitle);
    table.shouldBe(visible);
}
Also used : SyndesisRootPage(io.syndesis.qe.pages.SyndesisRootPage) SelenideElement(com.codeborne.selenide.SelenideElement)

Example 35 with SelenideElement

use of com.codeborne.selenide.SelenideElement in project syndesis-qe by syndesisio.

the class CommonSteps method successNotificationIsPresentWithError.

@Then("^she can see \"([^\"]*)\" in alert-success notification$")
public void successNotificationIsPresentWithError(String textMessage) {
    SelenideElement allertSucces = new SyndesisRootPage().getElementByClassName("alert-success");
    allertSucces.shouldBe(visible);
    Assertions.assertThat(allertSucces.getText().equals(textMessage)).isTrue();
    log.info("Text message {} was found.", textMessage);
}
Also used : SyndesisRootPage(io.syndesis.qe.pages.SyndesisRootPage) SelenideElement(com.codeborne.selenide.SelenideElement) Then(cucumber.api.java.en.Then)

Aggregations

SelenideElement (com.codeborne.selenide.SelenideElement)91 ElementsCollection (com.codeborne.selenide.ElementsCollection)16 Then (cucumber.api.java.en.Then)13 And (cucumber.api.java.en.And)8 SyndesisRootPage (io.syndesis.qe.pages.SyndesisRootPage)6 ArrayList (java.util.ArrayList)5 When (cucumber.api.java.en.When)4 Test (org.junit.Test)4 QualityGate (org.sonar.wsclient.qualitygate.QualityGate)4 ProjectQualityGatePage (pageobjects.ProjectQualityGatePage)4 Given (cucumber.api.java.en.Given)2 ModalDialogPage (io.syndesis.qe.pages.ModalDialogPage)2 DashboardPage (io.syndesis.qe.pages.dashboard.DashboardPage)2 StepComponent (io.syndesis.qe.pages.integrations.edit.steps.StepComponent)2 List (java.util.List)2 By (org.openqa.selenium.By)2 CollectionCondition.sizeGreaterThanOrEqual (com.codeborne.selenide.CollectionCondition.sizeGreaterThanOrEqual)1 Condition.visible (com.codeborne.selenide.Condition.visible)1 AbstractSelenideTest (com.evolveum.midpoint.testing.selenide.tests.AbstractSelenideTest)1 DataTable (cucumber.api.DataTable)1