use of com.codeborne.selenide.ElementsCollection in project syndesis-qe by syndesisio.
the class IntegrationSteps method deleteRandomStepsAndCheckRest.
// what rest??
@Then("^she deletes \"(\\d+)\" random integration steps and checks the rest$")
public void deleteRandomStepsAndCheckRest(Integer numberOfSteps) {
log.info("Deleting random phases");
List<String> list = editPage.getFlowViewComponent().getStepsArray();
ElementsCollection deletes = editPage.getFlowViewComponent().getAllTrashes().shouldBe(sizeGreaterThanOrEqual(1));
int count = deletes.size();
List<Integer> randomIndexes = new ArrayList<>();
for (int i = 0; i < numberOfSteps; i++) {
randomIndexes.add((int) Math.floor(Math.random() * (count - 2 - i)));
}
for (Integer randomIndex : randomIndexes) {
deletes.get(randomIndex + 1).click();
editPage.getFirstVisibleButton("OK").shouldBe(visible).click();
list.remove(randomIndex);
}
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