use of io.syndesis.qe.pages.login.KeyCloakLogin in project syndesis-qe by syndesisio.
the class CommonSteps method doLogin.
/**
* If you want to log in for the first time (browser is not opened) set afterLogout = false
* If you want to log in again e.g. after logout (browser is already opened) set afterLogout = true
*
* @param afterLogout flag to indicate that browser is already open
*/
private void doLogin(boolean afterLogout) {
if (!afterLogout) {
Selenide.open(TestConfiguration.syndesisUrl());
}
if ("firefox".equalsIgnoreCase(TestConfiguration.syndesisBrowser())) {
WebDriverRunner.getWebDriver().manage().window().setSize(new Dimension(1920, 1080));
}
String currentUrl = WebDriverRunner.getWebDriver().getCurrentUrl();
if (currentUrl.contains(".openshift.com")) {
// click only if there is Ignite cluster login page
SelenideElement login = $(By.className("login-redhat"));
if (login.isDisplayed()) {
login.click();
}
RHDevLogin rhDevLogin = new RHDevLogin();
rhDevLogin.login(TestConfiguration.syndesisUsername(), TestConfiguration.syndesisPassword());
} else if (currentUrl.contains(":8443/login")) {
log.info("Minishift cluster login page");
MinishiftLogin minishiftLogin = new MinishiftLogin();
minishiftLogin.login(TestConfiguration.syndesisUsername(), TestConfiguration.syndesisPassword());
} else if (currentUrl.contains("github.com/login")) {
GitHubLogin gitHubLogin = new GitHubLogin();
gitHubLogin.login(TestConfiguration.syndesisUsername(), TestConfiguration.syndesisPassword());
} else if (currentUrl.contains("osd4") && currentUrl.contains("oauth/authorize")) {
$(By.partialLinkText(TestConfiguration.keyCloakIdpName())).click();
KeyCloakLogin kcLogin = new KeyCloakLogin();
kcLogin.login(TestConfiguration.syndesisUsername(), TestConfiguration.syndesisPassword());
} else if (currentUrl.contains("oauth/authorize")) {
String linkText = "htpasswd";
if (currentUrl.contains("osp")) {
linkText = "HTPasswd";
}
$(By.partialLinkText(linkText)).click();
MinishiftLogin minishiftLogin = new MinishiftLogin();
minishiftLogin.login(TestConfiguration.syndesisUsername(), TestConfiguration.syndesisPassword());
}
currentUrl = WebDriverRunner.getWebDriver().getCurrentUrl();
if (currentUrl.contains("oauth/authorize/approve")) {
log.info("Authorize access login page");
$("input[name=\"approve\"]").shouldBe(visible).click();
}
}
Aggregations