aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-08-12 16:11:07 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-08-12 16:11:07 +0200
commitf14a07796a04815dabde6f357de3ac87e5344d4a (patch)
treeb402f1f34b3cf4195f76f840aa03b2c36c45179a
parent6e1cc1358f85d6ec644c972c0425b961b2a4346c (diff)
downloadsonarqube-f14a07796a04815dabde6f357de3ac87e5344d4a.tar.gz
sonarqube-f14a07796a04815dabde6f357de3ac87e5344d4a.zip
SONAR-6764 add web tests
-rw-r--r--server/sonar-web/src/test/json/source-viewer-spec/issues-with-precise-location.json173
-rw-r--r--server/sonar-web/test/intern.js3
-rw-r--r--server/sonar-web/test/medium/source-viewer.spec.js33
3 files changed, 208 insertions, 1 deletions
diff --git a/server/sonar-web/src/test/json/source-viewer-spec/issues-with-precise-location.json b/server/sonar-web/src/test/json/source-viewer-spec/issues-with-precise-location.json
new file mode 100644
index 00000000000..706d0868793
--- /dev/null
+++ b/server/sonar-web/src/test/json/source-viewer-spec/issues-with-precise-location.json
@@ -0,0 +1,173 @@
+{
+ "total": 3,
+ "p": 1,
+ "ps": 500,
+ "paging": {
+ "pageIndex": 1,
+ "pageSize": 500,
+ "total": 3
+ },
+ "issues": [
+ {
+ "key": "00c52e57-1e71-4079-aee3-19004bc30899",
+ "rule": "c:S1764",
+ "severity": "CRITICAL",
+ "component": "com.sonarsource.samples:multiple-issue-locations:src/main/c/identical-expressions.c",
+ "componentId": 1875,
+ "project": "com.sonarsource.samples:multiple-issue-locations",
+ "subProject": "com.sonarsource.samples:multiple-issue-locations",
+ "line": 3,
+ "textRange": {
+ "startLine": 3,
+ "endLine": 3,
+ "startOffset": 24,
+ "endOffset": 29
+ },
+ "secondaryLocations": [
+ {
+ "textRange": {
+ "startLine": 3,
+ "endLine": 3,
+ "startOffset": 15,
+ "endOffset": 20
+ }
+ }
+ ],
+ "executionFlows": [],
+ "status": "OPEN",
+ "message": "Identical sub-expressions on both sides of operator \"||\"",
+ "debt": "2min",
+ "author": "",
+ "tags": [
+ "bug",
+ "cert"
+ ],
+ "transitions": [
+ "confirm",
+ "resolve",
+ "falsepositive",
+ "wontfix"
+ ],
+ "actions": [
+ "comment",
+ "assign",
+ "set_tags",
+ "assign_to_me",
+ "plan",
+ "set_severity"
+ ],
+ "comments": [],
+ "creationDate": "2015-08-12T14:10:00+0200",
+ "updateDate": "2015-08-12T14:10:00+0200"
+ },
+ {
+ "key": "62f1a1f9-b2d0-4003-a774-81ad8668b7ff",
+ "rule": "c:S1764",
+ "severity": "CRITICAL",
+ "component": "com.sonarsource.samples:multiple-issue-locations:src/main/c/identical-expressions.c",
+ "componentId": 1875,
+ "project": "com.sonarsource.samples:multiple-issue-locations",
+ "subProject": "com.sonarsource.samples:multiple-issue-locations",
+ "line": 11,
+ "textRange": {
+ "startLine": 11,
+ "endLine": 11,
+ "startOffset": 6,
+ "endOffset": 11
+ },
+ "secondaryLocations": [
+ {
+ "textRange": {
+ "startLine": 10,
+ "endLine": 10,
+ "startOffset": 6,
+ "endOffset": 11
+ }
+ }
+ ],
+ "executionFlows": [],
+ "status": "OPEN",
+ "message": "Identical sub-expressions on both sides of operator \"||\"",
+ "debt": "2min",
+ "author": "",
+ "tags": [
+ "bug",
+ "cert"
+ ],
+ "transitions": [
+ "confirm",
+ "resolve",
+ "falsepositive",
+ "wontfix"
+ ],
+ "actions": [
+ "comment",
+ "assign",
+ "set_tags",
+ "assign_to_me",
+ "plan",
+ "set_severity"
+ ],
+ "comments": [],
+ "creationDate": "2015-08-12T14:10:00+0200",
+ "updateDate": "2015-08-12T14:10:00+0200"
+ },
+ {
+ "key": "4ea2b024-fc40-4050-ba36-1083bb09561a",
+ "rule": "c:S1764",
+ "severity": "CRITICAL",
+ "component": "com.sonarsource.samples:multiple-issue-locations:src/main/c/identical-expressions.c",
+ "componentId": 1875,
+ "project": "com.sonarsource.samples:multiple-issue-locations",
+ "subProject": "com.sonarsource.samples:multiple-issue-locations",
+ "line": 18,
+ "textRange": {
+ "startLine": 18,
+ "endLine": 19,
+ "startOffset": 13,
+ "endOffset": 9
+ },
+ "secondaryLocations": [
+ {
+ "textRange": {
+ "startLine": 17,
+ "endLine": 18,
+ "startOffset": 15,
+ "endOffset": 9
+ }
+ }
+ ],
+ "executionFlows": [],
+ "status": "OPEN",
+ "message": "Identical sub-expressions on both sides of operator \"||\"",
+ "debt": "2min",
+ "author": "",
+ "tags": [
+ "bug",
+ "cert"
+ ],
+ "transitions": [
+ "confirm",
+ "resolve",
+ "falsepositive",
+ "wontfix"
+ ],
+ "actions": [
+ "comment",
+ "assign",
+ "set_tags",
+ "assign_to_me",
+ "plan",
+ "set_severity"
+ ],
+ "comments": [],
+ "creationDate": "2015-08-12T14:10:00+0200",
+ "updateDate": "2015-08-12T14:10:00+0200"
+ }
+ ],
+ "components": [],
+ "rules": [],
+ "users": [],
+ "actionPlans": [],
+ "languages": []
+}
diff --git a/server/sonar-web/test/intern.js b/server/sonar-web/test/intern.js
index 16b5ff93c82..42049ab87db 100644
--- a/server/sonar-web/test/intern.js
+++ b/server/sonar-web/test/intern.js
@@ -27,7 +27,8 @@ define(['intern'], function (intern) {
'test/medium/computation.spec',
'test/medium/coding-rules.spec',
'test/medium/custom-measures.spec',
- 'test/medium/quality-profiles.spec'
+ 'test/medium/quality-profiles.spec',
+ 'test/medium/source-viewer.spec'
],
tunnel: tunnel,
diff --git a/server/sonar-web/test/medium/source-viewer.spec.js b/server/sonar-web/test/medium/source-viewer.spec.js
new file mode 100644
index 00000000000..27a5b96057f
--- /dev/null
+++ b/server/sonar-web/test/medium/source-viewer.spec.js
@@ -0,0 +1,33 @@
+define(function (require) {
+ var bdd = require('intern!bdd');
+ require('../helpers/test-page');
+
+ bdd.describe('Source Viewer', function () {
+ var file = { uuid: 'uuid', key: 'key' };
+
+ bdd.describe('Issues', function () {
+ bdd.it('should show precise issue location', function () {
+ return this.remote
+ .open()
+ .mockFromFile('/api/components/app', 'source-viewer-spec/app.json', { data: { uuid: 'uuid' } })
+ .mockFromFile('/api/sources/lines', 'source-viewer-spec/lines.json', { data: { uuid: 'uuid' } })
+ .mockFromFile('/api/issues/search',
+ 'source-viewer-spec/issues-with-precise-location.json',
+ { data: { componentUuids: 'uuid' } })
+ .startApp('source-viewer', { file: file })
+
+ .checkElementExist('.source-line-code[data-line-number="3"] .source-line-code-issue')
+ .checkElementInclude('.source-line-code[data-line-number="3"] .source-line-code-issue', '14 So')
+
+ .checkElementExist('.source-line-code[data-line-number="11"] .source-line-code-issue')
+ .checkElementInclude('.source-line-code[data-line-number="11"] .source-line-code-issue', 'arQub')
+
+ .checkElementExist('.source-line-code[data-line-number="18"] .source-line-code-issue')
+ .checkElementInclude('.source-line-code[data-line-number="18"] .source-line-code-issue',
+ 'ranklin Street, Fifth Floor, Boston, MA 02110-1301, USA.')
+ .checkElementExist('.source-line-code[data-line-number="19"] .source-line-code-issue')
+ .checkElementInclude('.source-line-code[data-line-number="19"] .source-line-code-issue', ' */');
+ });
+ });
+ });
+});