aboutsummaryrefslogtreecommitdiffstats
path: root/it
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-08-12 15:25:29 +0200
committerGitHub <noreply@github.com>2016-08-12 15:25:29 +0200
commit531135e491d9cdd11d5b687881945cf88f3ddaae (patch)
tree364bef099656095d01a54849a735c0272ea282e3 /it
parent105831419ee487a9d1ab1f8a9338d275e5be82fd (diff)
downloadsonarqube-531135e491d9cdd11d5b687881945cf88f3ddaae.tar.gz
sonarqube-531135e491d9cdd11d5b687881945cf88f3ddaae.zip
SONAR-7962 Move "Size" section to the sidebar (#1142)
Diffstat (limited to 'it')
-rw-r--r--it/it-tests/src/test/java/it/Category1Suite.java4
-rw-r--r--it/it-tests/src/test/java/it/measure/ProjectDashboardTest.java (renamed from it/it-tests/src/test/java/it/measure/ProjectOverviewTest.java)21
-rw-r--r--it/it-tests/src/test/java/pageobjects/Navigation.java6
-rw-r--r--it/it-tests/src/test/java/pageobjects/ProjectDashboardPage.java44
-rw-r--r--it/it-tests/src/test/resources/measure/ProjectDashboardTest/test_project_overview_after_first_analysis.html (renamed from it/it-tests/src/test/resources/measure/ProjectOverviewTest/test_project_overview_after_first_analysis.html)6
5 files changed, 69 insertions, 12 deletions
diff --git a/it/it-tests/src/test/java/it/Category1Suite.java b/it/it-tests/src/test/java/it/Category1Suite.java
index b613cc3ec2b..18f2c01a352 100644
--- a/it/it-tests/src/test/java/it/Category1Suite.java
+++ b/it/it-tests/src/test/java/it/Category1Suite.java
@@ -32,7 +32,7 @@ import it.customMeasure.CustomMeasuresTest;
import it.i18n.I18nTest;
import it.measure.MeasuresWsTest;
import it.measure.ProjectMeasuresPageTest;
-import it.measure.ProjectOverviewTest;
+import it.measure.ProjectDashboardTest;
import it.measure.ProjectWidgetsTest;
import it.measureFilter.MeasureFiltersTest;
import it.measureHistory.DifferentialPeriodsTest;
@@ -91,7 +91,7 @@ import static util.ItUtils.xooPlugin;
CustomMeasuresTest.class,
// measure
ProjectMeasuresPageTest.class,
- ProjectOverviewTest.class,
+ ProjectDashboardTest.class,
ProjectWidgetsTest.class,
MeasureFiltersTest.class,
MeasuresWsTest.class,
diff --git a/it/it-tests/src/test/java/it/measure/ProjectOverviewTest.java b/it/it-tests/src/test/java/it/measure/ProjectDashboardTest.java
index 96f27688ea1..eef29acaf0b 100644
--- a/it/it-tests/src/test/java/it/measure/ProjectOverviewTest.java
+++ b/it/it-tests/src/test/java/it/measure/ProjectDashboardTest.java
@@ -27,12 +27,14 @@ import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import pageobjects.Navigation;
+import pageobjects.ProjectDashboardPage;
import util.selenium.SeleneseTest;
+import static com.codeborne.selenide.Condition.hasText;
import static com.codeborne.selenide.Condition.text;
import static util.ItUtils.projectDir;
-public class ProjectOverviewTest {
+public class ProjectDashboardTest {
@ClassRule
public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
@@ -43,16 +45,27 @@ public class ProjectOverviewTest {
}
@Test
- public void test_project_overview_after_first_analysis() throws Exception {
+ public void after_first_analysis() throws Exception {
executeBuild("shared/xoo-sample", "project-for-overview", "Project For Overview");
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("test_project_overview_after_first_analysis",
- "/measure/ProjectOverviewTest/test_project_overview_after_first_analysis.html"
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("after_first_analysis",
+ "/measure/ProjectDashboardTest/test_project_overview_after_first_analysis.html"
).build();
new SeleneseTest(selenese).runOn(orchestrator);
}
@Test
+ public void display_size() {
+ executeBuild("shared/xoo-sample", "sample", "Sample");
+
+ Navigation nav = Navigation.get(orchestrator);
+ ProjectDashboardPage page = nav.openProjectDashboard("sample");
+
+ page.getLinesOfCode().should(hasText("13"));
+ page.getLanguageDistribution().should(hasText("Xoo"), hasText("13"));
+ }
+
+ @Test
public void display_a_nice_error_when_requesting_unknown_project() {
Navigation nav = Navigation.get(orchestrator);
nav.open("/dashboard/index?id=unknown");
diff --git a/it/it-tests/src/test/java/pageobjects/Navigation.java b/it/it-tests/src/test/java/pageobjects/Navigation.java
index a4b3f9af62d..3dbde027d3b 100644
--- a/it/it-tests/src/test/java/pageobjects/Navigation.java
+++ b/it/it-tests/src/test/java/pageobjects/Navigation.java
@@ -50,6 +50,12 @@ public class Navigation extends ExternalResource {
return open("/", Navigation.class);
}
+ public ProjectDashboardPage openProjectDashboard(String projectKey) {
+ // TODO encode projectKey
+ String url = "/dashboard?id=" + projectKey;
+ return open(url, ProjectDashboardPage.class);
+ }
+
public ProjectLinksPage openProjectLinks(String projectKey) {
// TODO encode projectKey
String url = "/project/links?id=" + projectKey;
diff --git a/it/it-tests/src/test/java/pageobjects/ProjectDashboardPage.java b/it/it-tests/src/test/java/pageobjects/ProjectDashboardPage.java
new file mode 100644
index 00000000000..4064f61a00b
--- /dev/null
+++ b/it/it-tests/src/test/java/pageobjects/ProjectDashboardPage.java
@@ -0,0 +1,44 @@
+/*
+ * 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 ProjectDashboardPage {
+
+ public ProjectDashboardPage() {
+ $(".overview").shouldBe(visible);
+ }
+
+ public SelenideElement getLinesOfCode() {
+ SelenideElement element = $("#overview-ncloc");
+ element.shouldBe(visible);
+ return element;
+ }
+
+ public SelenideElement getLanguageDistribution() {
+ SelenideElement element = $("#overview-language-distribution");
+ element.shouldBe(visible);
+ return element;
+ }
+}
diff --git a/it/it-tests/src/test/resources/measure/ProjectOverviewTest/test_project_overview_after_first_analysis.html b/it/it-tests/src/test/resources/measure/ProjectDashboardTest/test_project_overview_after_first_analysis.html
index 5c91afb2ac5..ac440b184aa 100644
--- a/it/it-tests/src/test/resources/measure/ProjectOverviewTest/test_project_overview_after_first_analysis.html
+++ b/it/it-tests/src/test/resources/measure/ProjectDashboardTest/test_project_overview_after_first_analysis.html
@@ -35,11 +35,6 @@
<td>*0.0%*Duplications*0*Duplicated Blocks*</td>
</tr>
<tr>
- <td>waitForText</td>
- <td>id=content</td>
- <td>*13*Lines of Code*</td>
- </tr>
- <tr>
<td>assertNotText</td>
<td>id=content</td>
<td>*Coverage*</td>
@@ -54,7 +49,6 @@
<td>id=content</td>
<td>*Quality Profiles*Xoo*Basic*</td>
</tr>
-
</tbody>
</table>
</body>