casper.evaluate(function() {
jQuery.mockjaxClear();
});
-}
+};
exports.clearRequestMock = function (mockId) {
casper.evaluate(function(mockId) {
jQuery.mockjaxClear(mockId);
}, mockId);
-}
+};
exports.buildUrl = function (urlTail) {
exports.capture = function (fileName) {
+ if (!fileName) {
+ fileName = 'screenshot.png';
+ }
casper.capture(fileName, { top: 0, left: 0, width: WINDOW_WIDTH, height: WINDOW_HEIGHT });
};
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();
+ });
+});
--- /dev/null
+{
+ "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"
+ ]
+ }
+}
--- /dev/null
+{
+ "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"
+ ]
+ }
+}
--- /dev/null
+{
+ "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"
+ ]
+ }
+}