Search in sources :

Example 76 with Then

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

the class CommonSteps method validateCredentials.

@Then("^.*validate credentials$")
public void validateCredentials() {
    Map<String, Account> accounts = AccountsDirectory.getInstance().getAccounts();
    List<List<String>> allAccountsWithDetailsList = new ArrayList<>();
    accounts.keySet().forEach(key -> {
        List<String> accountWithDetailsInList = new ArrayList<>();
        Account currentAccount;
        try {
            currentAccount = AccountsDirectory.getInstance().get(key);
        } catch (IllegalStateException e) {
            return;
        }
        String service = currentAccount.getService();
        Credentials current;
        try {
            current = Credentials.valueOf(service.toUpperCase().replace(" ", "_").replace("-", "_").replaceAll("[()]", ""));
        } catch (IllegalArgumentException ex) {
            throw new IllegalArgumentException("Unable to find enum value for " + service + " account." + " New account should be included in smoke tests");
        }
        switch(current) {
            case DROPBOX:
                service = "DropBox";
                break;
            case SLACK:
                service = "Slack";
                break;
            case TELEGRAM:
                service = "Telegram";
                break;
            case SERVICENOW:
                service = "ServiceNow";
                break;
            case BOX:
                service = "Box";
                break;
            case SEND_EMAIL_SMTP:
                service = "Send Email (smtp)";
                break;
            case RECEIVE_EMAIL_IMAP_OR_POP3:
                service = "Receive Email (imap or pop3)";
                break;
            default:
                log.info("Credentials for " + current + " are either tested via OAuth or do not use 3rd party application. Skipping");
                return;
        }
        // type
        accountWithDetailsInList.add(service);
        // name
        accountWithDetailsInList.add(key);
        // connection name
        accountWithDetailsInList.add("my " + key + " connection");
        // description
        accountWithDetailsInList.add("some description");
        log.trace("Inserting: " + accountWithDetailsInList.toString());
        allAccountsWithDetailsList.add(new ArrayList<>(accountWithDetailsInList));
        log.trace("Current values in list list: " + allAccountsWithDetailsList.toString());
    });
    log.debug("Final status of list: " + allAccountsWithDetailsList.toString());
    DataTable accountsTalbe = DataTable.create(allAccountsWithDetailsList);
    createConnections(accountsTalbe);
}
Also used : GoogleAccount(io.syndesis.qe.utils.google.GoogleAccount) Account(io.syndesis.qe.account.Account) DataTable(io.cucumber.datatable.DataTable) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) Then(io.cucumber.java.en.Then)

Example 77 with Then

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

the class ConnectionSteps method checkTextOfTooltip.

@Then("^check that (\\d+). tooltip contains text \"([^\"]*)\"$")
public void checkTextOfTooltip(int tooltip, String expectedText) {
    if ($(By.className("form-label-hint__popover")).exists()) {
        $(By.className("form-label-hint__popover")).find(By.className("pf-c-button")).click();
    }
    SelenideElement selenideElement = new ConfigureConnectionSteps().getAllToolTips().get(tooltip - 1);
    // open tooltip
    selenideElement.click();
    TestUtils.sleepForJenkinsDelayIfHigher(2);
    assertThat($(By.className("form-label-hint__popover")).text()).isEqualTo(expectedText);
}
Also used : ConfigureConnectionSteps(io.syndesis.qe.steps.connections.wizard.phases.ConfigureConnectionSteps) SelenideElement(com.codeborne.selenide.SelenideElement) Then(io.cucumber.java.en.Then)

Example 78 with Then

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

the class EditorSteps method verifyDeleteButtonOnStartFinishStepNotVisible.

@Then("^verify delete button on step ([0-9]+) (is|is not) visible$")
public void verifyDeleteButtonOnStartFinishStepNotVisible(int position, String visibility) {
    SelenideElement trashIcon = flowViewComponent.getStepOnPosition(position).$(By.className("fa-trash"));
    assertEquals("Delete icon should" + visibility.replace("is", "") + " be visible", "is".equals(visibility), trashIcon.exists());
}
Also used : SelenideElement(com.codeborne.selenide.SelenideElement) Then(io.cucumber.java.en.Then)

Example 79 with Then

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

the class ConnectionSteps method checkNumberOfTooltips.

@Then("^check that page contains (\\d+) tooltips$")
public void checkNumberOfTooltips(int expectedSize) {
    TestUtils.sleepForJenkinsDelayIfHigher(1);
    assertThat(new ConfigureConnectionSteps().getAllToolTips()).hasSize(expectedSize);
}
Also used : ConfigureConnectionSteps(io.syndesis.qe.steps.connections.wizard.phases.ConfigureConnectionSteps) Then(io.cucumber.java.en.Then)

Example 80 with Then

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

the class ConnectionSteps method helpBlockVisible.

@Then("^check visibility of help block with text \"([^\"]*)\"$")
public void helpBlockVisible(String helpText) {
    SelenideElement helpBlock = $(By.className("help-block")).shouldBe(visible);
    helpBlock.shouldBe(visible);
    assertThat(helpBlock.getText().equals(helpText)).isTrue();
}
Also used : SelenideElement(com.codeborne.selenide.SelenideElement) Then(io.cucumber.java.en.Then)

Aggregations

Then (io.cucumber.java.en.Then)124 SelenideElement (com.codeborne.selenide.SelenideElement)20 AttributeType (com.vaticle.typedb.core.concept.type.AttributeType)16 List (java.util.List)13 HashMap (java.util.HashMap)10 SyndesisRootPage (io.syndesis.qe.pages.SyndesisRootPage)9 Map (java.util.Map)9 ThingType (com.vaticle.typedb.core.concept.type.ThingType)8 DataTable (io.cucumber.datatable.DataTable)8 When (io.cucumber.java.en.When)8 Pod (io.fabric8.kubernetes.api.model.Pod)8 Quantity (io.fabric8.kubernetes.api.model.Quantity)8 ArrayList (java.util.ArrayList)8 Date (java.util.Date)8 TimeoutException (java.util.concurrent.TimeoutException)8 TestUtils (io.syndesis.qe.utils.TestUtils)7 HTTPResponse (io.syndesis.qe.utils.http.HTTPResponse)7 OpenShiftWaitUtils (io.syndesis.qe.wait.OpenShiftWaitUtils)7 Slf4j (lombok.extern.slf4j.Slf4j)7 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)7