]> source.dussan.org Git - sonarqube.git/commitdiff
Add frontend tests on rule parameters and debt info on rules page
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Fri, 25 Jul 2014 13:04:38 +0000 (15:04 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Fri, 25 Jul 2014 13:27:39 +0000 (15:27 +0200)
server/sonar-web/src/main/hbs/coding-rules/coding-rules-detail.hbs
server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec.js
server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec/show_x1.json

index f839bb8963cc7b53d8476887b32cb149e7d6b332..b64e0c037ef68683fc2073995c2e96559cb39066 100644 (file)
   {{/if}}
 </ul>
 
-{{#if subcharacteristic}}
-<div class="coding-rules-subcharacteristic-more inline-help">
-  <ul>
-    {{#if debtRemFnType}}
-    <li>
-      <h3>{{t 'coding_rules.remediation_function'}}</h3>
-      {{t 'coding_rules.remediation_function' debtRemFnType}}
-    </li>
-    {{/if}}
-    {{#if debtRemFnCoeff}}
-    <li>
-      <h3>{{t 'coding_rules.remediation_function.coeff'}}</h3>
-      {{debtRemFnCoeff}}
-    </li>
-    {{/if}}
-    {{#if debtRemFnOffset}}
-    <li>
-      <h3>{{t 'coding_rules.remediation_function.offset'}}</h3>
-      {{debtRemFnOffset}}
-    </li>
-    {{/if}}
-  </ul>
-</div>
-{{/if}}
-
 <div class="coding-rules-detail-description rule-desc markdown">{{{htmlDesc}}}</div>
 
 {{#if isEditable}}
index e2cf097fab7f48e826a4db57bb4e10dc3ae92869..bc7a0cb2fd616f0799954cc4381a84784463e951 100644 (file)
@@ -1,11 +1,12 @@
-var lib = require('../lib');
+var lib = require('../lib'),
+    testName = lib.testName('Coding Rules');
 
 
 lib.initMessages();
 lib.changeWorkingDirectory('coding-rules-spec');
 
 
-casper.test.begin('Coding Rules - Readonly Tests', function suite(test) {
+casper.test.begin(testName('Readonly Tests'), function suite(test) {
 
   var appId = null;
   var showId = null;
@@ -44,6 +45,7 @@ casper.test.begin('Coding Rules - Readonly Tests', function suite(test) {
       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');
@@ -53,7 +55,28 @@ casper.test.begin('Coding Rules - Readonly Tests', function suite(test) {
       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]');
+      });
     });
   });
 
@@ -75,7 +98,7 @@ casper.test.begin('Coding Rules - Readonly Tests', function suite(test) {
   });
 });
 
-casper.test.begin('Coding Rules - Admin Tests', function suite(test) {
+casper.test.begin(testName('Admin Tests'), function suite(test) {
 
   var showId = null;
   var updateId = null;
index e3c47578ff2183014001405484dfd43b3828c73e..d360d7b4730139ea9f8b6f9f7c9b0465bfcf0f0b 100644 (file)
       {
         "key": "acceptWhitespace",
         "htmlDesc": "<h1>Accept whitespace (<code>\\s|\\t</code>) on the line\n</h1>This property is available so that a line containing only whitespace is not considered empty.<br/><h2>Example with property set to ``false``\n</h2><pre lang=\"xoo\"><code> &lt;- One issue here\n&lt;- And one here</code></pre><br/><br/><h2>Example with property set to ``true``\n</h2><pre lang=\"xoo\"><code> &lt;- No issue here\n&lt;- But one here</code></pre><br/>",
+        "type": "BOOLEAN",
         "defaultValue": "false"
+      },
+      {
+        "key": "textParameter",
+        "htmlDesc": "This is a parameter of type TEXT",
+        "type": "TEXT",
+        "defaultValue": "false"
+      },
+      {
+        "key": "skipLines",
+        "htmlDesc": "Skip a number of lines at the beginning of the file",
+        "type": "INTEGER",
+        "defaultValue": "0"
       }
     ]
   },