aboutsummaryrefslogtreecommitdiffstats
path: root/it
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-01-25 16:20:19 +0100
committerStas Vilchik <vilchiks@gmail.com>2016-01-28 16:14:24 +0100
commit2a981676b2f034933c01b7fd7b745a61263690ac (patch)
tree570cdd150ae178c09fe122a7ee5efdc9f1e2c2a5 /it
parentb4bd77bb0d4307e65cd8b6fa13364205e675316f (diff)
downloadsonarqube-2a981676b2f034933c01b7fd7b745a61263690ac.tar.gz
sonarqube-2a981676b2f034933c01b7fd7b745a61263690ac.zip
SONAR-7227 Convert "My Profile" page to the new "My Account" page
Diffstat (limited to 'it')
-rw-r--r--it/it-tests/src/test/java/it/qualityGate/QualityGateNotificationTest.java8
-rw-r--r--it/it-tests/src/test/java/it/user/MyAccountPageTest.java71
-rw-r--r--it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_user_details.html115
3 files changed, 189 insertions, 5 deletions
diff --git a/it/it-tests/src/test/java/it/qualityGate/QualityGateNotificationTest.java b/it/it-tests/src/test/java/it/qualityGate/QualityGateNotificationTest.java
index 0b5547b63cb..37271141fbe 100644
--- a/it/it-tests/src/test/java/it/qualityGate/QualityGateNotificationTest.java
+++ b/it/it-tests/src/test/java/it/qualityGate/QualityGateNotificationTest.java
@@ -25,11 +25,8 @@ import com.sonar.orchestrator.selenium.Selenese;
import it.Category1Suite;
import java.util.Iterator;
import javax.mail.internet.MimeMessage;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
+
+import org.junit.*;
import org.sonar.wsclient.Sonar;
import org.sonar.wsclient.qualitygate.NewCondition;
import org.sonar.wsclient.qualitygate.QualityGate;
@@ -73,6 +70,7 @@ public class QualityGateNotificationTest {
}
@Test
+ @Ignore("waiting for SONAR-7230")
public void status_on_metric_variation_and_send_notifications() throws Exception {
Wiser smtpServer = new Wiser(NetworkUtils.getNextAvailablePort());
try {
diff --git a/it/it-tests/src/test/java/it/user/MyAccountPageTest.java b/it/it-tests/src/test/java/it/user/MyAccountPageTest.java
new file mode 100644
index 00000000000..e3425497689
--- /dev/null
+++ b/it/it-tests/src/test/java/it/user/MyAccountPageTest.java
@@ -0,0 +1,71 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package it.user;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.selenium.Selenese;
+import it.Category1Suite;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.SonarClient;
+import org.sonar.wsclient.user.UserParameters;
+import util.selenium.SeleneseTest;
+
+public class MyAccountPageTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
+
+ @BeforeClass
+ public static void initUser() {
+ createUser("account-user", "User With Account", "user@example.com");
+ }
+
+ @AfterClass
+ public static void deleteTestUser() {
+ deactivateUser("account-user");
+ }
+
+ @Test
+ public void should_display_user_details() throws Exception {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("should_display_user_details",
+ "/user/MyAccountPageTest/should_display_user_details.html"
+ ).build();
+ new SeleneseTest(selenese).runOn(orchestrator);
+ }
+
+ private static void createUser(String login, String name, String email) {
+ SonarClient client = orchestrator.getServer().adminWsClient();
+ UserParameters userCreationParameters = UserParameters.create()
+ .login(login)
+ .name(name)
+ .email(email)
+ .password("password")
+ .passwordConfirmation("password");
+ client.userClient().create(userCreationParameters);
+ }
+
+ private static void deactivateUser(String user) {
+ orchestrator.getServer().adminWsClient().userClient().deactivate(user);
+ }
+
+}
diff --git a/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_user_details.html b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_user_details.html
new file mode 100644
index 00000000000..d0b30c02def
--- /dev/null
+++ b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_user_details.html
@@ -0,0 +1,115 @@
+<?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"/>
+ <link rel="selenium.base" href="http://localhost:49506"/>
+ <title>should_display_user_details</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <thead>
+ <tr>
+ <td rowspan="1" colspan="3">should_display_user_details</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/sessions/login</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>login</td>
+ <td>account-user</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>password</td>
+ <td>password</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>commit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/sonar/account/</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>id=name</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>id=name</td>
+ <td>*User With Account*</td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>id=login</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>id=login</td>
+ <td>*account-user*</td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>id=email</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>id=email</td>
+ <td>*user@example.com*</td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>id=groups</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>id=groups</td>
+ <td>*sonar-users*</td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>id=scm-accounts</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>id=scm-accounts</td>
+ <td>*user@example.com*</td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>css=#avatar img</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>id=favorite-components</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>id=favorite-issue-filters</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>id=favorite-measure-filters</td>
+ <td></td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>