use of io.syndesis.qe.account.Account in project syndesis-qe by syndesisio.
the class CommonSteps method fillFormByTestIdFromCreds.
@Then("^fill in data-testid field \"([^\"]*)\" from property \"([^\"]*)\" of credentials \"([^\"]*)\"")
public void fillFormByTestIdFromCreds(String testId, String property, String credentials) {
Account account = AccountsDirectory.getInstance().get(credentials);
Map<String, String> map = new HashMap<>();
map.put(testId, account.getProperty(property));
new Form(new SyndesisRootPage().getRootElement()).fillByTestId(map);
}
use of io.syndesis.qe.account.Account 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.syndesis.qe.account.Account in project syndesis-qe by syndesisio.
the class CommonSteps method loginToGoogleIfNeeded.
private void loginToGoogleIfNeeded(String s) {
// if the browser has previously logged into google account syndesis will
// immediately move to next screen and will have "Successfully%20authorized%20Syndesis's%20access" in the URL
log.info("Current url: {}", WebDriverRunner.getWebDriver().getCurrentUrl().toLowerCase());
if (isStringInUrl("Successfully%20authorized%20Syndesis's%20access", 5) || $(Alert.SUCCESS.getBy()).is(visible)) {
log.info("User is already logged");
return;
}
waitForCallbackRedirect("google");
Account account = AccountsDirectory.getInstance().get(s);
// change language if needs
if ($(ByUtils.customAttribute("data-value", "en")).has(Condition.attribute("tabindex", "-1"))) {
$(By.id("lang-chooser")).click();
TestUtils.sleepIgnoreInterrupt(2000);
$(By.id("lang-chooser")).$$(ByUtils.customAttribute("data-value", "en")).filter(Condition.visible).get(0).click();
TestUtils.sleepIgnoreInterrupt(2000);
}
// test if multi accounts table is shown ( https://accounts.google.com/accountchooser )
SelenideElement loginView = $(By.id("initialView"));
if (loginView.text().contains("Choose an account")) {
log.info("More Google accounts are available. Choosing the correct one:" + account.getProperty("email"));
try {
loginView.$(ByUtils.customAttribute("data-email", account.getProperty("email"))).should(Condition.exist).click();
} catch (ElementNotFound ex) {
log.warn("That account is not in the Google multi-accounts table. It needs to fill in the credentials.");
// use another account button
loginView.$$(ByUtils.hasEqualText("div", "Use another account")).filter(visible).last().click();
fillAndValidateGoogleAccount(account);
}
} else {
fillAndValidateGoogleAccount(account);
}
TestUtils.sleepIgnoreInterrupt(5000L);
}
use of io.syndesis.qe.account.Account in project syndesis-qe by syndesisio.
the class TodoSteps method setCredentials.
@Given("^Set Todo app credentials$")
public void setCredentials() {
Account todoAppAccount = new Account();
todoAppAccount.setService("todo");
Map<String, String> accountParameters = new HashMap<>();
accountParameters.put("username", "test");
accountParameters.put("password", "test");
todoAppAccount.setProperties(accountParameters);
AccountsDirectory.getInstance().addAccount("todo", todoAppAccount);
}
use of io.syndesis.qe.account.Account in project syndesis-qe by syndesisio.
the class ApiClientConnectorsSteps method setPetstoreCredentials.
@When("^set swagger petstore credentials")
public void setPetstoreCredentials() {
Account petStoreAccount = new Account();
petStoreAccount.setService("Swagger Petstore");
Map<String, String> accountParameters = new HashMap<>();
accountParameters.put("authenticationparametervalue", "special-key");
petStoreAccount.setProperties(accountParameters);
AccountsDirectory.getInstance().addAccount("Swagger Petstore Account", petStoreAccount);
}
Aggregations