diff options
Diffstat (limited to 'server/sonar-web/src/test/js')
-rw-r--r-- | server/sonar-web/src/test/js/maintenance-spec.js | 58 |
1 files changed, 58 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'); + }); + }); + +}); |