]> source.dussan.org Git - sonarqube.git/commitdiff
add ITs for Project Code Page
authorStas Vilchik <vilchiks@gmail.com>
Mon, 28 Dec 2015 10:35:39 +0000 (11:35 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 28 Dec 2015 10:35:39 +0000 (11:35 +0100)
it/it-tests/src/test/java/it/Category1Suite.java
it/it-tests/src/test/java/it/projectServices/ProjectCodeTest.java [new file with mode: 0644]
it/it-tests/src/test/resources/projectServices/ProjectCodeTest/test_project_code_page.html [new file with mode: 0644]

index 2bcf718ffa980e039ef0958120c5a1890e659e40..b1af8a9d62bfb6adcf88f4c3161a3768559d96d5 100644 (file)
@@ -55,6 +55,7 @@ import it.measureHistory.TimeMachineTest;
 import it.projectAdministration.BackgroundTasksTest;
 import it.projectAdministration.BulkDeletionTest;
 import it.projectAdministration.ProjectAdministrationTest;
+import it.projectServices.ProjectCodeTest;
 import it.projectOverview.ProjectOverviewTest;
 import it.qualityGate.QualityGateNotificationTest;
 import it.qualityGate.QualityGateTest;
@@ -80,6 +81,7 @@ import static util.ItUtils.xooPlugin;
   BackgroundTasksTest.class,
   // project pages
   ProjectOverviewTest.class,
+  ProjectCodeTest.class,
   // settings
   PropertySetsTest.class,
   SubCategoriesTest.class,
diff --git a/it/it-tests/src/test/java/it/projectServices/ProjectCodeTest.java b/it/it-tests/src/test/java/it/projectServices/ProjectCodeTest.java
new file mode 100644 (file)
index 0000000..e1d84cc
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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.projectServices;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.selenium.Selenese;
+import it.Category1Suite;
+import org.junit.ClassRule;
+import org.junit.Test;
+import util.selenium.SeleneseTest;
+
+import static util.ItUtils.projectDir;
+
+public class ProjectCodeTest {
+
+  @ClassRule
+  public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
+
+  @Test
+  public void test_project_code_page() throws Exception {
+    executeBuild("shared/xoo-sample", "project-for-code", "Project For Code");
+
+    Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("test_project_code_page",
+      "/projectServices/ProjectCodeTest/test_project_code_page.html"
+    ).build();
+    new SeleneseTest(selenese).runOn(orchestrator);
+  }
+
+  private void executeBuild(String projectLocation, String projectKey, String projectName) {
+    orchestrator.executeBuild(
+      SonarRunner.create(projectDir(projectLocation))
+        .setProjectKey(projectKey)
+        .setProjectName(projectName)
+    );
+  }
+
+}
diff --git a/it/it-tests/src/test/resources/projectServices/ProjectCodeTest/test_project_code_page.html b/it/it-tests/src/test/resources/projectServices/ProjectCodeTest/test_project_code_page.html
new file mode 100644 (file)
index 0000000..f4844a2
--- /dev/null
@@ -0,0 +1,65 @@
+<?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>test_project_code_page</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+  <thead>
+  <tr>
+    <td rowspan="1" colspan="3">test_project_code_page</td>
+  </tr>
+  </thead>
+  <tbody>
+  <tr>
+       <td>open</td>
+       <td>/sonar/code?id=project-for-code</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForText</td>
+       <td>css=#content</td>
+       <td>*Project For Code*13*0*0*0.0%*</td>
+</tr>
+<tr>
+       <td>waitForText</td>
+       <td>css=#content</td>
+       <td>*src/main/xoo/sample*</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>css=.code-name-cell a</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForText</td>
+       <td>css=#content</td>
+       <td>*Sample.xoo*</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>css=.code-breadcrumbs a</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForNotText</td>
+       <td>css=#content</td>
+       <td>*Sample.xoo*</td>
+</tr>
+<tr>
+       <td>type</td>
+       <td>css=.search-box-input</td>
+       <td>Sam</td>
+</tr>
+<tr>
+       <td>waitForText</td>
+       <td>css=#content</td>
+       <td>*Sample.xoo*</td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>