]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5820 Update MTs
authorStas Vilchik <vilchiks@gmail.com>
Tue, 23 Dec 2014 12:32:10 +0000 (13:32 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Tue, 23 Dec 2014 12:45:43 +0000 (13:45 +0100)
14 files changed:
server/sonar-web/src/main/hbs/coding-rules/coding-rules-workspace-list-item.hbs
server/sonar-web/src/main/js/coding-rules/workspace-list-item-view.js
server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details.js [new file with mode: 0644]
server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details/app.json [new file with mode: 0644]
server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details/search.json [new file with mode: 0644]
server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details/show.json [new file with mode: 0644]
server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-facets.js [new file with mode: 0644]
server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rule.js [new file with mode: 0644]
server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rules.js [new file with mode: 0644]
server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec.js
server/sonar-web/src/main/js/tests/e2e/tests/coding-rules/app.json [new file with mode: 0644]
server/sonar-web/src/main/js/tests/e2e/tests/coding-rules/search.json [new file with mode: 0644]
server/sonar-web/src/main/js/tests/e2e/views/coding-rules-old.jade [new file with mode: 0644]
server/sonar-web/src/main/js/tests/e2e/views/coding-rules.jade

index fffa5b5e9cca51699958dc9605a55ef4a6233bfd..3d7a6e67f2da30feee2e643a7310cb45f0ba5e83 100644 (file)
@@ -4,10 +4,10 @@
   </div>
   <div class="coding-rule-meta">
     <a class="js-lang link-no-underline" data-lang="{{lang}}">{{langName}}</a>
-    {{#notEmpty sysTags}}
+    {{#notEmpty tags}}
       &nbsp;&nbsp;&nbsp;
       <i class="icon-tags"></i>
-      {{#each sysTags}}
+      {{#each tags}}
         <a class="js-tag link-no-underline" data-tag="{{this}}">{{this}}</a>
       {{/each}}
     {{/notEmpty}}
index 890f05d2af9e035368b52776fd79e45c01f7e510..c2827277d4bc0e348c14115029b33f09bee180d4 100644 (file)
@@ -22,6 +22,12 @@ define([
 
     openRule: function () {
       this.options.app.controller.showDetails(this.model);
+    },
+
+    serializeData: function () {
+      return _.extend(WorkspaceListItemView.prototype.serializeData.apply(this, arguments), {
+        tags: _.union(this.model.get('sysTags'), this.model.get('tags'))
+      });
     }
   });
 
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details.js
new file mode 100644 (file)
index 0000000..0598f90
--- /dev/null
@@ -0,0 +1,58 @@
+/* global casper:false */
+
+var lib = require('../lib');
+
+lib.initMessages();
+lib.changeWorkingDirectory('coding-rules-page-should-show-details');
+
+
+casper.test.begin('coding-rules-page-should-show-details', 17, 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.json');
+        lib.mockRequestFromFile('/api/rules/show', 'show.json');
+      })
+
+      .then(function () {
+        casper.waitForSelector('.coding-rule.selected', function () {
+          casper.click('.coding-rule.selected .js-rule');
+        });
+      })
+
+      .then(function () {
+        casper.waitForSelector('.coding-rules-detail-header');
+      })
+
+      .then(function () {
+        test.assertSelectorContains('.search-navigator-workspace-details',
+            'Throwable and Error classes should not be caught');
+
+        test.assertSelectorContains('.search-navigator-workspace-details', 'squid:S1181');
+        test.assertExists('.coding-rules-detail-properties .icon-severity-blocker');
+        test.assertSelectorContains('.coding-rules-detail-properties', 'error-handling');
+        test.assertSelectorContains('.coding-rules-detail-properties', '2013');
+        test.assertSelectorContains('.coding-rules-detail-properties', 'SonarQube (Java)');
+
+        test.assertSelectorContains('.coding-rules-detail-description', 'is the superclass of all errors and');
+        test.assertSelectorContains('.coding-rules-detail-description', 'its subclasses should be caught.');
+        test.assertSelectorContains('.coding-rules-detail-description', 'Noncompliant Code Example');
+        test.assertSelectorContains('.coding-rules-detail-description', 'Compliant Solution');
+
+        test.assertSelectorContains('.coding-rules-detail-parameters', 'max');
+        test.assertSelectorContains('.coding-rules-detail-parameters', 'Maximum authorized number of parameters');
+        test.assertSelectorContains('.coding-rules-detail-parameters', '7');
+
+        test.assertElementCount('.coding-rules-detail-quality-profile-name', 6);
+        test.assertSelectorContains('.coding-rules-detail-quality-profile-name', 'Default - Top');
+        test.assertElementCount('.coding-rules-detail-quality-profile-inheritance', 4);
+        test.assertSelectorContains('.coding-rules-detail-quality-profile-inheritance', 'Default - Top');
+      })
+
+      .run(function () {
+        test.done();
+      });
+});
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details/app.json b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details/app.json
new file mode 100644 (file)
index 0000000..4f3319c
--- /dev/null
@@ -0,0 +1,168 @@
+{
+  "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": {
+    "UNDERSTANDABILITY": "Maintainability: Understandability",
+    "MAINTAINABILITY": "Maintainability",
+    "TIME_ZONE_RELATED_PORTABILITY": "Portability: Time zone related portability",
+    "READABILITY": "Maintainability: Readability",
+    "SECURITY_FEATURES": "Security: Security features",
+    "ARCHITECTURE_RELIABILITY": "Reliability: Architecture related reliability",
+    "OS_RELATED_PORTABILITY": "Portability: OS related portability",
+    "EXCEPTION_HANDLING": "Reliability: Exception handling",
+    "LOGIC_CHANGEABILITY": "Changeability: Logic related changeability",
+    "SOFTWARE_RELATED_PORTABILITY": "Portability: Software related portability",
+    "INPUT_VALIDATION_AND_REPRESENTATION": "Security: Input validation and representation",
+    "LANGUAGE_RELATED_PORTABILITY": "Portability: Language related portability",
+    "ERRORS": "Security: Errors",
+    "SECURITY": "Security",
+    "RELIABILITY": "Reliability",
+    "PORTABILITY": "Portability",
+    "HARDWARE_RELATED_PORTABILITY": "Portability: Hardware related portability",
+    "SYNCHRONIZATION_RELIABILITY": "Reliability: Synchronization related reliability",
+    "TRANSPORTABILITY": "Reusability: Transportability",
+    "COMPILER_RELATED_PORTABILITY": "Portability: Compiler related portability",
+    "RESOURCE_RELIABILITY": "Reliability: Resource",
+    "CPU_EFFICIENCY": "Efficiency: Processor use",
+    "EFFICIENCY": "Efficiency",
+    "CHANGEABILITY": "Changeability",
+    "DATA_CHANGEABILITY": "Changeability: Data related changeability",
+    "API_ABUSE": "Security: API abuse",
+    "ARCHITECTURE_CHANGEABILITY": "Changeability: Architecture related changeability",
+    "UNIT_TESTS": "Reliability: Unit tests",
+    "INSTRUCTION_RELIABILITY": "Reliability: Instruction related reliability",
+    "REUSABILITY": "Reusability",
+    "MODULARITY": "Reusability: Modularity",
+    "UNIT_TESTABILITY": "Testability: Unit level testability",
+    "TESTABILITY": "Testability",
+    "INTEGRATION_TESTABILITY": "Testability: Integration level testability",
+    "NETWORK_USE": "Efficiency: Network use",
+    "MEMORY_EFFICIENCY": "Efficiency: Memory use",
+    "DATA_RELIABILITY": "Reliability: Data related reliability",
+    "FAULT_TOLERANCE": "Reliability: Fault tolerance",
+    "LOGIC_RELIABILITY": "Reliability: Logic related reliability"
+  }
+}
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details/search.json b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details/search.json
new file mode 100644 (file)
index 0000000..b5a6bc2
--- /dev/null
@@ -0,0 +1,171 @@
+{
+  "total": 10,
+  "p": 1,
+  "ps": 200,
+  "rules": [
+    {
+      "key": "squid:S1181",
+      "name": "Throwable and Error classes should not be caught",
+      "lang": "java",
+      "langName": "Java",
+      "sysTags": [
+        "error-handling"
+      ],
+      "tags": []
+    },
+    {
+      "key": "squid:S1849",
+      "name": "\"Iterator.hasNext()\" should not call \"Iterator.next()\"",
+      "lang": "java",
+      "langName": "Java",
+      "sysTags": [
+        "bug"
+      ],
+      "tags": []
+    },
+    {
+      "key": "squid:S1844",
+      "name": "\"Object.wait(...)\" should never be called on objects that implement \"java.util.concurrent.locks.Condition\"",
+      "lang": "java",
+      "langName": "Java",
+      "sysTags": [
+        "bug",
+        "pitfall"
+      ],
+      "tags": []
+    },
+    {
+      "key": "squid:S2258",
+      "name": "\"javax.crypto.NullCipher\" should not be used for anything other than testing",
+      "lang": "java",
+      "langName": "Java",
+      "sysTags": [
+        "cwe",
+        "owasp-top10",
+        "security"
+      ],
+      "tags": []
+    },
+    {
+      "key": "squid:S2251",
+      "name": "A \"for\" loop update clause should move the counter in the right direction",
+      "lang": "java",
+      "langName": "Java",
+      "sysTags": [
+        "bug"
+      ],
+      "tags": []
+    },
+    {
+      "key": "squid:ObjectFinalizeOverridenCallsSuperFinalizeCheck",
+      "name": "super.finalize() should be called at the end of Object.finalize() implementations",
+      "lang": "java",
+      "langName": "Java",
+      "sysTags": [
+        "bug"
+      ],
+      "tags": []
+    },
+    {
+      "key": "squid:S1143",
+      "name": "Return statements should not occur in finally blocks",
+      "lang": "java",
+      "langName": "Java",
+      "sysTags": [
+        "bug"
+      ],
+      "tags": []
+    },
+    {
+      "key": "squid:S1206",
+      "name": "\"equals(Object obj)\" and \"hashCode()\" should be overridden in pairs",
+      "lang": "java",
+      "langName": "Java",
+      "sysTags": [
+        "bug"
+      ],
+      "tags": []
+    },
+    {
+      "key": "squid:S1451",
+      "name": "Copyright and license headers should be defined in all source files",
+      "lang": "java",
+      "langName": "Java",
+      "sysTags": [
+        "convention"
+      ],
+      "tags": []
+    },
+    {
+      "key": "squid:S1697",
+      "name": "Short-circuit logic should be used to prevent null pointer dereferences in conditionals",
+      "lang": "java",
+      "langName": "Java",
+      "sysTags": [
+        "bug"
+      ],
+      "tags": []
+    }
+  ],
+  "facets": [
+    {
+      "property": "tags",
+      "values": [
+        {
+          "val": "bug",
+          "count": 7
+        },
+        {
+          "val": "convention",
+          "count": 1
+        },
+        {
+          "val": "cwe",
+          "count": 1
+        },
+        {
+          "val": "error-handling",
+          "count": 1
+        },
+        {
+          "val": "owasp-top10",
+          "count": 1
+        },
+        {
+          "val": "pitfall",
+          "count": 1
+        },
+        {
+          "val": "security",
+          "count": 1
+        }
+      ]
+    },
+    {
+      "property": "languages",
+      "values": [
+        {
+          "val": "java",
+          "count": 10
+        },
+        {
+          "val": "js",
+          "count": 6
+        },
+        {
+          "val": "php",
+          "count": 2
+        }
+      ]
+    },
+    {
+      "property": "repositories",
+      "values": [
+        {
+          "val": "squid",
+          "count": 10
+        }
+      ]
+    }
+  ]
+}
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details/show.json b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details/show.json
new file mode 100644 (file)
index 0000000..274b587
--- /dev/null
@@ -0,0 +1,76 @@
+{
+  "rule": {
+    "key": "squid:S1181",
+    "repo": "squid",
+    "name": "Throwable and Error classes should not be caught",
+    "createdAt": "2013-08-09T14:40:54+0200",
+    "severity": "BLOCKER",
+    "status": "READY",
+    "internalKey": "S1181",
+    "isTemplate": false,
+    "tags": [],
+    "sysTags": [
+      "error-handling"
+    ],
+    "lang": "java",
+    "langName": "Java",
+    "htmlDesc": "<p>\n<code>Throwable</code> is the superclass of all errors and exceptions in Java.\n<code>Error</code> is the superclass of all errors which are not meant to be caught by applications.\n</p>\n\n<p>\nCatching either <code>Throwable</code> or <code>Error</code> will also catch <code>OutOfMemoryError</code> or <code>InternalError</code> from which an application should not attempt to recover.\n</p>\n\n<p>Only <code>Exception</code> and its subclasses should be caught.</p>\n\n<h2>Noncompliant Code Example</h2>\n\n<pre>\ntry { /* ... */ } catch (Throwable t) { /* ... */ }\ntry { /* ... */ } catch (Error e) { /* ... */ } \n</pre>\n\n<h2>Compliant Solution</h2>\n\n<pre>\ntry { /* ... */ } catch (Exception e) { /* ... */ }  \ntry { /* ... */ } catch (RuntimeException e) { /* ... */ }  \ntry { /* ... */ } catch (MyException e) { /* ... */ }  \n</pre>",
+    "defaultDebtChar": "RELIABILITY",
+    "defaultDebtSubChar": "EXCEPTION_HANDLING",
+    "debtChar": "RELIABILITY",
+    "debtSubChar": "EXCEPTION_HANDLING",
+    "debtCharName": "Reliability",
+    "debtSubCharName": "Exception handling",
+    "defaultDebtRemFnType": "CONSTANT_ISSUE",
+    "defaultDebtRemFnOffset": "20min",
+    "debtOverloaded": true,
+    "debtRemFnType": "LINEAR",
+    "debtRemFnCoeff": "20min",
+    "params": [
+      {
+        "key": "max",
+        "htmlDesc": "Maximum authorized number of parameters",
+        "type": "INTEGER",
+        "defaultValue": "7"
+      }
+    ]
+  },
+  "actives": [
+    {
+      "qProfile": "java-top-profile-without-formatting-conventions-50037",
+      "inherit": "NONE",
+      "severity": "BLOCKER",
+      "params": []
+    },
+    {
+      "qProfile": "java-default-with-sonarsource-conventions-27339",
+      "inherit": "INHERITED",
+      "severity": "BLOCKER",
+      "params": []
+    },
+    {
+      "qProfile": "java-for-sq-java-plugin-only-92289",
+      "inherit": "INHERITED",
+      "severity": "BLOCKER",
+      "params": []
+    },
+    {
+      "qProfile": "java-for-sq-only-95381",
+      "inherit": "INHERITED",
+      "severity": "BLOCKER",
+      "params": []
+    },
+    {
+      "qProfile": "java-default-with-mojo-conventions-49307",
+      "inherit": "INHERITED",
+      "severity": "BLOCKER",
+      "params": []
+    },
+    {
+      "qProfile": "java-sonar-way-80423",
+      "inherit": "NONE",
+      "severity": "BLOCKER",
+      "params": []
+    }
+  ]
+}
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-facets.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-facets.js
new file mode 100644 (file)
index 0000000..2ad4cf7
--- /dev/null
@@ -0,0 +1,30 @@
+/* global casper:false */
+
+var lib = require('../lib');
+
+lib.initMessages();
+lib.changeWorkingDirectory('coding-rules');
+
+
+casper.test.begin('coding-rules-page-should-show-facets', 1, 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.json');
+      })
+
+      .then(function () {
+        casper.waitForSelector('.search-navigator-facet-box');
+      })
+
+      .then(function () {
+        test.assertElementCount('.search-navigator-facet-box', 7);
+      })
+
+      .run(function () {
+        test.done();
+      });
+});
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rule.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rule.js
new file mode 100644 (file)
index 0000000..f4e71de
--- /dev/null
@@ -0,0 +1,36 @@
+/* global casper:false */
+
+var lib = require('../lib');
+
+lib.initMessages();
+lib.changeWorkingDirectory('coding-rules');
+
+
+casper.test.begin('coding-rules-page-should-show-rule', 7, 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.json');
+      })
+
+      .then(function () {
+        casper.waitForSelector('.coding-rule.selected');
+      })
+
+      .then(function () {
+        test.assertSelectorContains('.coding-rule.selected', 'Values passed to SQL commands should be sanitized');
+        test.assertSelectorContains('.coding-rule.selected', 'Java');
+        test.assertSelectorContains('.coding-rule.selected', 'cwe');
+        test.assertSelectorContains('.coding-rule.selected', 'owasp-top10');
+        test.assertSelectorContains('.coding-rule.selected', 'security');
+        test.assertSelectorContains('.coding-rule.selected', 'sql');
+        test.assertSelectorContains('.coding-rule.selected', 'custom-tag');
+      })
+
+      .run(function () {
+        test.done();
+      });
+});
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rules.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rules.js
new file mode 100644 (file)
index 0000000..8b2fa3b
--- /dev/null
@@ -0,0 +1,33 @@
+/* global casper:false */
+
+var lib = require('../lib');
+
+lib.initMessages();
+lib.changeWorkingDirectory('coding-rules');
+
+
+casper.test.begin('coding-rules-page-should-show-rules', 4, 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.json');
+      })
+
+      .then(function () {
+        casper.waitForSelector('.coding-rule');
+      })
+
+      .then(function () {
+        test.assertElementCount('.coding-rule', 25);
+        test.assertSelectorContains('.coding-rule', 'Values passed to SQL commands should be sanitized');
+        test.assertSelectorContains('.coding-rule', 'An open curly brace should be located at the beginning of a line');
+        test.assertSelectorContains('#coding-rules-total', '609');
+      })
+
+      .run(function () {
+        test.done();
+      });
+});
index afbc1bb85106d9b8637fbfabcf430910ae5ef401..4c6f2f75adf309f9ec129e2f536b0bd6eb8add42 100644 (file)
@@ -6,137 +6,12 @@ lib.initMessages();
 lib.changeWorkingDirectory('coding-rules-spec');
 
 
-casper.test.begin(testName('Readonly Tests'), function suite(test) {
-
-  var appId = null;
-  var showId = null;
-
-  casper.start(lib.buildUrl('coding-rules'), function() {
-    lib.mockRequest('/api/l10n/index', '{}');
-    lib.mockRequestFromFile('/api/rules/app', 'app.json');
-    lib.mockRequestFromFile('/api/rules/tags', 'tags.json');
-    lib.mockRequestFromFile('/api/rules/search', 'search_initial.json');
-    showId = lib.mockRequestFromFile('/api/rules/show', 'show_x1.json');
-  });
-
-
-  casper.waitWhileSelector("div#coding-rules-page-loader", function checkInitialPageLoad() {
-
-    casper.waitForSelector('.navigator-header', function checkHeader() {
-      test.assertExists('.navigator-header h1');
-      test.assertExists('button#coding-rules-new-search');
-      test.assertDoesntExist('button#coding-rules-create-rule');
-    });
-
-
-    casper.waitForSelector('.navigator-filters', function checkDefaultFilters() {
-      test.assertVisible('input[type="text"].query-filter-input');
-      test.assertElementCount('.navigator-filter', 15);
-      test.assertElementCount('.navigator-filter-optional', 12 /* Only query, qProfile and 'More' are visible by default */);
-      test.assertVisible('button.navigator-filter-submit');
-
-
-      casper.click('.navigator-filter-more-criteria');
-      casper.waitForSelector('.navigator-filter-details.active', function checkTagsAreOrdered() {
-        casper.click('.navigator-filter-details.active label[data-property="tags"]');
-        test.assertSelectorHasText('.navigator-filter[data-property="tags"] option:nth-child(1)', 'brain-overload');
-        test.assertSelectorHasText('.navigator-filter[data-property="tags"] option:nth-child(11)', 'unused');
-        casper.click('.navigator-filter.active>.navigator-filter-disable');
-      });
-
-      // Check repositories are sorted by name, then language
-      test.assertSelectorHasText('#filter-repositories li:nth-child(1) span:nth-child(1)', 'Common SonarQube');
-      test.assertSelectorHasText('#filter-repositories li:nth-child(1) span:nth-child(2)', 'CoffeeScript');
-      test.assertSelectorHasText('#filter-repositories li:nth-child(2) span:nth-child(1)', 'Common SonarQube');
-      test.assertSelectorHasText('#filter-repositories li:nth-child(2) span:nth-child(2)', 'Java');
-      test.assertSelectorHasText('#filter-repositories li:nth-child(3) span:nth-child(1)', 'Manual Rules');
-      test.assertSelectorHasText('#filter-repositories li:nth-child(3) span:nth-child(2)', 'None');
-      test.assertSelectorHasText('#filter-repositories li:nth-child(4) span:nth-child(1)', 'SonarQube');
-      test.assertSelectorHasText('#filter-repositories li:nth-child(4) span:nth-child(2)', 'CoffeeScript');
-      test.assertSelectorHasText('#filter-repositories li:nth-child(5) span:nth-child(1)', 'SonarQube');
-      test.assertSelectorHasText('#filter-repositories li:nth-child(5) span:nth-child(2)', 'Java');
-      test.assertSelectorHasText('#filter-repositories li:nth-child(6) span:nth-child(1)', 'SonarQube');
-      test.assertSelectorHasText('#filter-repositories li:nth-child(6) span:nth-child(2)', 'Xoo');
-    });
-
-
-    casper.waitForSelector('div.navigator-facets-list-item:nth-child(2)', function checkFacets() {
-      test.assertSelectorHasText('div.navigator-facets-list-item:nth-child(2) a:nth-child(1)', 'Java SonarQube');
-      test.assertSelectorHasText('div.navigator-facets-list-item:nth-child(2) a:nth-child(2)', 'Java Common SonarQube');
-      test.assertSelectorHasText('div.navigator-facets-list-item:nth-child(2) a:nth-child(3)', 'CoffeeScript SonarQube');
-      test.assertSelectorHasText('div.navigator-facets-list-item:nth-child(2) a:nth-child(4)', 'CoffeeScript Common SonarQube');
-      test.assertSelectorHasText('div.navigator-facets-list-item:nth-child(2) a:nth-child(5)', 'Xoo SonarQube');
-    });
-
-
-    casper.waitForSelector('li.active', function checkResultsList() {
-      test.assertElementCount('ol.navigator-results-list li', 10);
-      test.assertElementCount('li.active', 1);
-      test.assertSelectorHasText('ol.navigator-results-list li.active', 'Xoo');
-      test.assertSelectorHasText('ol.navigator-results-list li.active', 'No empty line');
-      test.assertSelectorHasText('ol.navigator-results-list li.active', 'BETA');
-    });
-
-
-    casper.waitForSelector('h3.coding-rules-detail-header', function showFirstRule() {
-      test.assertSelectorHasText('h3.coding-rules-detail-header', 'No empty line');
-      test.assertSelectorHasText('.navigator-details .subtitle', 'squid-xoo:x1');
-      test.assertSelectorHasText('.coding-rules-detail-property:nth-child(1)', 'severity.MINOR');
-      test.assertSelectorHasText('.coding-rules-detail-property:nth-child(2)', 'BETA');
-      test.assertSelectorHasText('.coding-rules-detail-property:nth-child(3)', 'convention, pitfall');
-      test.assertSelectorHasText('.coding-rules-detail-property:nth-child(4)', 'Testability > Integration level testability');
-      test.assertSelectorHasText('.coding-rules-detail-property:nth-child(6)', 'SonarQube (Xoo)');
-
-
-      casper.click('.coding-rules-subcharacteristic');
-      casper.waitForSelector('.coding-rules-debt-popup', function checkDebtPopup() {
-        test.assertElementCount('ul.bubble-popup-list li', 3);
-        test.assertSelectorHasText('.bubble-popup-list li:nth-child(1)', 'LINEAR_OFFSET');
-        test.assertSelectorHasText('.bubble-popup-list li:nth-child(2)', '1h');
-        test.assertSelectorHasText('.bubble-popup-list li:nth-child(3)', '30min');
-      });
-
-
-      test.assertDoesntExist('button#coding-rules-detail-extend-description');
-
-
-      casper.then(function checkParameters() {
-        test.assertElementCount('.coding-rules-detail-parameter', 3);
-        test.assertVisible('.coding-rules-detail-parameter-description[data-key=acceptWhitespace]');
-        test.assertSelectorHasText('.coding-rules-detail-parameter-description[data-key=acceptWhitespace]', 'Accept whitespace');
-        casper.click('.coding-rules-detail-parameter:nth-child(1) .coding-rules-detail-parameter-name');
-        test.assertNotVisible('.coding-rules-detail-parameter-description[data-key=acceptWhitespace]');
-        casper.click('.coding-rules-detail-parameter:nth-child(1) .coding-rules-detail-parameter-name');
-        test.assertVisible('.coding-rules-detail-parameter-description[data-key=acceptWhitespace]');
-      });
-    });
-  });
-
-  casper.then(function showDeprecated() {
-    lib.clearRequestMock(showId);
-    showId = lib.mockRequestFromFile('/api/rules/show', 'show_deprecated.json');
-
-    casper.click('div[name="squid:S0001"]');
-
-    casper.waitWhileSelector('.navigator-details i.spinner');
-    casper.waitForSelector('h3.coding-rules-detail-header', function() {
-      test.assertSelectorHasText('h3.coding-rules-detail-header', 'Deprecated rule');
-    });
-
-  });
-
-  casper.run(function() {
-    test.done();
-  });
-});
-
-
 casper.test.begin(testName('Admin Tests'), function suite(test) {
 
   var showId = null;
   var updateId = null;
 
-  casper.start(lib.buildUrl('coding-rules'), function() {
+  casper.start(lib.buildUrl('coding-rules-old'), function() {
     lib.mockRequest('/api/l10n/index', '{}');
     lib.mockRequestFromFile('/api/rules/app', 'app_admin.json');
     lib.mockRequestFromFile('/api/rules/tags', 'tags.json');
@@ -186,7 +61,7 @@ casper.test.begin(testName('Activation Tests'), function suite(test) {
   var showId = null;
   var activateId = null;
 
-  casper.start(lib.buildUrl('coding-rules#rule_key=squid-xoo:x1'), function() {
+  casper.start(lib.buildUrl('coding-rules-old#rule_key=squid-xoo:x1'), function() {
     lib.clearRequestMocks();
     lib.mockRequest('/api/l10n/index', '{}');
     lib.mockRequestFromFile('/api/rules/app', 'app_admin.json');
@@ -296,7 +171,7 @@ casper.test.begin(testName('Activation Tests'), function suite(test) {
 
 casper.test.begin(testName('Tag Navigation Test'), function suite(test) {
 
-  casper.start(lib.buildUrl('coding-rules#tags=polop,bug,pilip,unused,palap'), function() {
+  casper.start(lib.buildUrl('coding-rules-old#tags=polop,bug,pilip,unused,palap'), function() {
     lib.clearRequestMocks();
     lib.mockRequest('/api/l10n/index', '{}');
     lib.mockRequestFromFile('/api/rules/app', 'app_admin.json');
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules/app.json b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules/app.json
new file mode 100644 (file)
index 0000000..4f3319c
--- /dev/null
@@ -0,0 +1,168 @@
+{
+  "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": {
+    "UNDERSTANDABILITY": "Maintainability: Understandability",
+    "MAINTAINABILITY": "Maintainability",
+    "TIME_ZONE_RELATED_PORTABILITY": "Portability: Time zone related portability",
+    "READABILITY": "Maintainability: Readability",
+    "SECURITY_FEATURES": "Security: Security features",
+    "ARCHITECTURE_RELIABILITY": "Reliability: Architecture related reliability",
+    "OS_RELATED_PORTABILITY": "Portability: OS related portability",
+    "EXCEPTION_HANDLING": "Reliability: Exception handling",
+    "LOGIC_CHANGEABILITY": "Changeability: Logic related changeability",
+    "SOFTWARE_RELATED_PORTABILITY": "Portability: Software related portability",
+    "INPUT_VALIDATION_AND_REPRESENTATION": "Security: Input validation and representation",
+    "LANGUAGE_RELATED_PORTABILITY": "Portability: Language related portability",
+    "ERRORS": "Security: Errors",
+    "SECURITY": "Security",
+    "RELIABILITY": "Reliability",
+    "PORTABILITY": "Portability",
+    "HARDWARE_RELATED_PORTABILITY": "Portability: Hardware related portability",
+    "SYNCHRONIZATION_RELIABILITY": "Reliability: Synchronization related reliability",
+    "TRANSPORTABILITY": "Reusability: Transportability",
+    "COMPILER_RELATED_PORTABILITY": "Portability: Compiler related portability",
+    "RESOURCE_RELIABILITY": "Reliability: Resource",
+    "CPU_EFFICIENCY": "Efficiency: Processor use",
+    "EFFICIENCY": "Efficiency",
+    "CHANGEABILITY": "Changeability",
+    "DATA_CHANGEABILITY": "Changeability: Data related changeability",
+    "API_ABUSE": "Security: API abuse",
+    "ARCHITECTURE_CHANGEABILITY": "Changeability: Architecture related changeability",
+    "UNIT_TESTS": "Reliability: Unit tests",
+    "INSTRUCTION_RELIABILITY": "Reliability: Instruction related reliability",
+    "REUSABILITY": "Reusability",
+    "MODULARITY": "Reusability: Modularity",
+    "UNIT_TESTABILITY": "Testability: Unit level testability",
+    "TESTABILITY": "Testability",
+    "INTEGRATION_TESTABILITY": "Testability: Integration level testability",
+    "NETWORK_USE": "Efficiency: Network use",
+    "MEMORY_EFFICIENCY": "Efficiency: Memory use",
+    "DATA_RELIABILITY": "Reliability: Data related reliability",
+    "FAULT_TOLERANCE": "Reliability: Fault tolerance",
+    "LOGIC_RELIABILITY": "Reliability: Logic related reliability"
+  }
+}
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules/search.json b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules/search.json
new file mode 100644 (file)
index 0000000..c17c58d
--- /dev/null
@@ -0,0 +1,371 @@
+{
+  "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"
+      ]
+    },
+    {
+      "key": "php:S107",
+      "name": "Functions should not have too many parameters",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "brain-overload"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S1192",
+      "name": "String literals should not be duplicated",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [],
+      "tags": []
+    },
+    {
+      "key": "php:S1145",
+      "name": "\"if\" statement conditions should not always evaluate to \"true\" or to \"false\"",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "bug",
+        "cwe",
+        "security"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S108",
+      "name": "Nested blocks of code should not be left empty",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [],
+      "tags": []
+    },
+    {
+      "key": "php:S1301",
+      "name": "\"switch\" statements should have at least 3 \"case\" clauses",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [],
+      "tags": []
+    },
+    {
+      "key": "php:S103",
+      "name": "Lines should not be too long",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "convention"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S1144",
+      "name": "Unused private method should be removed",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "unused"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S105",
+      "name": "Tabulation characters should not be used",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "convention",
+        "psr2"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S1481",
+      "name": "Unused local variables should be removed",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "unused"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S1142",
+      "name": "Functions should not contain too many return statements",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "brain-overload"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S104",
+      "name": "Files should not have too many lines",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "brain-overload"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S1605",
+      "name": "PHP 4 style calls to parent constructors should not be used in PHP5 \"__construct\" functions",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "convention"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S1448",
+      "name": "Classes should not have too many methods",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "brain-overload"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S1603",
+      "name": "PHP 4 constructor declarations should not be used",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "pitfail"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S1779",
+      "name": "Only LF character (Unix-like) should be used to end lines",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "convention",
+        "psr2"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S1185",
+      "name": "Overriding methods should do more than simply call the same method in the super class",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [],
+      "tags": []
+    },
+    {
+      "key": "php:S1600",
+      "name": "Deprecated predefined variables should not be used",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "pitfail"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S1109",
+      "name": "A close curly brace should be located at the beginning of a line",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "convention"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S2001",
+      "name": "Functions deprecated in PHP 5 should not be used",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "obsolete"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S2002",
+      "name": "Errors should not be silenced",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "pitfail"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S2000",
+      "name": "Files should not contain characters before \"<?php\"",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "user-experience"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S1105",
+      "name": "An open curly brace should be located at the end of a line",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "convention"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S1200",
+      "name": "Classes should not be coupled to too many other classes (Single Responsibility Principle)",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "brain-overload"
+      ],
+      "tags": []
+    },
+    {
+      "key": "php:S1106",
+      "name": "An open curly brace should be located at the beginning of a line",
+      "lang": "php",
+      "langName": "PHP",
+      "sysTags": [
+        "convention"
+      ],
+      "tags": []
+    }
+  ],
+  "facets": [
+    {
+      "property": "tags",
+      "values": [
+        {
+          "val": "convention",
+          "count": 67
+        },
+        {
+          "val": "brain-overload",
+          "count": 36
+        },
+        {
+          "val": "bug",
+          "count": 36
+        },
+        {
+          "val": "cwe",
+          "count": 17
+        },
+        {
+          "val": "unused",
+          "count": 16
+        },
+        {
+          "val": "security",
+          "count": 14
+        },
+        {
+          "val": "pitfall",
+          "count": 12
+        },
+        {
+          "val": "psr2",
+          "count": 12
+        },
+        {
+          "val": "error-handling",
+          "count": 11
+        },
+        {
+          "val": "pitfail",
+          "count": 10
+        }
+      ]
+    },
+    {
+      "property": "languages",
+      "values": [
+        {
+          "val": "java",
+          "count": 212
+        },
+        {
+          "val": "py",
+          "count": 212
+        },
+        {
+          "val": "php",
+          "count": 103
+        },
+        {
+          "val": "js",
+          "count": 77
+        }
+      ]
+    },
+    {
+      "property": "repositories",
+      "values": [
+        {
+          "val": "squid",
+          "count": 206
+        },
+        {
+          "val": "Pylint",
+          "count": 180
+        },
+        {
+          "val": "php",
+          "count": 97
+        },
+        {
+          "val": "javascript",
+          "count": 73
+        },
+        {
+          "val": "python",
+          "count": 28
+        },
+        {
+          "val": "common-java",
+          "count": 6
+        },
+        {
+          "val": "common-php",
+          "count": 6
+        },
+        {
+          "val": "manual",
+          "count": 5
+        },
+        {
+          "val": "common-js",
+          "count": 4
+        },
+        {
+          "val": "common-py",
+          "count": 4
+        }
+      ]
+    }
+  ]
+}
diff --git a/server/sonar-web/src/main/js/tests/e2e/views/coding-rules-old.jade b/server/sonar-web/src/main/js/tests/e2e/views/coding-rules-old.jade
new file mode 100644 (file)
index 0000000..cfdb7c9
--- /dev/null
@@ -0,0 +1,11 @@
+extends ./layouts/main
+
+block header
+  script(src='../js/require.js')
+  script.
+    window.waitForMocks('/js/coding-rules-old/app.js');
+
+block body
+  #content
+    #coding-rules-page-loader.navigator-page-loader
+      i.spinner
index cfdb7c9c011f5bd43490c968a4aaffe6797e47a9..6d79ffe695d723c6c66546ba88cae8a957b9683f 100644 (file)
@@ -3,9 +3,7 @@ extends ./layouts/main
 block header
   script(src='../js/require.js')
   script.
-    window.waitForMocks('/js/coding-rules-old/app.js');
+    window.waitForMocks('/js/coding-rules/app.js');
 
 block body
-  #content
-    #coding-rules-page-loader.navigator-page-loader
-      i.spinner
+  .coding-rules