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));
}
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();
}
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)));
}
}
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();
}
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)));
}
}
Aggregations