Search in sources :

Example 1 with StepComponent

use of io.syndesis.qe.pages.integrations.edit.steps.StepComponent in project syndesis-qe by syndesisio.

the class IntegrationFlowViewComponent method getStepsArray.

public List<String> getStepsArray() {
    ElementsCollection steps = this.getRootElement().findAll(Element.STEP);
    List<String> stepsArray = new ArrayList<String>();
    for (int i = 1; i < (steps.size() - 1); i++) {
        steps.get(i).click();
        SelenideElement title = this.getRootElement().find(Element.ACTIVE_STEP);
        String type = title.getText();
        StepComponent stepComponent = stepComponentFactory.getStep(type, "");
        // wait for root element to be loaded
        stepComponent.getRootElement();
        stepComponent.initialize();
        stepsArray.add(stepComponent.getParameter());
    }
    this.getFirstVisibleButton("Done").shouldBe(visible).click();
    return stepsArray;
}
Also used : ElementsCollection(com.codeborne.selenide.ElementsCollection) StepComponent(io.syndesis.qe.pages.integrations.edit.steps.StepComponent) SelenideElement(com.codeborne.selenide.SelenideElement) ArrayList(java.util.ArrayList)

Example 2 with StepComponent

use of io.syndesis.qe.pages.integrations.edit.steps.StepComponent in project syndesis-qe by syndesisio.

the class IntegrationSteps method fillStepConfiguration.

@Then("^she fills the configuration page for \"([^\"]*)\" step with \"([^\"]*)\" parameter$")
public void fillStepConfiguration(String stepType, String parameter) {
    StepComponent stepComponent = editPage.getStepComponent(stepType, parameter);
    stepComponent.fillConfiguration();
}
Also used : BasicFilterStepComponent(io.syndesis.qe.pages.integrations.edit.steps.BasicFilterStepComponent) StepComponent(io.syndesis.qe.pages.integrations.edit.steps.StepComponent) Then(cucumber.api.java.en.Then)

Example 3 with StepComponent

use of io.syndesis.qe.pages.integrations.edit.steps.StepComponent 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 4 with StepComponent

use of io.syndesis.qe.pages.integrations.edit.steps.StepComponent in project syndesis-qe by syndesisio.

the class IntegrationSteps method verifyConfigureStepPage.

@Then("^she is presented with \"([^\"]*)\" step configuration page$")
public void verifyConfigureStepPage(String stepType) {
    StepComponent stepComponent = editPage.getStepComponent(stepType, "");
    log.info("there must be add step editPage root element");
    stepComponent.getRootElement().shouldBe(visible);
    assertThat(stepComponent.validate(), is(true));
}
Also used : BasicFilterStepComponent(io.syndesis.qe.pages.integrations.edit.steps.BasicFilterStepComponent) StepComponent(io.syndesis.qe.pages.integrations.edit.steps.StepComponent) Then(cucumber.api.java.en.Then)

Aggregations

StepComponent (io.syndesis.qe.pages.integrations.edit.steps.StepComponent)4 Then (cucumber.api.java.en.Then)3 BasicFilterStepComponent (io.syndesis.qe.pages.integrations.edit.steps.BasicFilterStepComponent)3 ElementsCollection (com.codeborne.selenide.ElementsCollection)2 ArrayList (java.util.ArrayList)2 SelenideElement (com.codeborne.selenide.SelenideElement)1