Search in sources :

Example 36 with When

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

the class ImportIntegrationSteps method importIntegrationFromFile.

@When("^import integration from relative file path \"([^\"]*)\"$")
public void importIntegrationFromFile(String stringPathToFile) {
    importIntegrationPage.importIntegration(new File(stringPathToFile));
    // give jenkins more time so the integration shows up in the list
    TestUtils.sleepIgnoreInterrupt(TestConfiguration.getJenkinsDelay());
}
Also used : File(java.io.File) When(io.cucumber.java.en.When)

Example 37 with When

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

the class ApicurioSteps method setPathParameterTypeAsForPathParameter.

/**
 * @param page can only have values "path" and "operations"
 */
@When("^set path parameter type as \"([^\"]*)\" for path parameter \"([^\"]*)\" on \"([^\"]*)\" page")
public void setPathParameterTypeAsForPathParameter(String as, String parameter, String page) {
    SelenideElement root = ApicurioUtils.getPageElement(page);
    ApicurioUtils.openPathTypes(parameter, root);
    SelenideElement parameterElement = root.$(PathElements.PARAMETERS_SECTION).$$(PathElements.PATH_PARAMETERS_ROW).filter(text(parameter)).first();
    ApicurioUtils.setDropDownValue(ApicurioUtils.Buttons.PROPERTY_TYPE_AS.getButtonId(), as, parameterElement);
}
Also used : SelenideElement(com.codeborne.selenide.SelenideElement) When(io.cucumber.java.en.When)

Example 38 with When

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

the class ApicurioSteps method setTypeOfMediaType.

@When("^(set|check) type of \"([^\"]*)\" media type (?:to|is) \"([^\"]*)\" on property \"([^\"]*)\" for response \"([^\"]*)\"$")
public void setTypeOfMediaType(String check, String mediaType, String type, String property, String response) {
    ApicurioUtils.ensureMediaTypeExistsForResponse(mediaType, response);
    SelenideElement mediaRow = $$("media-type-row").find(text(mediaType));
    SelenideElement typeElement = mediaRow.$(".type");
    if (!typeElement.has(cssClass("selected"))) {
        typeElement.click();
    }
    String buttonId = ApicurioUtils.getButtonId(property);
    if ("set".equalsIgnoreCase(check)) {
        ApicurioUtils.setDropDownValue(buttonId, type, $("schema-type-editor"));
    } else {
        String value = mediaRow.$(buttonId).getText();
        assertThat(value).as("%s is %s but should be %s", property, value, type).isEqualTo(type);
    }
}
Also used : SelenideElement(com.codeborne.selenide.SelenideElement) When(io.cucumber.java.en.When)

Example 39 with When

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

the class GoogleCalendarSteps method fillInUpdateEventFormUsingCalendarIdSummaryAndDescription.

@When("^fill in update event form using calendar \"([^\"]*)\", old summary \"([^\"]*)\", summary \"([^\"]*)\" and description \"([^\"]*)\" for " + "user \"([^\"]*)\"$")
public void fillInUpdateEventFormUsingCalendarIdSummaryAndDescription(String calendarName, String oldSummary, String summary, String description, String ga) throws Throwable {
    String aliasedCalendarName = gcu.getAliasedCalendarName(calendarName);
    Calendar c = gcu.getPreviouslyCreatedCalendar(ga, aliasedCalendarName);
    assertThat(c).as("Calendar %s is not amongst the created calendars.", aliasedCalendarName).isNotNull();
    Event e = gcu.getEventBySummary(ga, c.getId(), oldSummary);
    assertThat(e).as(String.format("Event %s is not present in calendar %s.", oldSummary, aliasedCalendarName)).isNotNull();
    fillInUpdateEventForm(aliasedCalendarName, e.getId(), summary, description);
}
Also used : Calendar(com.google.api.services.calendar.model.Calendar) Event(com.google.api.services.calendar.model.Event) GetSpecificEvent(io.syndesis.qe.pages.integrations.editor.add.connection.actions.google.GetSpecificEvent) When(io.cucumber.java.en.When)

Example 40 with When

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

the class ODataSteps method insertEntityToODataService.

@When("^.*insert entity \"([^\"]*)\" into \"([^\"]*)\" collection on OData service$")
public void insertEntityToODataService(final String entity, final String collection) {
    String requestBody = ODataUtils.readResourceFile(this.getClass().getClassLoader().getResource(entity));
    Headers headers = Headers.of("Content-Type", "application/json");
    HTTPResponse response = HTTPUtils.doPostRequest(ODataUtils.getV4OpenshiftRoute() + collection, requestBody, headers);
    assertThat(response.getCode()).isEqualTo(201);
    log.info("Entity from resource file " + entity + " succesfully inserted to sample OData service");
}
Also used : Headers(okhttp3.Headers) HTTPResponse(io.syndesis.qe.utils.http.HTTPResponse) 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