aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-07-25 15:04:38 +0200
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-07-25 15:27:39 +0200
commit4e21ed56063352cf19d5709b28545112dffe3a9d (patch)
tree911e455e126b29ac65621427cde72ea0f15112ac /server/sonar-web
parent1ad33ceca51ff8ab54809465d5b14cf0faaed46d (diff)
downloadsonarqube-4e21ed56063352cf19d5709b28545112dffe3a9d.tar.gz
sonarqube-4e21ed56063352cf19d5709b28545112dffe3a9d.zip
Add frontend tests on rule parameters and debt info on rules page
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/hbs/coding-rules/coding-rules-detail.hbs25
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec.js29
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec/show_x1.json13
3 files changed, 39 insertions, 28 deletions
diff --git a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-detail.hbs b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-detail.hbs
index f839bb8963c..b64e0c037ef 100644
--- a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-detail.hbs
+++ b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-detail.hbs
@@ -49,31 +49,6 @@
{{/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}}
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec.js
index e2cf097fab7..bc7a0cb2fd6 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec.js
@@ -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;
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec/show_x1.json b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec/show_x1.json
index e3c47578ff2..d360d7b4730 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec/show_x1.json
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec/show_x1.json
@@ -38,7 +38,20 @@
{
"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"
}
]
},