Search in sources :

Example 6 with ExcludeFromSelectorReports

use of io.syndesis.qe.report.selector.ExcludeFromSelectorReports 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 7 with ExcludeFromSelectorReports

use of io.syndesis.qe.report.selector.ExcludeFromSelectorReports in project syndesis-qe by syndesisio.

the class ApicurioSteps method verifySelectedSecurity.

@ExcludeFromSelectorReports
@Then("^check that api connector authentication section contains security type \"([^\"]*)\"$")
public void verifySelectedSecurity(String securityType) {
    SelenideElement securityForm = $(SpecifySecurity.Element.SECURITY_FORM).shouldBe(visible);
    switch(securityType) {
        case "OAuth 2.0":
            securityForm.$(SpecifySecurity.SecurityType.OAUTH_2).shouldBe(visible);
            assertThat(securityForm.text()).containsIgnoringCase("OAuth 2.0 ");
            break;
        case "HTTP Basic Authentication":
            securityForm.$(SpecifySecurity.SecurityType.HTTP_BASIC_AUTHENTICATION).shouldBe(visible);
            assertThat(securityForm.text()).containsIgnoringCase("HTTP Basic Authentication");
            break;
        case "API Key":
            securityForm.$(SpecifySecurity.SecurityType.API_KEY).shouldBe(visible);
            assertThat(securityForm.text()).containsIgnoringCase("API Key");
            break;
        case "No Security":
            securityForm.$(SpecifySecurity.SecurityType.NO_SECURITY).shouldBe(visible);
            assertThat(securityForm.text()).containsIgnoringCase("No Security");
            break;
        default:
            fail("The Auth type < " + securityType + "> is not implemented by the test.");
    }
}
Also used : SelenideElement(com.codeborne.selenide.SelenideElement) ExcludeFromSelectorReports(io.syndesis.qe.report.selector.ExcludeFromSelectorReports) Then(io.cucumber.java.en.Then)

Example 8 with ExcludeFromSelectorReports

use of io.syndesis.qe.report.selector.ExcludeFromSelectorReports in project syndesis-qe by syndesisio.

the class ApicurioSteps method verifyErrors.

@ExcludeFromSelectorReports
@Then("^check that apicurio shows (\\d+) errors?$")
public void verifyErrors(int expectedCount) {
    SelenideElement operations = $(Elements.ERRORS).shouldBe(visible);
    assertThat(operations).isNotNull();
    assertThat(operations.getText()).containsIgnoringCase(Integer.toString(expectedCount));
}
Also used : SelenideElement(com.codeborne.selenide.SelenideElement) ExcludeFromSelectorReports(io.syndesis.qe.report.selector.ExcludeFromSelectorReports) Then(io.cucumber.java.en.Then)

Example 9 with ExcludeFromSelectorReports

use of io.syndesis.qe.report.selector.ExcludeFromSelectorReports in project syndesis-qe by syndesisio.

the class ApicurioSteps method doAddOperation.

/**
 * Add an operation for apicurito path.
 * If we want to see an error in review, we do not fill operation description
 *
 * @param withError - true to invoke an error in syndesis apicurito review due to empty description field
 */
@ExcludeFromSelectorReports
public void doAddOperation(boolean withError) {
    $(Elements.OPERATIONS_CONTAINER).shouldBe(visible).$(Elements.ADD_OPERATION).shouldBe(visible).click();
    SelenideElement pathInput = $(Elements.MODAL_DIALOG).shouldBe(visible).$(Elements.MODAL_PATH_INPUT).shouldBe(visible);
    try {
        pathInput.clear();
        pathInput.sendKeys("/syndesistestpath");
    } catch (org.openqa.selenium.StaleElementReferenceException e) {
        $(Elements.MODAL_DIALOG).shouldBe(visible).$(Elements.MODAL_PATH_INPUT).shouldBe(visible).clear();
        $(Elements.MODAL_DIALOG).shouldBe(visible).$(Elements.MODAL_PATH_INPUT).shouldBe(visible).sendKeys("/syndesistestpath");
    }
    $(Elements.MODAL_FOOTER).shouldBe(visible).$(Elements.MODAL_SUBMIT_ADD).shouldBe(visible).click();
    clickOnButtonInApicurio("Add Operation");
    $(Elements.RESPONSE_SECTION).shouldBe(visible).scrollIntoView(true).$$(By.tagName("button")).filter(Condition.attribute("title", "Add a response to the operation.")).shouldHaveSize(1).first().click();
    $(Elements.MODAL_SUBMIT_ADD).shouldBe(visible).click();
    if (!withError) {
        $(Elements.RESPONSE_SECTION).shouldBe(visible).scrollIntoView(true).$(Elements.MARKDOWN_EDITOR).shouldBe(visible).click();
        executeJavaScript("document.getElementsByTagName(\"ace-editor\").item(0).setAttribute(\"id\", \"editor\");" + "ace.edit(\"editor\").setValue('description here');");
        $(Elements.RESPONSE_SECTION).shouldBe(visible).scrollIntoView(true).$$(By.tagName("button")).filter(Condition.attribute("title", "Save changes.")).shouldHaveSize(1).first().click();
    }
}
Also used : SelenideElement(com.codeborne.selenide.SelenideElement) ExcludeFromSelectorReports(io.syndesis.qe.report.selector.ExcludeFromSelectorReports)

Aggregations

ExcludeFromSelectorReports (io.syndesis.qe.report.selector.ExcludeFromSelectorReports)9 SelenideElement (com.codeborne.selenide.SelenideElement)8 Then (io.cucumber.java.en.Then)4 When (io.cucumber.java.en.When)3 ElementsCollection (com.codeborne.selenide.ElementsCollection)1 TimeoutException (java.util.concurrent.TimeoutException)1 Dimension (org.openqa.selenium.Dimension)1 WebDriver (org.openqa.selenium.WebDriver)1