aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/test/helpers
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-07-03 13:50:56 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-07-03 18:12:13 +0200
commit1018747567d50056a49aa7c8421d596f18f25344 (patch)
tree085f099e653c887064456e34c4da80b861a39d3c /server/sonar-web/test/helpers
parent1a3fdbc0d14cf4d72142496df7ae8a7f14df1109 (diff)
downloadsonarqube-1018747567d50056a49aa7c8421d596f18f25344.tar.gz
sonarqube-1018747567d50056a49aa7c8421d596f18f25344.zip
make web tests more reliable
Diffstat (limited to 'server/sonar-web/test/helpers')
-rw-r--r--server/sonar-web/test/helpers/test-page.js24
1 files changed, 19 insertions, 5 deletions
diff --git a/server/sonar-web/test/helpers/test-page.js b/server/sonar-web/test/helpers/test-page.js
index cb7e770c89e..e38ad102907 100644
--- a/server/sonar-web/test/helpers/test-page.js
+++ b/server/sonar-web/test/helpers/test-page.js
@@ -5,13 +5,15 @@ define(function (require) {
var Command = require('intern/dojo/node!leadfoot/Command');
var pollUntil = require('intern/dojo/node!leadfoot/helpers/pollUntil');
+ var DEFAULT_TIMEOUT = 4000;
+
Command.prototype.checkElementCount = function (selector, count) {
return new this.constructor(this, function () {
return this.parent
.then(pollUntil(function (selector, count) {
var elements = document.querySelectorAll(selector);
return elements.length === count ? true : null;
- }, [selector, count]))
+ }, [selector, count], DEFAULT_TIMEOUT))
.then(function () {
}, function () {
@@ -26,7 +28,7 @@ define(function (require) {
.then(pollUntil(function (selector) {
var elements = document.querySelectorAll(selector);
return elements.length > 0 ? true : null;
- }, [selector]))
+ }, [selector], DEFAULT_TIMEOUT))
.then(function () {
}, function () {
@@ -41,7 +43,7 @@ define(function (require) {
.then(pollUntil(function (selector) {
var elements = document.querySelectorAll(selector);
return elements.length === 0 ? true : null;
- }, [selector]))
+ }, [selector], DEFAULT_TIMEOUT))
.then(function () {
}, function () {
@@ -59,7 +61,7 @@ define(function (require) {
return element.textContent.indexOf(text) !== -1;
});
return result ? true : null;
- }, [selector, text]))
+ }, [selector, text], DEFAULT_TIMEOUT))
.then(function () {
}, function () {
@@ -78,7 +80,7 @@ define(function (require) {
return element.textContent.indexOf(text) === -1;
});
return result ? true : null;
- }, [selector, text]))
+ }, [selector, text], DEFAULT_TIMEOUT))
.then(function () {
}, function () {
@@ -147,4 +149,16 @@ define(function (require) {
});
};
+ Command.prototype.open = function (hash) {
+ var url = 'test/medium/base.html?' + Date.now();
+ if (hash) {
+ url += hash;
+ }
+ return new this.constructor(this, function () {
+ return this.parent
+ .get(require.toUrl(url))
+ .checkElementExist('#content');
+ });
+ };
+
});