diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-06-18 11:16:00 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-06-18 11:16:07 +0200 |
commit | d370049974502061b852e73f25700c0d3bf218e6 (patch) | |
tree | a0f6ab394d11804f4a91e09add17ab5b68cec2e0 /server/sonar-web/src/test | |
parent | ff0de9e003be737aae3f76c0172f65665ce9b5a1 (diff) | |
download | sonarqube-d370049974502061b852e73f25700c0d3bf218e6.tar.gz sonarqube-d370049974502061b852e73f25700c0d3bf218e6.zip |
add web tests for maintenance app
Diffstat (limited to 'server/sonar-web/src/test')
4 files changed, 73 insertions, 0 deletions
diff --git a/server/sonar-web/src/test/js/maintenance-spec.js b/server/sonar-web/src/test/js/maintenance-spec.js new file mode 100644 index 00000000000..2f0891a4a96 --- /dev/null +++ b/server/sonar-web/src/test/js/maintenance-spec.js @@ -0,0 +1,58 @@ +/* global describe:false, it:false */ +var lib = require('../lib'); + +describe('Maintenance App', function () { + + it('should exist', 2, function (casper, test) { + return casper + .start(lib.buildUrl('maintenance'), function () { + lib.setDefaultViewport(); + lib.fmock('/api/system/status', 'status-up.json'); + }) + + .then(function () { + casper.evaluate(function () { + require(['apps/maintenance/app'], function (App) { + App.start({ el: '#maintenance', setup: false }); + }); + }); + }) + + .then(function () { + casper.waitForSelector('.maintenance-title'); + }) + + .then(function () { + test.assertExists('.maintenance-title'); + test.assertExists('.maintenance-text'); + }); + }); + + it('should change status', 1, function (casper, test) { + return casper + .start(lib.buildUrl('maintenance'), function () { + lib.setDefaultViewport(); + lib.fmock('/api/system/status', 'status-up.json'); + }) + + .then(function () { + casper.evaluate(function () { + require(['apps/maintenance/app'], function (App) { + App.start({ el: '#maintenance', setup: false }); + }); + }); + }) + + .then(function () { + casper.waitForSelector('.maintenance-title'); + }) + + .then(function () { + test.assertDoesntExist('.maintenance-title.text-danger'); + lib.clearRequestMocks(); + lib.fmock('/api/system/status', 'status-down.json'); + casper.waitForSelector('.maintenance-title.text-danger'); + }); + }); + +}); diff --git a/server/sonar-web/src/test/json/maintenance-spec/status-down.json b/server/sonar-web/src/test/json/maintenance-spec/status-down.json new file mode 100644 index 00000000000..1a1bd37fefc --- /dev/null +++ b/server/sonar-web/src/test/json/maintenance-spec/status-down.json @@ -0,0 +1,5 @@ +{ + "id": "1", + "version": "1.0", + "status": "DOWN" +} diff --git a/server/sonar-web/src/test/json/maintenance-spec/status-up.json b/server/sonar-web/src/test/json/maintenance-spec/status-up.json new file mode 100644 index 00000000000..b582c6d30c0 --- /dev/null +++ b/server/sonar-web/src/test/json/maintenance-spec/status-up.json @@ -0,0 +1,5 @@ +{ + "id": "1", + "version": "1.0", + "status": "UP" +} diff --git a/server/sonar-web/src/test/views/maintenance.jade b/server/sonar-web/src/test/views/maintenance.jade new file mode 100644 index 00000000000..a3fadf98edb --- /dev/null +++ b/server/sonar-web/src/test/views/maintenance.jade @@ -0,0 +1,5 @@ +extends layouts/main + +block body + #content + #maintenance |