]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5718 Add issues MT
authorStas Vilchik <vilchiks@gmail.com>
Mon, 17 Nov 2014 13:28:32 +0000 (14:28 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 17 Nov 2014 13:28:32 +0000 (14:28 +0100)
server/sonar-web/src/main/js/tests/e2e/lib.js
server/sonar-web/src/main/js/tests/e2e/tests/issues-spec.js
server/sonar-web/src/main/js/tests/e2e/tests/issues-spec/show-open.json [new file with mode: 0644]
server/sonar-web/src/main/js/tests/e2e/tests/issues-spec/show-resolved.json [new file with mode: 0644]
server/sonar-web/src/main/js/tests/e2e/tests/issues-spec/show.json [new file with mode: 0644]

index 30b2b4aa88d0064747eb3650e460137ba251aa75..b91e405352d26cb9b56154d1b56a967cd8f20520 100644 (file)
@@ -67,14 +67,14 @@ exports.clearRequestMocks = function () {
   casper.evaluate(function() {
     jQuery.mockjaxClear();
   });
-}
+};
 
 
 exports.clearRequestMock = function (mockId) {
   casper.evaluate(function(mockId) {
     jQuery.mockjaxClear(mockId);
   }, mockId);
-}
+};
 
 
 exports.buildUrl = function (urlTail) {
@@ -88,6 +88,9 @@ exports.setDefaultViewport = function () {
 
 
 exports.capture = function (fileName) {
+  if (!fileName) {
+    fileName = 'screenshot.png';
+  }
   casper.capture(fileName, { top: 0, left: 0, width: WINDOW_WIDTH, height: WINDOW_HEIGHT });
 };
 
index b71d57f782c691ec5a5711dece79ae8297730170..906427153fc54b076f11ece5904026eaeba1bfa5 100644 (file)
@@ -101,3 +101,67 @@ casper.test.begin(testName('Issue Box', 'Check Elements'), function (test) {
         test.done();
       });
 });
+
+
+casper.test.begin(testName('Issue Box', 'Transitions'), function (test) {
+  casper
+      .start(lib.buildUrl('issues'), function () {
+        lib.setDefaultViewport();
+
+        lib.mockRequest('/api/l10n/index', '{}');
+        lib.mockRequestFromFile('/api/issue_filters/app', 'app.json');
+        lib.mockRequestFromFile('/api/issues/search', 'search.json');
+        this.showMock = lib.mockRequestFromFile('/api/issues/show*', 'show.json');
+        lib.mockRequest('/api/issues/do_transition', '{}');
+      })
+
+      .then(function () {
+        casper.waitForSelector('.issue.selected [data-transition=unconfirm]', function () {
+          test.assertExists('.issue.selected [data-transition=unconfirm]');
+          test.assertExists('.issue.selected [data-transition=resolve]');
+          test.assertExists('.issue.selected [data-transition=falsepositive]');
+          lib.clearRequestMock(this.showMock);
+          this.showMock = lib.mockRequestFromFile('/api/issues/show*', 'show-open.json');
+          casper.click('.issue.selected [data-transition=unconfirm]');
+        });
+      })
+
+      .then(function () {
+        casper.waitForSelector('.issue.selected [data-transition=confirm]', function () {
+          test.assertExists('.issue.selected [data-transition=resolve]');
+          test.assertExists('.issue.selected [data-transition=falsepositive]');
+          lib.clearRequestMock(this.showMock);
+          this.showMock = lib.mockRequestFromFile('/api/issues/show*', 'show-resolved.json');
+          casper.click('.issue.selected [data-transition=resolve]');
+        });
+      })
+
+      .then(function () {
+        casper.waitForSelector('.issue.selected [data-transition=reopen]', function () {
+          lib.clearRequestMock(this.showMock);
+          this.showMock = lib.mockRequestFromFile('/api/issues/show*', 'show-open.json');
+          casper.click('.issue.selected [data-transition=reopen]');
+        });
+      })
+
+      .then(function () {
+        casper.waitForSelector('.issue.selected [data-transition=confirm]', function () {
+          test.assertExists('.issue.selected [data-transition=confirm]');
+          test.assertExists('.issue.selected [data-transition=resolve]');
+          test.assertExists('.issue.selected [data-transition=falsepositive]');
+          lib.clearRequestMock(this.showMock);
+          this.showMock = lib.mockRequestFromFile('/api/issues/show*', 'show-resolved.json');
+          casper.click('.issue.selected [data-transition=falsepositive]');
+        });
+      })
+
+      .then(function () {
+        casper.waitForSelector('.issue.selected [data-transition=reopen]', function () {
+          test.assertExists('.issue.selected [data-transition=reopen]');
+        });
+      })
+
+      .run(function () {
+        test.done();
+      });
+});
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/issues-spec/show-open.json b/server/sonar-web/src/main/js/tests/e2e/tests/issues-spec/show-open.json
new file mode 100644 (file)
index 0000000..071d6bd
--- /dev/null
@@ -0,0 +1,28 @@
+{
+  "issue": {
+    "key": "94357807-fcb4-40cc-9598-9a715f1eee6e",
+    "component": "org.codehaus.sonar-plugins.xml:sonar-xml-plugin:src/main/java/org/sonar/plugins/xml",
+    "componentId": 26177,
+    "project": "org.codehaus.sonar-plugins.xml:xml",
+    "rule": "squid:S1228",
+    "status": "OPEN",
+    "severity": "MAJOR",
+    "message": "Add a 'package-info.java' file to document the 'src/main/java/org/sonar/plugins/xml' package",
+    "debt": "20min",
+    "creationDate": "2014-10-03T23:26:37+0200",
+    "updateDate": "2014-10-09T06:32:55+0200",
+    "fUpdateAge": "26 days",
+    "actions": [
+      "comment",
+      "assign",
+      "assign_to_me",
+      "plan",
+      "set_severity"
+    ],
+    "transitions": [
+      "confirm",
+      "resolve",
+      "falsepositive"
+    ]
+  }
+}
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/issues-spec/show-resolved.json b/server/sonar-web/src/main/js/tests/e2e/tests/issues-spec/show-resolved.json
new file mode 100644 (file)
index 0000000..f4eab74
--- /dev/null
@@ -0,0 +1,26 @@
+{
+  "issue": {
+    "key": "94357807-fcb4-40cc-9598-9a715f1eee6e",
+    "component": "org.codehaus.sonar-plugins.xml:sonar-xml-plugin:src/main/java/org/sonar/plugins/xml",
+    "componentId": 26177,
+    "project": "org.codehaus.sonar-plugins.xml:xml",
+    "rule": "squid:S1228",
+    "status": "RESOLVED",
+    "severity": "MAJOR",
+    "message": "Add a 'package-info.java' file to document the 'src/main/java/org/sonar/plugins/xml' package",
+    "debt": "20min",
+    "creationDate": "2014-10-03T23:26:37+0200",
+    "updateDate": "2014-10-09T06:32:55+0200",
+    "fUpdateAge": "26 days",
+    "actions": [
+      "comment",
+      "assign",
+      "assign_to_me",
+      "plan",
+      "set_severity"
+    ],
+    "transitions": [
+      "reopen"
+    ]
+  }
+}
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/issues-spec/show.json b/server/sonar-web/src/main/js/tests/e2e/tests/issues-spec/show.json
new file mode 100644 (file)
index 0000000..c125f5f
--- /dev/null
@@ -0,0 +1,28 @@
+{
+  "issue": {
+    "key": "94357807-fcb4-40cc-9598-9a715f1eee6e",
+    "component": "org.codehaus.sonar-plugins.xml:sonar-xml-plugin:src/main/java/org/sonar/plugins/xml",
+    "componentId": 26177,
+    "project": "org.codehaus.sonar-plugins.xml:xml",
+    "rule": "squid:S1228",
+    "status": "CONFIRMED",
+    "severity": "MAJOR",
+    "message": "Add a 'package-info.java' file to document the 'src/main/java/org/sonar/plugins/xml' package",
+    "debt": "20min",
+    "creationDate": "2014-10-03T23:26:37+0200",
+    "updateDate": "2014-10-09T06:32:55+0200",
+    "fUpdateAge": "26 days",
+    "actions": [
+      "comment",
+      "assign",
+      "assign_to_me",
+      "plan",
+      "set_severity"
+    ],
+    "transitions": [
+      "unconfirm",
+      "resolve",
+      "falsepositive"
+    ]
+  }
+}