]> source.dussan.org Git - sonarqube.git/commitdiff
hide number of failing tasks on then project level page
authorStas Vilchik <vilchiks@gmail.com>
Wed, 9 Dec 2015 16:25:52 +0000 (17:25 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 9 Dec 2015 16:25:59 +0000 (17:25 +0100)
it/it-tests/src/test/java/it/Category1Suite.java
it/it-tests/src/test/java/it/projectAdministration/BackgroundTasksTest.java [new file with mode: 0644]
it/it-tests/src/test/resources/projectAdministration/BackgroundTasksTest/should_not_display_failing_and_search_and_filter_elements_on_project_level_page.html [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/main.js
server/sonar-web/src/main/js/apps/background-tasks/stats.js

index 97489650fccc8ea5ca254b4c451590e641ce744c..2bcf718ffa980e039ef0958120c5a1890e659e40 100644 (file)
@@ -52,6 +52,7 @@ import it.measureHistory.HistoryUiTest;
 import it.measureHistory.SincePreviousVersionHistoryTest;
 import it.measureHistory.SinceXDaysHistoryTest;
 import it.measureHistory.TimeMachineTest;
+import it.projectAdministration.BackgroundTasksTest;
 import it.projectAdministration.BulkDeletionTest;
 import it.projectAdministration.ProjectAdministrationTest;
 import it.projectOverview.ProjectOverviewTest;
@@ -76,6 +77,7 @@ import static util.ItUtils.xooPlugin;
   // project administration
   BulkDeletionTest.class,
   ProjectAdministrationTest.class,
+  BackgroundTasksTest.class,
   // project pages
   ProjectOverviewTest.class,
   // settings
diff --git a/it/it-tests/src/test/java/it/projectAdministration/BackgroundTasksTest.java b/it/it-tests/src/test/java/it/projectAdministration/BackgroundTasksTest.java
new file mode 100644 (file)
index 0000000..93b9240
--- /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.projectAdministration;
+
+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 BackgroundTasksTest {
+
+  @ClassRule
+  public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR;
+
+  @Test
+  public void should_not_display_failing_and_search_and_filter_elements_on_project_level_page() throws Exception {
+    executeBuild("test-project", "Test Project");
+    executeBuild("test-project-2", "Another Test Project");
+
+    Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("should_not_display_failing_and_search_and_filter_elements_on_project_level_page",
+      "/projectAdministration/BackgroundTasksTest/should_not_display_failing_and_search_and_filter_elements_on_project_level_page.html"
+    ).build();
+    new SeleneseTest(selenese).runOn(orchestrator);
+  }
+
+  private void executeBuild(String projectKey, String projectName) {
+    orchestrator.executeBuild(
+      SonarRunner.create(projectDir("shared/xoo-sample"))
+        .setProjectKey(projectKey)
+        .setProjectName(projectName)
+    );
+  }
+}
diff --git a/it/it-tests/src/test/resources/projectAdministration/BackgroundTasksTest/should_not_display_failing_and_search_and_filter_elements_on_project_level_page.html b/it/it-tests/src/test/resources/projectAdministration/BackgroundTasksTest/should_not_display_failing_and_search_and_filter_elements_on_project_level_page.html
new file mode 100644 (file)
index 0000000..06f59df
--- /dev/null
@@ -0,0 +1,75 @@
+<?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_not_display_failing_and_search_and_filter_elements_on_project_level_page</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+  <thead>
+  <tr>
+    <td rowspan="1" colspan="3">should_not_display_failing_and_search_and_filter_elements_on_project_level_page</td>
+  </tr>
+  </thead>
+  <tbody>
+  <tr>
+       <td>open</td>
+       <td>/sonar/sessions/logout</td>
+       <td></td>
+</tr>
+<tr>
+       <td>open</td>
+       <td>/sonar/sessions/login</td>
+       <td></td>
+</tr>
+<tr>
+       <td>type</td>
+       <td>login</td>
+       <td>admin</td>
+</tr>
+<tr>
+       <td>type</td>
+       <td>password</td>
+       <td>admin</td>
+</tr>
+<tr>
+       <td>clickAndWait</td>
+       <td>commit</td>
+       <td></td>
+</tr>
+<tr>
+       <td>open</td>
+       <td>/sonar/project/background_tasks?id=test-project</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForElementPresent</td>
+       <td>css=.background-tasks .badge</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertNotText</td>
+       <td>css=.background-tasks</td>
+       <td>*Another Test Project*</td>
+</tr>
+<tr>
+       <td>assertElementNotPresent</td>
+       <td>css=.search-box</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertNotText</td>
+       <td>css=#content</td>
+       <td>*still failing*</td>
+</tr>
+<tr>
+       <td>assertElementNotPresent</td>
+       <td>css=.icon-filter</td>
+       <td></td>
+</tr>
+</tbody>
+</table>
+</body>
+</html>
index 02fa64391e18da52b830bc3ad630b1eb9d73f8b3..521d3e36556ec2ee344a4c9ecac173b50f02ed69 100644 (file)
@@ -171,8 +171,7 @@ export default React.createClass({
       statusFilter: STATUSES.FAILED,
       currentsFilter: CURRENTS.ONLY_CURRENTS,
       activityPage: 1
-    },
-    this.requestActivity);
+    }, this.requestActivity);
   },
 
   onTaskCanceled(task) {
@@ -192,23 +191,31 @@ export default React.createClass({
         <div className="page">
           <Header/>
 
-          <Stats {...this.state} cancelPending={this.cancelPending} showFailures={this.showFailures}/>
+          <Stats
+              {...this.props}
+              {...this.state}
+              cancelPending={this.cancelPending}
+              showFailures={this.showFailures}/>
 
-          <Search {...this.props} {...this.state}
+          <Search
+              {...this.props}
+              {...this.state}
               refresh={this.requestData}
               onStatusChange={this.onStatusChange}
               onCurrentsChange={this.onCurrentsChange}
               onDateChange={this.onDateChange}
               onSearch={this.onSearch}/>
 
-          <Tasks {...this.props}
+          <Tasks
+              {...this.props}
               tasks={[].concat(this.state.queue, this.state.activity)}
               onTaskCanceled={this.onTaskCanceled}
               onFilter={this.handleFilter}/>
 
-          <ListFooter count={this.state.queue.length + this.state.activity.length}
-                      total={this.state.queue.length + this.state.activityTotal}
-                      loadMore={this.loadMore}/>
+          <ListFooter
+              count={this.state.queue.length + this.state.activity.length}
+              total={this.state.queue.length + this.state.activityTotal}
+              loadMore={this.loadMore}/>
         </div>
     );
   }
index 308d7e4d8a8f7e156443e74b9f1184f7e56ec2c5..2383f8d76fa1fd9d4ca2ab3fcc25cb38356196ce 100644 (file)
@@ -61,6 +61,11 @@ export default React.createClass({
     if (this.props.failuresCount == null) {
       return null;
     }
+
+    if (this.props.options.component) {
+      return null;
+    }
+
     if (this.props.failuresCount > 0) {
       return (
           <span>