aboutsummaryrefslogtreecommitdiffstats
path: root/it
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2016-07-24 21:02:55 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2016-07-24 21:02:55 +0200
commite0c1fda2f1c25af93ee1a73f44f3552616c63e23 (patch)
tree8ba768a43533605fba853d981c184935fee25f89 /it
parent15e60eb2838947759fa35622a8a00e35cc2fccd6 (diff)
downloadsonarqube-e0c1fda2f1c25af93ee1a73f44f3552616c63e23.tar.gz
sonarqube-e0c1fda2f1c25af93ee1a73f44f3552616c63e23.zip
Improve Selenium test of BaseIdentityProviderTest
Diffstat (limited to 'it')
-rw-r--r--it/it-tests/src/test/java/it/user/BaseIdentityProviderTest.java17
-rw-r--r--it/it-tests/src/test/resources/user/BaseIdentityProviderTest/authenticate_user.html55
2 files changed, 34 insertions, 38 deletions
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 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>fail_to_authenticate_when_not_allowed_to_sign_up</title>
-</head>
+
<body>
<table cellpadding="1" cellspacing="1" border="1">
- <thead>
<tr>
- <td>open</td>
- <td>/sessions/new</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>content</td>
- <td>*Log in with Fake base identity provider*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=.oauth-providers a</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForVisible</td>
- <td>dashboard</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>id=global-navigation</td>
- <td>*John*</td>
-</tr>
-</tbody>
+ <td>open</td>
+ <td>/sessions/new</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>content</td>
+ <td>*Log in with Fake base identity provider*</td>
+ </tr>
+ <tr>
+ <td>click</td>
+ <td>css=.oauth-providers a</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForVisible</td>
+ <td>dashboard</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>id=global-navigation</td>
+ <td>*John*</td>
+ </tr>
</table>
</body>
</html>