Search in sources :

Example 26 with ElementsCollection

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

the class OAuthSettingsComponent method getSettingsItem.

/**
 * Fetch all settings items and find proper one according to given name.
 *
 * @param name name of settings item
 * @returns element
 */
public SelenideElement getSettingsItem(String name) {
    ElementsCollection items = this.listSettingsItems(null).shouldBe(sizeGreaterThan(0));
    log.info("searching for {} in {} items", name, items.size());
    for (SelenideElement item : items) {
        String title = item.$(Element.SETTINGS_TITLE).shouldBe(visible).getText();
        if (name.equals(title)) {
            return item;
        }
    }
    throw new IllegalArgumentException(String.format("item%s not found", name));
}
Also used : ElementsCollection(com.codeborne.selenide.ElementsCollection) SelenideElement(com.codeborne.selenide.SelenideElement)

Example 27 with ElementsCollection

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

the class CommonSteps method navigateTo.

@When("^\"([^\"]*)\" navigates? to the \"([^\"]*)\" page$")
public void navigateTo(String username, String title) {
    SelenideElement selenideElement = $(By.className("nav-pf-vertical")).shouldBe(visible);
    ElementsCollection allLinks = selenideElement.findAll(By.className("list-group-item-value"));
    allLinks.find(Condition.exactText(title)).shouldBe(visible).click();
}
Also used : ElementsCollection(com.codeborne.selenide.ElementsCollection) SelenideElement(com.codeborne.selenide.SelenideElement) When(cucumber.api.java.en.When)

Example 28 with ElementsCollection

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

the class IntegrationSteps method addRandomStepsAndCheckRest.

@Then("^she adds \"(\\d+)\" random steps and then checks the structure$")
public void addRandomStepsAndCheckRest(Integer numberOfSteps) {
    log.info("Adding random phases");
    List<String> list = editPage.getFlowViewComponent().getStepsArray();
    editPage.getButton("Add a Step").shouldBe(visible).click();
    ElementsCollection links = editPage.getLinks("Add a step");
    Integer count = links.size();
    List<Integer> randomIndexes = new ArrayList<>();
    for (int i = 0; i < numberOfSteps; i++) {
        randomIndexes.add((int) Math.floor((Math.random() * count)));
    }
    for (int randomIndex : randomIndexes) {
        links.get(randomIndex).click();
        String stepType = "Basic Filter";
        String stepParameter = "ANY of the following, pathx " + randomIndex + ", Contains, valuex " + randomIndex;
        editPage.getIntegrationStepSelectComponent().chooseStep(stepType);
        StepComponent stepComponent = editPage.getStepComponent(stepType, stepParameter);
        stepComponent.fillConfiguration();
        editPage.getButton("Next").shouldBe(visible).click();
        editPage.getButton("Add a Step").shouldBe(visible).click();
        list.add(randomIndex, stepParameter);
    }
    List<String> list2 = editPage.getFlowViewComponent().getStepsArray();
    for (int i = 0; i < list2.size(); i++) {
        log.info("assserting {} and {}", list.get(i), list2.get(i));
        assertThat(list.get(i), is(list2.get(i)));
    }
}
Also used : ElementsCollection(com.codeborne.selenide.ElementsCollection) BasicFilterStepComponent(io.syndesis.qe.pages.integrations.edit.steps.BasicFilterStepComponent) StepComponent(io.syndesis.qe.pages.integrations.edit.steps.StepComponent) ArrayList(java.util.ArrayList) Then(cucumber.api.java.en.Then)

Example 29 with ElementsCollection

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

the class IntegrationSteps method deleteFilterRuleOnPosition.

@Then("^delete basic filter rule on position \"(\\d+)\"$")
public void deleteFilterRuleOnPosition(Integer position) {
    ElementsCollection trashes = editPage.getFlowViewComponent().getAllTrashes();
    trashes.get(position - 1).click();
}
Also used : ElementsCollection(com.codeborne.selenide.ElementsCollection) Then(cucumber.api.java.en.Then)

Example 30 with ElementsCollection

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

the class IntegrationSteps method deleteStepOnPositionAndCheckRest.

// what rest???
@Then("^she deletes step on position \"(\\d+)\" and checks the rest$")
public void deleteStepOnPositionAndCheckRest(Integer positionOfStep) {
    log.info("Deleting step on position {}", positionOfStep);
    List<String> list = editPage.getFlowViewComponent().getStepsArray();
    ElementsCollection deletes = this.editPage.getFlowViewComponent().getAllTrashes().shouldBe(sizeGreaterThanOrEqual(1));
    Integer indexOfStep = positionOfStep + 1;
    deletes.get(indexOfStep).click();
    editPage.getFirstVisibleButton("OK");
    list.remove(positionOfStep);
    // NOW CHECK:
    List<String> list2 = editPage.getFlowViewComponent().getStepsArray();
    for (int i = 0; i < list.size(); i++) {
        log.info("assserting {} and {}", list.get(i), list2.get(i));
        assertThat(list.get(i), is(list2.get(i)));
    }
}
Also used : ElementsCollection(com.codeborne.selenide.ElementsCollection) Then(cucumber.api.java.en.Then)

Aggregations

ElementsCollection (com.codeborne.selenide.ElementsCollection)31 SelenideElement (com.codeborne.selenide.SelenideElement)15 ArrayList (java.util.ArrayList)9 Then (cucumber.api.java.en.Then)4 When (cucumber.api.java.en.When)2 StepComponent (io.syndesis.qe.pages.integrations.edit.steps.StepComponent)2 Given (cucumber.api.java.en.Given)1 ModalDialogPage (io.syndesis.qe.pages.ModalDialogPage)1 Connections (io.syndesis.qe.pages.connections.Connections)1 BasicFilterStepComponent (io.syndesis.qe.pages.integrations.edit.steps.BasicFilterStepComponent)1 ConfigureConnectionSteps (io.syndesis.qe.steps.connections.wizard.phases.ConfigureConnectionSteps)1 NameConnectionSteps (io.syndesis.qe.steps.connections.wizard.phases.NameConnectionSteps)1 List (java.util.List)1