From e0c1fda2f1c25af93ee1a73f44f3552616c63e23 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Sun, 24 Jul 2016 21:02:55 +0200 Subject: Improve Selenium test of BaseIdentityProviderTest --- .../java/it/user/BaseIdentityProviderTest.java | 17 +++---- .../authenticate_user.html | 55 ++++++++++------------ 2 files changed, 34 insertions(+), 38 deletions(-) (limited to 'it') diff --git a/it/it-tests/src/test/java/it/user/BaseIdentityProviderTest.java b/it/it-tests/src/test/java/it/user/BaseIdentityProviderTest.java index 6c55928fd1f..2890fc95d97 100644 --- a/it/it-tests/src/test/java/it/user/BaseIdentityProviderTest.java +++ b/it/it-tests/src/test/java/it/user/BaseIdentityProviderTest.java @@ -33,6 +33,7 @@ import org.junit.Test; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.WsResponse; +import util.selenium.SeleneseTest; import util.user.UserRule; import util.user.Users; @@ -105,9 +106,9 @@ public class BaseIdentityProviderTest { enablePlugin(); setUserCreatedByAuthPlugin(USER_LOGIN, USER_PROVIDER_ID, USER_NAME, USER_EMAIL); - ORCHESTRATOR.executeSelenese(Selenese.builder().setHtmlTestsInClasspath("authenticate_through_ui", + new SeleneseTest(Selenese.builder().setHtmlTestsInClasspath("authenticate_through_ui", "/user/BaseIdentityProviderTest/authenticate_user.html" - ).build()); + ).build()).runOn(ORCHESTRATOR); userRule.verifyUserExists(USER_LOGIN, USER_NAME, USER_EMAIL); } @@ -118,9 +119,9 @@ public class BaseIdentityProviderTest { // As this property is null, the plugin will throw an exception setServerProperty(ORCHESTRATOR, "sonar.auth.fake-base-id-provider.user", null); - ORCHESTRATOR.executeSelenese(Selenese.builder().setHtmlTestsInClasspath("display_unauthorized_page_when_authentication_failed", + new SeleneseTest(Selenese.builder().setHtmlTestsInClasspath("display_unauthorized_page_when_authentication_failed", "/user/BaseIdentityProviderTest/display_unauthorized_page_when_authentication_failed.html" - ).build()); + ).build()).runOn(ORCHESTRATOR); userRule.verifyUserDoesNotExist(USER_LOGIN); } @@ -131,9 +132,9 @@ public class BaseIdentityProviderTest { setUserCreatedByAuthPlugin(USER_LOGIN, USER_PROVIDER_ID, USER_NAME, USER_EMAIL); setServerProperty(ORCHESTRATOR, "sonar.auth.fake-base-id-provider.allowsUsersToSignUp", "false"); - ORCHESTRATOR.executeSelenese(Selenese.builder().setHtmlTestsInClasspath("fail_to_authenticate_when_not_allowed_to_sign_up", + new SeleneseTest(Selenese.builder().setHtmlTestsInClasspath("fail_to_authenticate_when_not_allowed_to_sign_up", "/user/BaseIdentityProviderTest/fail_to_authenticate_when_not_allowed_to_sign_up.html" - ).build()); + ).build()).runOn(ORCHESTRATOR); userRule.verifyUserDoesNotExist(USER_LOGIN); } @@ -194,9 +195,9 @@ public class BaseIdentityProviderTest { setUserCreatedByAuthPlugin(USER_LOGIN, USER_PROVIDER_ID, USER_NAME, USER_EMAIL); setServerProperty(ORCHESTRATOR, "sonar.auth.fake-base-id-provider.throwUnauthorizedMessage", "true"); - ORCHESTRATOR.executeSelenese(Selenese.builder().setHtmlTestsInClasspath("fail_to_authenticate_when_not_allowed_to_sign_up", + new SeleneseTest(Selenese.builder().setHtmlTestsInClasspath("fail_to_authenticate_when_not_allowed_to_sign_up", "/user/BaseIdentityProviderTest/fail_to_authenticate_when_not_allowed_to_sign_up.html" - ).build()); + ).build()).runOn(ORCHESTRATOR); File logFile = ORCHESTRATOR.getServer().getLogs(); assertThat(FileUtils.readFileToString(logFile)).doesNotContain("A functional error has happened"); diff --git a/it/it-tests/src/test/resources/user/BaseIdentityProviderTest/authenticate_user.html b/it/it-tests/src/test/resources/user/BaseIdentityProviderTest/authenticate_user.html index 7022fb95b08..8137f88d32d 100644 --- a/it/it-tests/src/test/resources/user/BaseIdentityProviderTest/authenticate_user.html +++ b/it/it-tests/src/test/resources/user/BaseIdentityProviderTest/authenticate_user.html @@ -1,39 +1,34 @@ - - - fail_to_authenticate_when_not_allowed_to_sign_up - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +
open/sessions/new
waitForTextcontent*Log in with Fake base identity provider*
clickcss=.oauth-providers a
waitForVisibledashboard
waitForTextid=global-navigation*John*
open/sessions/new
waitForTextcontent*Log in with Fake base identity provider*
clickcss=.oauth-providers a
waitForVisibledashboard
waitForTextid=global-navigation*John*
-- cgit v1.2.3