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);
}
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);
}
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());
}
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);
}
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();
}
Aggregations