Reintrodce creating admin from welcome page as removing it breaks tests

This commit is contained in:
Stian Thorgersen 2016-01-14 13:46:13 +01:00
parent 73e23cf235
commit 15103aad81
2 changed files with 23 additions and 0 deletions

View file

@ -10,14 +10,24 @@ import static org.keycloak.testsuite.util.MailServerConfiguration.*;
*/
public final class SuiteContext {
private boolean adminPasswordUpdated;
private final Map<String, String> smtpServer = new HashMap<>();
public SuiteContext() {
this.adminPasswordUpdated = false;
smtpServer.put("from", FROM);
smtpServer.put("host", HOST);
smtpServer.put("port", PORT);
}
public boolean isAdminPasswordUpdated() {
return adminPasswordUpdated;
}
public void setAdminPasswordUpdated(boolean adminPasswordUpdated) {
this.adminPasswordUpdated = adminPasswordUpdated;
}
public Map<String, String> getSmtpServer() {
return smtpServer;
}

View file

@ -89,6 +89,12 @@ public abstract class AbstractKeycloakTest {
driverSettings();
if (!suiteContext.isAdminPasswordUpdated()) {
log.debug("updating admin password");
updateMasterAdminPassword();
suiteContext.setAdminPasswordUpdated(true);
}
importTestRealms();
}
@ -99,6 +105,13 @@ public abstract class AbstractKeycloakTest {
Timer.printStats();
}
private void updateMasterAdminPassword() {
welcomePage.navigateTo();
if (!welcomePage.isPasswordSet()) {
welcomePage.setPassword("admin", "admin");
}
}
public void deleteAllCookiesForMasterRealm() {
masterRealmPage.navigateTo();
log.debug("deleting cookies in master realm");