From: Stas Vilchik Date: Wed, 9 Dec 2015 16:25:52 +0000 (+0100) Subject: hide number of failing tasks on then project level page X-Git-Tag: 5.3-RC2~28 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a749013e0af281ac0eb19f35fe9f282f3bc80121;p=sonarqube.git hide number of failing tasks on then project level page --- diff --git a/it/it-tests/src/test/java/it/Category1Suite.java b/it/it-tests/src/test/java/it/Category1Suite.java index 97489650fcc..2bcf718ffa9 100644 --- a/it/it-tests/src/test/java/it/Category1Suite.java +++ b/it/it-tests/src/test/java/it/Category1Suite.java @@ -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 index 00000000000..93b92400d90 --- /dev/null +++ b/it/it-tests/src/test/java/it/projectAdministration/BackgroundTasksTest.java @@ -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 index 00000000000..06f59df2058 --- /dev/null +++ b/it/it-tests/src/test/resources/projectAdministration/BackgroundTasksTest/should_not_display_failing_and_search_and_filter_elements_on_project_level_page.html @@ -0,0 +1,75 @@ + + + + + + + should_not_display_failing_and_search_and_filter_elements_on_project_level_page + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
should_not_display_failing_and_search_and_filter_elements_on_project_level_page
open/sonar/sessions/logout
open/sonar/sessions/login
typeloginadmin
typepasswordadmin
clickAndWaitcommit
open/sonar/project/background_tasks?id=test-project
waitForElementPresentcss=.background-tasks .badge
assertNotTextcss=.background-tasks*Another Test Project*
assertElementNotPresentcss=.search-box
assertNotTextcss=#content*still failing*
assertElementNotPresentcss=.icon-filter
+ + diff --git a/server/sonar-web/src/main/js/apps/background-tasks/main.js b/server/sonar-web/src/main/js/apps/background-tasks/main.js index 02fa64391e1..521d3e36556 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/main.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/main.js @@ -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({
- + - - - +
); } diff --git a/server/sonar-web/src/main/js/apps/background-tasks/stats.js b/server/sonar-web/src/main/js/apps/background-tasks/stats.js index 308d7e4d8a8..2383f8d76fa 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/stats.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/stats.js @@ -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 (