From e034cead6c551a5237134fd5e782a1224b4e6a2a Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 18 Mar 2015 10:55:40 +0100 Subject: [PATCH] add web tests for rule activation from the list --- .../test/js/coding-rules-page-list-actions.js | 206 ++++++++++++ .../app-admin.json | 316 ++++++++++++++++++ .../coding-rules-page-list-actions/app.json | 316 ++++++++++++++++++ .../search-active.json | 43 +++ .../search-actives.json | 106 ++++++ .../search-inactive.json | 22 ++ .../search.json | 23 ++ 7 files changed, 1032 insertions(+) create mode 100644 server/sonar-web/src/test/js/coding-rules-page-list-actions.js create mode 100644 server/sonar-web/src/test/json/coding-rules-page-list-actions/app-admin.json create mode 100644 server/sonar-web/src/test/json/coding-rules-page-list-actions/app.json create mode 100644 server/sonar-web/src/test/json/coding-rules-page-list-actions/search-active.json create mode 100644 server/sonar-web/src/test/json/coding-rules-page-list-actions/search-actives.json create mode 100644 server/sonar-web/src/test/json/coding-rules-page-list-actions/search-inactive.json create mode 100644 server/sonar-web/src/test/json/coding-rules-page-list-actions/search.json diff --git a/server/sonar-web/src/test/js/coding-rules-page-list-actions.js b/server/sonar-web/src/test/js/coding-rules-page-list-actions.js new file mode 100644 index 00000000000..fa93ee71fef --- /dev/null +++ b/server/sonar-web/src/test/js/coding-rules-page-list-actions.js @@ -0,0 +1,206 @@ +/* + * 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. + */ +/* global casper:false */ + +var lib = require('../lib'), + testName = lib.testName('Coding Rules', 'List Actions'); + +lib.initMessages(); +lib.changeWorkingDirectory('coding-rules-page-list-actions'); +lib.configureCasper(); + + +casper.test.begin(testName('Show Activation Details'), 6, function (test) { + casper + .start(lib.buildUrl('coding-rules'), function () { + lib.setDefaultViewport(); + + lib.mockRequest('/api/l10n/index', '{}'); + lib.mockRequestFromFile('/api/rules/app', 'app.json'); + lib.mockRequestFromFile('/api/rules/search', 'search-actives.json', { data: { activation: true } }); + lib.mockRequestFromFile('/api/rules/search', 'search.json'); + }) + + .then(function () { + casper.evaluate(function () { + require(['/js/coding-rules/app.js']); + jQuery.ajaxSetup({ dataType: 'json' }); + }); + }) + + .then(function () { + casper.waitForSelector('.coding-rule'); + }) + + .then(function () { + test.assertDoesntExist('.coding-rule-activation'); + casper.click('[data-property="qprofile"] .js-facet-toggle'); + casper.waitForSelector('.js-facet[data-value="java-default-with-mojo-conventions-49307"]'); + }) + + .then(function () { + casper.click('.js-facet[data-value="java-default-with-mojo-conventions-49307"]'); + casper.waitForSelectorTextChange('#coding-rules-total'); + }) + + .then(function () { + test.assertElementCount('.coding-rule-activation', 2); + test.assertElementCount('.coding-rule-activation .icon-severity-major', 2); + test.assertElementCount('.coding-rule-activation .icon-inheritance', 1); + test.assertDoesntExist('.coding-rules-detail-quality-profile-activate'); + test.assertDoesntExist('.coding-rules-detail-quality-profile-deactivate'); + }) + + .then(function () { + lib.sendCoverage(); + }) + + .run(function () { + test.done(); + }); +}); + + +casper.test.begin(testName('Activate'), 9, function (test) { + casper + .start(lib.buildUrl('coding-rules'), function () { + lib.setDefaultViewport(); + + lib.mockRequest('/api/l10n/index', '{}'); + lib.mockRequestFromFile('/api/rules/app', 'app-admin.json'); + lib.mockRequestFromFile('/api/rules/search', 'search-inactive.json', { data: { activation: 'false' } }); + lib.mockRequestFromFile('/api/rules/search', 'search.json'); + lib.mockRequest('/api/qualityprofiles/activate_rule', '{}'); + }) + + .then(function () { + casper.evaluate(function () { + require(['/js/coding-rules/app.js']); + jQuery.ajaxSetup({ dataType: 'json' }); + }); + }) + + .then(function () { + casper.waitForSelector('.coding-rule'); + }) + + .then(function () { + test.assertDoesntExist('.coding-rule-activation'); + casper.click('[data-property="qprofile"] .js-facet-toggle'); + casper.waitForSelector('.js-facet[data-value="java-default-with-mojo-conventions-49307"]'); + }) + + .then(function () { + casper.click('.js-facet[data-value="java-default-with-mojo-conventions-49307"]'); + casper.click('.js-facet[data-value="java-default-with-mojo-conventions-49307"] .js-inactive'); + casper.waitForSelectorTextChange('#coding-rules-total'); + }) + + .then(function () { + test.assertDoesntExist('.coding-rule-activation .icon-severity-major'); + test.assertExists('.coding-rules-detail-quality-profile-activate'); + casper.click('.coding-rules-detail-quality-profile-activate'); + casper.waitForSelector('.modal'); + }) + + .then(function () { + test.assertExists('#coding-rules-quality-profile-activation-select'); + test.assertElementCount('#coding-rules-quality-profile-activation-select option', 1); + test.assertExists('#coding-rules-quality-profile-activation-severity'); + casper.click('#coding-rules-quality-profile-activation-activate'); + casper.waitForSelector('.coding-rule-activation .icon-severity-major'); + }) + + .then(function () { + test.assertExist('.coding-rule-activation .icon-severity-major'); + test.assertDoesntExist('.coding-rules-detail-quality-profile-activate'); + test.assertExist('.coding-rules-detail-quality-profile-deactivate'); + }) + + .then(function () { + lib.sendCoverage(); + }) + + .run(function () { + test.done(); + }); +}); + + +casper.test.begin(testName('Deactivate'), 6, function (test) { + casper + .start(lib.buildUrl('coding-rules'), function () { + lib.setDefaultViewport(); + + lib.mockRequest('/api/l10n/index', '{}'); + lib.mockRequestFromFile('/api/rules/app', 'app-admin.json'); + lib.mockRequestFromFile('/api/rules/search', 'search-active.json', { data: { activation: true } }); + lib.mockRequestFromFile('/api/rules/search', 'search.json'); + lib.mockRequest('/api/qualityprofiles/deactivate_rule', '{}'); + }) + + .then(function () { + casper.evaluate(function () { + require(['/js/coding-rules/app.js']); + jQuery.ajaxSetup({ dataType: 'json' }); + }); + }) + + .then(function () { + casper.waitForSelector('.coding-rule'); + }) + + .then(function () { + test.assertDoesntExist('.coding-rule-activation'); + casper.click('[data-property="qprofile"] .js-facet-toggle'); + casper.waitForSelector('.js-facet[data-value="java-default-with-mojo-conventions-49307"]'); + }) + + .then(function () { + casper.click('.js-facet[data-value="java-default-with-mojo-conventions-49307"]'); + casper.waitForSelectorTextChange('#coding-rules-total'); + }) + + .then(function () { + test.assertExists('.coding-rule-activation .icon-severity-major'); + test.assertDoesntExist('.coding-rules-detail-quality-profile-activate'); + casper.click('.coding-rules-detail-quality-profile-deactivate'); + casper.waitForSelector('button[data-confirm="yes"]'); + }) + + .then(function () { + casper.click('button[data-confirm="yes"]'); + casper.waitWhileSelector('.coding-rule-activation .icon-severity-major'); + }) + + .then(function () { + test.assertDoesntExist('.coding-rule-activation .icon-severity-major'); + test.assertExist('.coding-rules-detail-quality-profile-activate'); + test.assertDoesntExist('.coding-rules-detail-quality-profile-deactivate'); + }) + + .then(function () { + lib.sendCoverage(); + }) + + .run(function () { + test.done(); + }); +}); diff --git a/server/sonar-web/src/test/json/coding-rules-page-list-actions/app-admin.json b/server/sonar-web/src/test/json/coding-rules-page-list-actions/app-admin.json new file mode 100644 index 00000000000..50148bb1b6e --- /dev/null +++ b/server/sonar-web/src/test/json/coding-rules-page-list-actions/app-admin.json @@ -0,0 +1,316 @@ +{ + "canWrite": true, + "qualityprofiles": [ + { + "key": "java-default-with-mojo-conventions-49307", + "name": "Default - Maven Conventions", + "lang": "java", + "parentKey": "java-top-profile-without-formatting-conventions-50037" + }, + { + "key": "java-default-with-sonarsource-conventions-27339", + "name": "Default - SonarSource conventions", + "lang": "java", + "parentKey": "java-top-profile-without-formatting-conventions-50037" + }, + { + "key": "java-top-profile-without-formatting-conventions-50037", + "name": "Default - Top", + "lang": "java" + }, + { + "key": "java-findbugs-14954", + "name": "FindBugs", + "lang": "java" + }, + { + "key": "java-for-sq-java-plugin-only-92289", + "name": "For SQ Java Plugin Only", + "lang": "java", + "parentKey": "java-default-with-sonarsource-conventions-27339" + }, + { + "key": "java-for-sq-only-95381", + "name": "For SQ Only", + "lang": "java", + "parentKey": "java-default-with-sonarsource-conventions-27339" + }, + { + "key": "php-psr-2-06315", + "name": "PSR-2", + "lang": "php" + }, + { + "key": "java-sonar-way-80423", + "name": "Sonar way", + "lang": "java" + }, + { + "key": "js-sonar-way", + "name": "Sonar way", + "lang": "js" + }, + { + "key": "php-sonar-way-05548", + "name": "Sonar way", + "lang": "php" + }, + { + "key": "py-sonar-way-80265", + "name": "Sonar way", + "lang": "py" + }, + { + "key": "java-without-findbugs", + "name": "Without Findbugs", + "lang": "java" + } + ], + "languages": { + "py": "Python", + "js": "JavaScript", + "php": "PHP", + "java": "Java" + }, + "repositories": [ + { + "key": "common-java", + "name": "Common SonarQube", + "language": "java" + }, + { + "key": "common-js", + "name": "Common SonarQube", + "language": "js" + }, + { + "key": "common-php", + "name": "Common SonarQube", + "language": "php" + }, + { + "key": "common-py", + "name": "Common SonarQube", + "language": "py" + }, + { + "key": "Pylint", + "name": "Pylint", + "language": "py" + }, + { + "key": "javascript", + "name": "SonarQube", + "language": "js" + }, + { + "key": "php", + "name": "SonarQube", + "language": "php" + }, + { + "key": "python", + "name": "SonarQube", + "language": "py" + }, + { + "key": "squid", + "name": "SonarQube", + "language": "java" + } + ], + "statuses": { + "BETA": "Beta", + "DEPRECATED": "Deprecated", + "READY": "Ready" + }, + "characteristics": [ + { + "key": "UNDERSTANDABILITY", + "name": "Understandability", + "parent": "MAINTAINABILITY" + }, + { + "key": "MAINTAINABILITY", + "name": "Maintainability" + }, + { + "key": "TIME_ZONE_RELATED_PORTABILITY", + "name": "Time zone related portability", + "parent": "PORTABILITY" + }, + { + "key": "READABILITY", + "name": "Readability", + "parent": "MAINTAINABILITY" + }, + { + "key": "SECURITY_FEATURES", + "name": "Security features", + "parent": "SECURITY" + }, + { + "key": "ARCHITECTURE_RELIABILITY", + "name": "Architecture related reliability", + "parent": "RELIABILITY" + }, + { + "key": "OS_RELATED_PORTABILITY", + "name": "OS related portability", + "parent": "PORTABILITY" + }, + { + "key": "EXCEPTION_HANDLING", + "name": "Exception handling", + "parent": "RELIABILITY" + }, + { + "key": "LOGIC_CHANGEABILITY", + "name": "Logic related changeability", + "parent": "CHANGEABILITY" + }, + { + "key": "SOFTWARE_RELATED_PORTABILITY", + "name": "Software related portability", + "parent": "PORTABILITY" + }, + { + "key": "INPUT_VALIDATION_AND_REPRESENTATION", + "name": "Input validation and representation", + "parent": "SECURITY" + }, + { + "key": "LANGUAGE_RELATED_PORTABILITY", + "name": "Language related portability", + "parent": "PORTABILITY" + }, + { + "key": "ERRORS", + "name": "Errors", + "parent": "SECURITY" + }, + { + "key": "SECURITY", + "name": "Security" + }, + { + "key": "RELIABILITY", + "name": "Reliability" + }, + { + "key": "PORTABILITY", + "name": "Portability" + }, + { + "key": "HARDWARE_RELATED_PORTABILITY", + "name": "Hardware related portability", + "parent": "PORTABILITY" + }, + { + "key": "SYNCHRONIZATION_RELIABILITY", + "name": "Synchronization related reliability", + "parent": "RELIABILITY" + }, + { + "key": "TRANSPORTABILITY", + "name": "Transportability", + "parent": "REUSABILITY" + }, + { + "key": "COMPILER_RELATED_PORTABILITY", + "name": "Compiler related portability", + "parent": "PORTABILITY" + }, + { + "key": "RESOURCE_RELIABILITY", + "name": "Resource", + "parent": "RELIABILITY" + }, + { + "key": "CPU_EFFICIENCY", + "name": "Processor use", + "parent": "EFFICIENCY" + }, + { + "key": "EFFICIENCY", + "name": "Efficiency" + }, + { + "key": "CHANGEABILITY", + "name": "Changeability" + }, + { + "key": "DATA_CHANGEABILITY", + "name": "Data related changeability", + "parent": "CHANGEABILITY" + }, + { + "key": "API_ABUSE", + "name": "API abuse", + "parent": "SECURITY" + }, + { + "key": "ARCHITECTURE_CHANGEABILITY", + "name": "Architecture related changeability", + "parent": "CHANGEABILITY" + }, + { + "key": "UNIT_TESTS", + "name": "Unit tests", + "parent": "RELIABILITY" + }, + { + "key": "INSTRUCTION_RELIABILITY", + "name": "Instruction related reliability", + "parent": "RELIABILITY" + }, + { + "key": "REUSABILITY", + "name": "Reusability" + }, + { + "key": "MODULARITY", + "name": "Modularity", + "parent": "REUSABILITY" + }, + { + "key": "UNIT_TESTABILITY", + "name": "Unit level testability", + "parent": "TESTABILITY" + }, + { + "key": "TESTABILITY", + "name": "Testability" + }, + { + "key": "INTEGRATION_TESTABILITY", + "name": "Integration level testability", + "parent": "TESTABILITY" + }, + { + "key": "NETWORK_USE", + "name": "Network use", + "parent": "EFFICIENCY" + }, + { + "key": "MEMORY_EFFICIENCY", + "name": "Memory use", + "parent": "EFFICIENCY" + }, + { + "key": "DATA_RELIABILITY", + "name": "Data related reliability", + "parent": "RELIABILITY" + }, + { + "key": "FAULT_TOLERANCE", + "name": "Fault tolerance", + "parent": "RELIABILITY" + }, + { + "key": "LOGIC_RELIABILITY", + "name": "Logic related reliability", + "parent": "RELIABILITY" + } + ] +} diff --git a/server/sonar-web/src/test/json/coding-rules-page-list-actions/app.json b/server/sonar-web/src/test/json/coding-rules-page-list-actions/app.json new file mode 100644 index 00000000000..0eb43bc39f7 --- /dev/null +++ b/server/sonar-web/src/test/json/coding-rules-page-list-actions/app.json @@ -0,0 +1,316 @@ +{ + "canWrite": false, + "qualityprofiles": [ + { + "key": "java-default-with-mojo-conventions-49307", + "name": "Default - Maven Conventions", + "lang": "java", + "parentKey": "java-top-profile-without-formatting-conventions-50037" + }, + { + "key": "java-default-with-sonarsource-conventions-27339", + "name": "Default - SonarSource conventions", + "lang": "java", + "parentKey": "java-top-profile-without-formatting-conventions-50037" + }, + { + "key": "java-top-profile-without-formatting-conventions-50037", + "name": "Default - Top", + "lang": "java" + }, + { + "key": "java-findbugs-14954", + "name": "FindBugs", + "lang": "java" + }, + { + "key": "java-for-sq-java-plugin-only-92289", + "name": "For SQ Java Plugin Only", + "lang": "java", + "parentKey": "java-default-with-sonarsource-conventions-27339" + }, + { + "key": "java-for-sq-only-95381", + "name": "For SQ Only", + "lang": "java", + "parentKey": "java-default-with-sonarsource-conventions-27339" + }, + { + "key": "php-psr-2-06315", + "name": "PSR-2", + "lang": "php" + }, + { + "key": "java-sonar-way-80423", + "name": "Sonar way", + "lang": "java" + }, + { + "key": "js-sonar-way", + "name": "Sonar way", + "lang": "js" + }, + { + "key": "php-sonar-way-05548", + "name": "Sonar way", + "lang": "php" + }, + { + "key": "py-sonar-way-80265", + "name": "Sonar way", + "lang": "py" + }, + { + "key": "java-without-findbugs", + "name": "Without Findbugs", + "lang": "java" + } + ], + "languages": { + "py": "Python", + "js": "JavaScript", + "php": "PHP", + "java": "Java" + }, + "repositories": [ + { + "key": "common-java", + "name": "Common SonarQube", + "language": "java" + }, + { + "key": "common-js", + "name": "Common SonarQube", + "language": "js" + }, + { + "key": "common-php", + "name": "Common SonarQube", + "language": "php" + }, + { + "key": "common-py", + "name": "Common SonarQube", + "language": "py" + }, + { + "key": "Pylint", + "name": "Pylint", + "language": "py" + }, + { + "key": "javascript", + "name": "SonarQube", + "language": "js" + }, + { + "key": "php", + "name": "SonarQube", + "language": "php" + }, + { + "key": "python", + "name": "SonarQube", + "language": "py" + }, + { + "key": "squid", + "name": "SonarQube", + "language": "java" + } + ], + "statuses": { + "BETA": "Beta", + "DEPRECATED": "Deprecated", + "READY": "Ready" + }, + "characteristics": [ + { + "key": "UNDERSTANDABILITY", + "name": "Understandability", + "parent": "MAINTAINABILITY" + }, + { + "key": "MAINTAINABILITY", + "name": "Maintainability" + }, + { + "key": "TIME_ZONE_RELATED_PORTABILITY", + "name": "Time zone related portability", + "parent": "PORTABILITY" + }, + { + "key": "READABILITY", + "name": "Readability", + "parent": "MAINTAINABILITY" + }, + { + "key": "SECURITY_FEATURES", + "name": "Security features", + "parent": "SECURITY" + }, + { + "key": "ARCHITECTURE_RELIABILITY", + "name": "Architecture related reliability", + "parent": "RELIABILITY" + }, + { + "key": "OS_RELATED_PORTABILITY", + "name": "OS related portability", + "parent": "PORTABILITY" + }, + { + "key": "EXCEPTION_HANDLING", + "name": "Exception handling", + "parent": "RELIABILITY" + }, + { + "key": "LOGIC_CHANGEABILITY", + "name": "Logic related changeability", + "parent": "CHANGEABILITY" + }, + { + "key": "SOFTWARE_RELATED_PORTABILITY", + "name": "Software related portability", + "parent": "PORTABILITY" + }, + { + "key": "INPUT_VALIDATION_AND_REPRESENTATION", + "name": "Input validation and representation", + "parent": "SECURITY" + }, + { + "key": "LANGUAGE_RELATED_PORTABILITY", + "name": "Language related portability", + "parent": "PORTABILITY" + }, + { + "key": "ERRORS", + "name": "Errors", + "parent": "SECURITY" + }, + { + "key": "SECURITY", + "name": "Security" + }, + { + "key": "RELIABILITY", + "name": "Reliability" + }, + { + "key": "PORTABILITY", + "name": "Portability" + }, + { + "key": "HARDWARE_RELATED_PORTABILITY", + "name": "Hardware related portability", + "parent": "PORTABILITY" + }, + { + "key": "SYNCHRONIZATION_RELIABILITY", + "name": "Synchronization related reliability", + "parent": "RELIABILITY" + }, + { + "key": "TRANSPORTABILITY", + "name": "Transportability", + "parent": "REUSABILITY" + }, + { + "key": "COMPILER_RELATED_PORTABILITY", + "name": "Compiler related portability", + "parent": "PORTABILITY" + }, + { + "key": "RESOURCE_RELIABILITY", + "name": "Resource", + "parent": "RELIABILITY" + }, + { + "key": "CPU_EFFICIENCY", + "name": "Processor use", + "parent": "EFFICIENCY" + }, + { + "key": "EFFICIENCY", + "name": "Efficiency" + }, + { + "key": "CHANGEABILITY", + "name": "Changeability" + }, + { + "key": "DATA_CHANGEABILITY", + "name": "Data related changeability", + "parent": "CHANGEABILITY" + }, + { + "key": "API_ABUSE", + "name": "API abuse", + "parent": "SECURITY" + }, + { + "key": "ARCHITECTURE_CHANGEABILITY", + "name": "Architecture related changeability", + "parent": "CHANGEABILITY" + }, + { + "key": "UNIT_TESTS", + "name": "Unit tests", + "parent": "RELIABILITY" + }, + { + "key": "INSTRUCTION_RELIABILITY", + "name": "Instruction related reliability", + "parent": "RELIABILITY" + }, + { + "key": "REUSABILITY", + "name": "Reusability" + }, + { + "key": "MODULARITY", + "name": "Modularity", + "parent": "REUSABILITY" + }, + { + "key": "UNIT_TESTABILITY", + "name": "Unit level testability", + "parent": "TESTABILITY" + }, + { + "key": "TESTABILITY", + "name": "Testability" + }, + { + "key": "INTEGRATION_TESTABILITY", + "name": "Integration level testability", + "parent": "TESTABILITY" + }, + { + "key": "NETWORK_USE", + "name": "Network use", + "parent": "EFFICIENCY" + }, + { + "key": "MEMORY_EFFICIENCY", + "name": "Memory use", + "parent": "EFFICIENCY" + }, + { + "key": "DATA_RELIABILITY", + "name": "Data related reliability", + "parent": "RELIABILITY" + }, + { + "key": "FAULT_TOLERANCE", + "name": "Fault tolerance", + "parent": "RELIABILITY" + }, + { + "key": "LOGIC_RELIABILITY", + "name": "Logic related reliability", + "parent": "RELIABILITY" + } + ] +} diff --git a/server/sonar-web/src/test/json/coding-rules-page-list-actions/search-active.json b/server/sonar-web/src/test/json/coding-rules-page-list-actions/search-active.json new file mode 100644 index 00000000000..544cca64336 --- /dev/null +++ b/server/sonar-web/src/test/json/coding-rules-page-list-actions/search-active.json @@ -0,0 +1,43 @@ +{ + "total": 2, + "p": 1, + "ps": 200, + "rules": [ + { + "key": "common-java:DuplicatedBlocks", + "tags": [], + "status": "READY", + "langName": "Java", + "name": "Duplicated blocks", + "severity": "MAJOR", + "isTemplate": false, + "params": [], + "lang": "java", + "sysTags": [] + } + ], + "actives": { + "common-java:DuplicatedBlocks": [ + { + "qProfile": "java-default-with-mojo-conventions-49307", + "inherit": "NONE", + "severity": "MAJOR", + "params": [] + } + ] + }, + "qProfiles": { + "java-default-with-mojo-conventions-49307": { + "name": "Default - Maven Conventions", + "lang": "java", + "langName": "Java", + "parent": "java-top-profile-without-formatting-conventions-50037" + }, + "java-top-profile-without-formatting-conventions-50037": { + "name": "Default - Top", + "lang": "java", + "langName": "Java" + } + }, + "facets": [] +} diff --git a/server/sonar-web/src/test/json/coding-rules-page-list-actions/search-actives.json b/server/sonar-web/src/test/json/coding-rules-page-list-actions/search-actives.json new file mode 100644 index 00000000000..50df4bde597 --- /dev/null +++ b/server/sonar-web/src/test/json/coding-rules-page-list-actions/search-actives.json @@ -0,0 +1,106 @@ +{ + "total": 2, + "p": 1, + "ps": 200, + "rules": [ + { + "key": "common-java:DuplicatedBlocks", + "tags": [], + "status": "READY", + "langName": "Java", + "name": "Duplicated blocks", + "severity": "MAJOR", + "isTemplate": false, + "params": [], + "lang": "java", + "sysTags": [] + }, + { + "key": "common-java:InsufficientBranchCoverage", + "tags": [], + "status": "READY", + "langName": "Java", + "name": "Insufficient branch coverage by unit tests", + "severity": "MAJOR", + "isTemplate": false, + "params": [ + { + "key": "minimumBranchCoverageRatio", + "htmlDesc": "The minimum required branch coverage ratio.", + "type": "STRING", + "defaultValue": "65.0" + } + ], + "lang": "java", + "sysTags": [] + } + ], + "actives": { + "common-java:DuplicatedBlocks": [ + { + "qProfile": "java-default-with-mojo-conventions-49307", + "inherit": "NONE", + "severity": "MAJOR", + "params": [] + } + ], + "common-java:InsufficientBranchCoverage": [ + { + "qProfile": "java-default-with-mojo-conventions-49307", + "inherit": "INHERITED", + "severity": "MAJOR", + "params": [ + { + "key": "minimumBranchCoverageRatio", + "value": "65.0" + } + ] + } + ] + }, + "qProfiles": { + "java-default-with-mojo-conventions-49307": { + "name": "Default - Maven Conventions", + "lang": "java", + "langName": "Java", + "parent": "java-top-profile-without-formatting-conventions-50037" + }, + "java-top-profile-without-formatting-conventions-50037": { + "name": "Default - Top", + "lang": "java", + "langName": "Java" + } + }, + "facets": [ + { + "property": "languages", + "values": [ + { + "val": "java", + "count": 2 + } + ] + }, + { + "property": "tags", + "values": [] + }, + { + "property": "repositories", + "values": [ + { + "val": "findbugs", + "count": 302 + }, + { + "val": "squid", + "count": 228 + }, + { + "val": "common-java", + "count": 2 + } + ] + } + ] +} diff --git a/server/sonar-web/src/test/json/coding-rules-page-list-actions/search-inactive.json b/server/sonar-web/src/test/json/coding-rules-page-list-actions/search-inactive.json new file mode 100644 index 00000000000..bff4fda5566 --- /dev/null +++ b/server/sonar-web/src/test/json/coding-rules-page-list-actions/search-inactive.json @@ -0,0 +1,22 @@ +{ + "total": 4, + "p": 1, + "ps": 200, + "rules": [ + { + "key": "common-java:FailedUnitTests", + "tags": [], + "status": "READY", + "langName": "Java", + "name": "Failed unit tests", + "severity": "MAJOR", + "isTemplate": false, + "params": [], + "lang": "java", + "sysTags": [] + } + ], + "actives": {}, + "qProfiles": {}, + "facets": [] +} diff --git a/server/sonar-web/src/test/json/coding-rules-page-list-actions/search.json b/server/sonar-web/src/test/json/coding-rules-page-list-actions/search.json new file mode 100644 index 00000000000..37786fd43b7 --- /dev/null +++ b/server/sonar-web/src/test/json/coding-rules-page-list-actions/search.json @@ -0,0 +1,23 @@ +{ + "total": 609, + "p": 1, + "ps": 25, + "rules": [ + { + "key": "squid:S2077", + "name": "Values passed to SQL commands should be sanitized", + "lang": "java", + "langName": "Java", + "sysTags": [ + "cwe", + "owasp-top10", + "security", + "sql" + ], + "tags": [ + "custom-tag" + ] + } + ], + "facets": [] +} -- 2.39.5