diff options
Diffstat (limited to 'it/it-tests/src')
9 files changed, 81 insertions, 84 deletions
diff --git a/it/it-tests/src/test/java/it/user/MyAccountPageTest.java b/it/it-tests/src/test/java/it/user/MyAccountPageTest.java index 8f7b479d8ee..63c11f9549d 100644 --- a/it/it-tests/src/test/java/it/user/MyAccountPageTest.java +++ b/it/it-tests/src/test/java/it/user/MyAccountPageTest.java @@ -27,11 +27,17 @@ import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; import org.junit.ClassRule; +import org.junit.Rule; import org.junit.Test; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; +import pageobjects.MyActivityPage; +import pageobjects.Navigation; import util.selenium.SeleneseTest; +import static com.codeborne.selenide.Condition.visible; +import static com.codeborne.selenide.WebDriverRunner.url; +import static org.assertj.core.api.Assertions.assertThat; import static util.ItUtils.newAdminWsClient; import static util.ItUtils.projectDir; @@ -41,6 +47,9 @@ public class MyAccountPageTest { public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR; private static WsClient adminWsClient; + @Rule + public Navigation nav = Navigation.get(orchestrator); + @BeforeClass public static void setUp() { orchestrator.resetData(); @@ -58,6 +67,20 @@ public class MyAccountPageTest { } @Test + public void should_open_by_default() { + nav.logIn().asAdmin().openHomepage(); + assertThat(url()).contains("/account"); + } + + @Test + public void should_display_activity () { + MyActivityPage page = nav.logIn().asAdmin().openMyActivity(); + page.getAllIssues().shouldBe(visible); + page.getRecentIssues().shouldBe(visible); + page.assertNoFavoriteProjects(); + } + + @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" @@ -74,14 +97,6 @@ public class MyAccountPageTest { } @Test - public void should_display_issues() throws Exception { - Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("should_display_issues", - "/user/MyAccountPageTest/should_display_issues.html" - ).build(); - new SeleneseTest(selenese).runOn(orchestrator); - } - - @Test public void should_display_projects() throws Exception { // first, try on empty instance Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("should_display_projects", diff --git a/it/it-tests/src/test/java/pageobjects/MyActivityPage.java b/it/it-tests/src/test/java/pageobjects/MyActivityPage.java new file mode 100644 index 00000000000..8bcb376a85b --- /dev/null +++ b/it/it-tests/src/test/java/pageobjects/MyActivityPage.java @@ -0,0 +1,48 @@ +/* + * 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 pageobjects; + +import com.codeborne.selenide.SelenideElement; + +import static com.codeborne.selenide.Condition.visible; +import static com.codeborne.selenide.Selenide.$; + +public class MyActivityPage { + + public MyActivityPage() { + $("#my-activity-page").shouldBe(visible); + } + + public SelenideElement getRecentIssues() { + return $("#recent-issues"); + } + + public SelenideElement getAllIssues() { + return $("#all-issues"); + } + + public SelenideElement getFavoriteProjects() { + return $("#favorite-projects"); + } + + public void assertNoFavoriteProjects() { + $("#no-favorite-projects").shouldBe(visible); + } +} diff --git a/it/it-tests/src/test/java/pageobjects/Navigation.java b/it/it-tests/src/test/java/pageobjects/Navigation.java index 071df520c6e..8342474a417 100644 --- a/it/it-tests/src/test/java/pageobjects/Navigation.java +++ b/it/it-tests/src/test/java/pageobjects/Navigation.java @@ -108,6 +108,10 @@ public class Navigation extends ExternalResource { return open("/settings/server_id", ServerIdPage.class); } + public MyActivityPage openMyActivity() { + return open("/account", MyActivityPage.class); + } + public void open(String relativeUrl) { Selenide.open(relativeUrl); } diff --git a/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/external-user-details.html b/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/external-user-details.html index 60751a0adef..f073c8718fb 100644 --- a/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/external-user-details.html +++ b/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/external-user-details.html @@ -40,7 +40,7 @@ </tr> <tr> <td>open</td> - <td>/account/index</td> + <td>/account/profile</td> <td></td> </tr> <tr> diff --git a/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/external-user-details2.html b/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/external-user-details2.html index a245110f624..ca5bd80f9c9 100644 --- a/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/external-user-details2.html +++ b/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/external-user-details2.html @@ -40,7 +40,7 @@ </tr> <tr> <td>open</td> - <td>/account/index</td> + <td>/account/profile</td> <td></td> </tr> <tr> diff --git a/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_issues.html b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_issues.html deleted file mode 100644 index ab2e1c438f3..00000000000 --- a/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_issues.html +++ /dev/null @@ -1,55 +0,0 @@ -<?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_issues</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> - <thead> - <tr> - <td rowspan="1" colspan="3">should_display_issues</td> - </tr> - </thead> - <tbody> - <tr> - <td>open</td> - <td>/sonar/sessions/login</td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>id=login</td> - <td>account-user</td> -</tr> -<tr> - <td>type</td> - <td>id=password</td> - <td>password</td> -</tr> -<tr> - <td>clickAndWait</td> - <td>commit</td> - <td></td> -</tr> -<tr> - <td>waitForElementPresent</td> - <td>css=.js-user-authenticated</td> - <td></td> -</tr> -<tr> - <td>open</td> - <td>/sonar/account/issues</td> - <td></td> -</tr> -<tr> - <td>waitForElementPresent</td> - <td>css=[data-unresolved]</td> - <td></td> -</tr> -</tbody> -</table> -</body> -</html> diff --git a/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_no_projects.html b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_no_projects.html index 4060bf595a6..31d0dbb7197 100644 --- a/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_no_projects.html +++ b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_no_projects.html @@ -41,12 +41,12 @@ </tr> <tr> <td>open</td> - <td>/account/projects</td> + <td>/account/projects/</td> <td></td> </tr> <tr> <td>waitForElementPresent</td> - <td>css=.account-projects</td> + <td>css=#account-projects</td> <td></td> </tr> <tr> diff --git a/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_projects.html b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_projects.html index 5f580876c51..b4e9b0f9e1e 100644 --- a/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_projects.html +++ b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_projects.html @@ -41,7 +41,7 @@ </tr> <tr> <td>open</td> - <td>/account/projects</td> + <td>/account/projects/</td> <td></td> </tr> <tr> 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 index 1036819238c..71efda227c6 100644 --- 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 @@ -41,7 +41,7 @@ </tr> <tr> <td>open</td> - <td>/sonar/account/</td> + <td>/sonar/account/profile/</td> <td></td> </tr> <tr> @@ -99,21 +99,6 @@ <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> |