aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/test
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-06-18 11:16:00 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-06-18 11:16:07 +0200
commitd370049974502061b852e73f25700c0d3bf218e6 (patch)
treea0f6ab394d11804f4a91e09add17ab5b68cec2e0 /server/sonar-web/src/test
parentff0de9e003be737aae3f76c0172f65665ce9b5a1 (diff)
downloadsonarqube-d370049974502061b852e73f25700c0d3bf218e6.tar.gz
sonarqube-d370049974502061b852e73f25700c0d3bf218e6.zip
add web tests for maintenance app
Diffstat (limited to 'server/sonar-web/src/test')
-rw-r--r--server/sonar-web/src/test/js/maintenance-spec.js58
-rw-r--r--server/sonar-web/src/test/json/maintenance-spec/status-down.json5
-rw-r--r--server/sonar-web/src/test/json/maintenance-spec/status-up.json5
-rw-r--r--server/sonar-web/src/test/views/maintenance.jade5
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