Search in sources :

Example 61 with When

use of io.cucumber.java.en.When in project syndesis-qe by syndesisio.

the class ApicurioSteps method removeWarning.

@ExcludeFromSelectorReports
@When("^remove warning via apicurio gui$")
public void removeWarning() {
    $(Elements.WARNING_ICON).shouldBe(visible).click();
    // there isn't really a nice way how to wait as the box is there all the time, we are waiting for different items to show
    TestUtils.sleepForJenkinsDelayIfHigher(10);
    SelenideElement firstProblemElement = $(Elements.PROBLEMS_CONTAINER).shouldBe(visible).$$(Elements.VALIDATION_PROBLEM).get(2);
    assertThat(firstProblemElement).isNotNull();
    assertThat(firstProblemElement.text()).containsIgnoringCase("Operation Summary should be less than 120 characters");
    try {
        firstProblemElement.shouldBe(visible).$(By.tagName("a")).shouldBe(visible).click();
    } catch (org.openqa.selenium.StaleElementReferenceException e) {
        $(Elements.PROBLEMS_CONTAINER).shouldBe(visible).$$(Elements.VALIDATION_PROBLEM).get(0).shouldBe(visible).$(By.tagName("a")).shouldBe(visible).click();
    }
    $(Elements.WARNING_ICON).shouldBe(visible).click();
    $(Elements.INFO_SECTION).shouldBe(visible).$(TextFormElements.SUMMARY).shouldBe(visible).click();
    SelenideElement input = $(Elements.INFO_SECTION).$(TextFormElements.INPUT_TEXT).shouldBe(visible);
    try {
        input.clear();
        input.sendKeys("Short description");
    } catch (org.openqa.selenium.StaleElementReferenceException e) {
        $(Elements.INFO_SECTION).$(TextFormElements.INPUT_TEXT).shouldBe(visible).clear();
        $(Elements.INFO_SECTION).$(TextFormElements.INPUT_TEXT).shouldBe(visible).sendKeys("Short description");
    }
    $(Elements.INFO_SECTION).$(TextFormElements.SAVE).shouldBe(visible).click();
    $(Elements.WARNING_ICON).shouldBe(visible).getText();
    assertThat($(Elements.WARNING_ICON).shouldBe(visible).getText()).containsIgnoringCase("57");
}
Also used : SelenideElement(com.codeborne.selenide.SelenideElement) When(io.cucumber.java.en.When) ExcludeFromSelectorReports(io.syndesis.qe.report.selector.ExcludeFromSelectorReports)

Example 62 with When

use of io.cucumber.java.en.When in project syndesis-qe by syndesisio.

the class ApicurioSteps method clickOnApicurioButton.

@When("^click on the \"([^\"]*)\" apicurio button*$")
public void clickOnApicurioButton(String buttonTitle) {
    SelenideElement button = getApicurioButton(buttonTitle);
    log.info("apicurio button found *{}*", button.toString());
    button.shouldBe(visible, enabled).shouldNotHave(attribute("disabled")).click();
}
Also used : SelenideElement(com.codeborne.selenide.SelenideElement) When(io.cucumber.java.en.When)

Example 63 with When

use of io.cucumber.java.en.When in project syndesis-qe by syndesisio.

the class ExtensionSteps method uploadExtensionFromFile.

/**
 * Uploads an extension from any relative path
 *
 * @param extensionName
 * @param extensionPath
 * @throws Throwable
 */
@When("^upload extension with name \"([^\"]*)\" from relative path \"([^\"]*)\"$")
public void uploadExtensionFromFile(String extensionName, String extensionPath) throws Throwable {
    String techExtensionUrl = extensionPath + extensionName;
    Path techExtensionJar = Paths.get(techExtensionUrl).toAbsolutePath();
    UploadFile.uploadFile($(By.tagName("input")).should(exist), techExtensionJar.toFile());
}
Also used : Path(java.nio.file.Path) When(io.cucumber.java.en.When)

Example 64 with When

use of io.cucumber.java.en.When in project syndesis-qe by syndesisio.

the class DataMapperSteps method combineDataMapperStep.

@When("COMBINE using Step {int} and strategy {string} into {string} and sources")
public void combineDataMapperStep(int fromStep, String strategy, String targetField, DataTable sourceMappingData) {
    DataMapperStepDefinition newDmStep = new DataMapperStepDefinition();
    newDmStep.setFromStep(fromStep);
    newDmStep.setInputFields(sourceMappingData.transpose().asList(String.class));
    newDmStep.setOutputFields(Collections.singletonList(targetField));
    newDmStep.setMappingType(MappingType.COMBINE);
    newDmStep.setStrategy(SeparatorType.valueOf(strategy));
    super.getSteps().getLastStepDefinition().getDataMapperDefinition().getDataMapperStepDefinition().add(newDmStep);
}
Also used : DataMapperStepDefinition(io.syndesis.qe.entities.DataMapperStepDefinition) When(io.cucumber.java.en.When)

Example 65 with When

use of io.cucumber.java.en.When in project syndesis-qe by syndesisio.

the class DataMapperSteps method addTransformation.

@When("add {string} transformation on {string} field with id {string} with properties")
public void addTransformation(String transformation, String target, String id, DataTable properties) {
    try {
        Class<?> c = Class.forName("io.atlasmap.v2." + StringUtils.capitalize(transformation));
        Constructor<?> cons = c.getConstructor();
        Object t = cons.newInstance();
        Map<String, String> stringProperties = properties.asMap(String.class, String.class);
        for (Map.Entry<String, String> entry : stringProperties.entrySet()) {
            Field f = c.getDeclaredField(entry.getKey());
            f.setAccessible(true);
            f.set(t, entry.getValue());
        }
        Map<String, Map<String, List<Object>>> transformations = super.getSteps().getLastStepDefinition().getDataMapperDefinition().getLastDatamapperStepDefinition().getTransformations();
        transformations.computeIfAbsent(target, v -> new HashMap<>());
        transformations.get(target).computeIfAbsent(id, v -> new ArrayList<>());
        transformations.get(target).get(id).add(t);
    } catch (Exception e) {
        fail("Unable to create atlasmap class for " + transformation, e);
    }
}
Also used : Field(java.lang.reflect.Field) HashMap(java.util.HashMap) Map(java.util.Map) When(io.cucumber.java.en.When)

Aggregations

When (io.cucumber.java.en.When)111 SelenideElement (com.codeborne.selenide.SelenideElement)23 Map (java.util.Map)10 File (java.io.File)8 AttributeType (com.vaticle.typedb.core.concept.type.AttributeType)7 ModalDialogPage (io.syndesis.qe.pages.ModalDialogPage)7 Attribute (com.vaticle.typedb.core.concept.thing.Attribute)6 Account (io.syndesis.qe.account.Account)6 Form (io.syndesis.qe.fragments.common.form.Form)6 Syndesis (io.syndesis.qe.resource.impl.Syndesis)6 TimeoutException (java.util.concurrent.TimeoutException)6 RoleType (com.vaticle.typedb.core.concept.type.RoleType)5 IOException (java.io.IOException)5 HashMap (java.util.HashMap)5 Slf4j (lombok.extern.slf4j.Slf4j)5 ElementsCollection (com.codeborne.selenide.ElementsCollection)4 DataTable (io.cucumber.datatable.DataTable)4 IntegrationsEndpoint (io.syndesis.qe.endpoint.IntegrationsEndpoint)4 SyndesisRootPage (io.syndesis.qe.pages.SyndesisRootPage)4 List (java.util.List)4