aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-02-19 16:00:49 +0100
committerStas Vilchik <vilchiks@gmail.com>2015-02-19 16:00:49 +0100
commit095ff251fdf1a9b2e05e6fcf89e1bfd434c5e5fe (patch)
treed8367e0c8c8e7207d55c73d76f38cd4cc0e5d237
parentc55f7376c55e995fc597d4fd1a840721a158f6a7 (diff)
parent081b6c8395e6abe4568c670f6364d01046c7ead8 (diff)
downloadsonarqube-095ff251fdf1a9b2e05e6fcf89e1bfd434c5e5fe.tar.gz
sonarqube-095ff251fdf1a9b2e05e6fcf89e1bfd434c5e5fe.zip
Merge pull request #108 from SonarSource/feature/web/fast_tests
enable parallel execution of web tests
-rw-r--r--server/sonar-web/Gruntfile.coffee1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/lib.js5
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-active-severity-facet.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-available-since.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-inheritance-facet.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-no-available-profiles-for-activation.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-quality-profile-facet.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-query-facet.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-rule-should-have-permalink.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-activate-profile.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-create-custom-rules.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-create-manual-rules.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-delete-custom-rules.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-delete-manual-rules.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-custom-rules.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-deprecated-label.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-empty-list.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-facets.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rule-issues.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rule.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rules.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/design-spec.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/issues-page-should-open-issue-permalink.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/issues-page-spec.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/quality-gates-spec.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-create-manual-issue.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-favorite-spec.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-link-to-raw-spec.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-should-not-show-source-if-no-permission.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-should-open-in-new-window-with-line.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-should-open-in-new-window.js1
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-spec.js122
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/treemap-spec.js1
34 files changed, 159 insertions, 0 deletions
diff --git a/server/sonar-web/Gruntfile.coffee b/server/sonar-web/Gruntfile.coffee
index dd52e681784..fbb1f883bc3 100644
--- a/server/sonar-web/Gruntfile.coffee
+++ b/server/sonar-web/Gruntfile.coffee
@@ -331,6 +331,7 @@ module.exports = (grunt) ->
'no-colors': true
'fail-fast': true
concise: true
+ parallel: true
port: expressPort
src: ['<%= pkg.sources %>js/tests/e2e/tests/**/*.js']
single:
diff --git a/server/sonar-web/src/main/js/tests/e2e/lib.js b/server/sonar-web/src/main/js/tests/e2e/lib.js
index b72cdf432c8..a896501eb9a 100644
--- a/server/sonar-web/src/main/js/tests/e2e/lib.js
+++ b/server/sonar-web/src/main/js/tests/e2e/lib.js
@@ -42,6 +42,11 @@ exports.changeWorkingDirectory = function (dir) {
};
+exports.configureCasper = function () {
+ casper.options.waitTimeout = 30000;
+};
+
+
exports.testName = function () {
var head = Array.prototype.slice.call(arguments, 0);
return function () {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-active-severity-facet.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-active-severity-facet.js
index 53e57acd632..30a7f2bab9d 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-active-severity-facet.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-active-severity-facet.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-active-severity-facet');
+lib.configureCasper();
casper.test.begin('coding-rules-page-active-severity-facet', 7, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-available-since.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-available-since.js
index 5faadae7b1d..a8eebcc16c9 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-available-since.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-available-since.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-available-since');
+lib.configureCasper();
casper.test.begin('coding-rules-page-available-since', 2, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-inheritance-facet.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-inheritance-facet.js
index 01f720618b6..13a5f8020ce 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-inheritance-facet.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-inheritance-facet.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-inheritance-facet');
+lib.configureCasper();
casper.test.begin('coding-rules-page-inheritance-facet', 11, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-no-available-profiles-for-activation.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-no-available-profiles-for-activation.js
index abaed5e82a1..e0b87598c15 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-no-available-profiles-for-activation.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-no-available-profiles-for-activation.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-no-available-profiles-for-activation');
+lib.configureCasper();
casper.test.begin('coding-rules-page-no-available-profiles-for-activation', 2, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-quality-profile-facet.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-quality-profile-facet.js
index 4bcead8d45c..e0d84b86eef 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-quality-profile-facet.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-quality-profile-facet.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-quality-profile-facet');
+lib.configureCasper();
casper.test.begin('coding-rules-page-quality-profile-facet', 6, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-query-facet.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-query-facet.js
index a412d423382..e953bbb091f 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-query-facet.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-query-facet.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-query-facet');
+lib.configureCasper();
casper.test.begin('coding-rules-page-query-facet', 3, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-rule-should-have-permalink.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-rule-should-have-permalink.js
index 9d1e0171ef5..46c8b178f56 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-rule-should-have-permalink.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-rule-should-have-permalink.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-rule-permalink');
+lib.configureCasper();
casper.test.begin('coding-rules-page-rule-permalink', 1, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-activate-profile.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-activate-profile.js
index 8c5e05d8cb4..dc5c3e36d61 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-activate-profile.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-activate-profile.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-should-activate-profile');
+lib.configureCasper();
casper.test.begin('coding-rules-page-should-activate-profile', 5, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-create-custom-rules.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-create-custom-rules.js
index b0de4b2965f..d5cdd75e0a6 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-create-custom-rules.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-create-custom-rules.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-should-create-custom-rules');
+lib.configureCasper();
casper.test.begin('coding-rules-page-should-delete-create-rules', 2, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-create-manual-rules.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-create-manual-rules.js
index 86af5a83c42..60b144d1713 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-create-manual-rules.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-create-manual-rules.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-should-create-manual-rules');
+lib.configureCasper();
casper.test.begin('coding-rules-page-should-delete-manual-rules', 3, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-delete-custom-rules.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-delete-custom-rules.js
index 969919d7f9b..da134078c3a 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-delete-custom-rules.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-delete-custom-rules.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-should-delete-custom-rules');
+lib.configureCasper();
casper.test.begin('coding-rules-page-should-delete-custom-rules', 2, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-delete-manual-rules.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-delete-manual-rules.js
index 718feaaa276..3ef58eff9db 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-delete-manual-rules.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-delete-manual-rules.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-should-delete-manual-rules');
+lib.configureCasper();
casper.test.begin('coding-rules-page-should-delete-manual-rules', 1, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-custom-rules.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-custom-rules.js
index 3215bad5d5e..7698a660845 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-custom-rules.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-custom-rules.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-should-show-custom-rules');
+lib.configureCasper();
casper.test.begin('coding-rules-page-should-show-custom-rules', 3, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-deprecated-label.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-deprecated-label.js
index 66edd6e27cc..9b647a25a02 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-deprecated-label.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-deprecated-label.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-should-show-deprecated-label');
+lib.configureCasper();
casper.test.begin('coding-rules-page-should-show-deprecated-label', 1, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details.js
index 11fe3b595f0..63a641c31df 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-details.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-should-show-details');
+lib.configureCasper();
casper.test.begin('coding-rules-page-should-show-details', 20, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-empty-list.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-empty-list.js
index 5fedf40cfc9..63ba6f44544 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-empty-list.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-empty-list.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-should-show-empty-list');
+lib.configureCasper();
casper.test.begin('coding-rules-page-should-show-empty-list', 3, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-facets.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-facets.js
index 5fae7388ea5..e5ddaff2c24 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-facets.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-facets.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules');
+lib.configureCasper();
casper.test.begin('coding-rules-page-should-show-facets', 1, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rule-issues.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rule-issues.js
index dd52ba03187..2673e002063 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rule-issues.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rule-issues.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules-page-should-show-rule-issues');
+lib.configureCasper();
casper.test.begin('coding-rules-page-should-show-rule-issues', 5, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rule.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rule.js
index f4e71de5e8d..85bdb1a285a 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rule.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rule.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules');
+lib.configureCasper();
casper.test.begin('coding-rules-page-should-show-rule', 7, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rules.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rules.js
index 8b2fa3bceed..7ad9cf1a982 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rules.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-page-should-show-rules.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('coding-rules');
+lib.configureCasper();
casper.test.begin('coding-rules-page-should-show-rules', 4, function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/design-spec.js b/server/sonar-web/src/main/js/tests/e2e/tests/design-spec.js
index 9f8919d0494..fd0ba14832c 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/design-spec.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/design-spec.js
@@ -3,6 +3,7 @@ var lib = require('../lib'),
lib.initMessages();
lib.changeWorkingDirectory('design-spec');
+lib.configureCasper();
casper.test.begin(testName('Base'), function suite(test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/issues-page-should-open-issue-permalink.js b/server/sonar-web/src/main/js/tests/e2e/tests/issues-page-should-open-issue-permalink.js
index ca9d7a51984..f5580a998ca 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/issues-page-should-open-issue-permalink.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/issues-page-should-open-issue-permalink.js
@@ -5,6 +5,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('issues-page-should-open-issue-permalink');
+lib.configureCasper();
var issueKey = 'some-issue-key';
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/issues-page-spec.js b/server/sonar-web/src/main/js/tests/e2e/tests/issues-page-spec.js
index 7451e020a32..d8a92d8dbcb 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/issues-page-spec.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/issues-page-spec.js
@@ -6,6 +6,7 @@ var lib = require('../lib'),
lib.initMessages();
lib.changeWorkingDirectory('issues-spec');
+lib.configureCasper();
casper.test.begin(testName('Base'), function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/quality-gates-spec.js b/server/sonar-web/src/main/js/tests/e2e/tests/quality-gates-spec.js
index 6655b4eb9ac..41944ca27a7 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/quality-gates-spec.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/quality-gates-spec.js
@@ -4,6 +4,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('quality-gates-spec');
+lib.configureCasper();
casper.test.begin('Quality Gates', function suite (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-create-manual-issue.js b/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-create-manual-issue.js
index 050469da6b3..631c95cd18a 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-create-manual-issue.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-create-manual-issue.js
@@ -5,6 +5,7 @@ var lib = require('../lib'),
lib.initMessages();
lib.changeWorkingDirectory('source-viewer-create-manual-issue');
+lib.configureCasper();
casper.test.begin(testName('source-viewer-create-manual-issue'), function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-favorite-spec.js b/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-favorite-spec.js
index 3f268dfd64a..afca90859a6 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-favorite-spec.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-favorite-spec.js
@@ -5,6 +5,7 @@ var lib = require('../lib'),
lib.initMessages();
lib.changeWorkingDirectory('source-viewer-spec');
+lib.configureCasper();
casper.test.begin(testName('Mark as Favorite'), function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-link-to-raw-spec.js b/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-link-to-raw-spec.js
index d4ae21dff4f..1c696698b42 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-link-to-raw-spec.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-link-to-raw-spec.js
@@ -5,6 +5,7 @@ var lib = require('../lib'),
lib.initMessages();
lib.changeWorkingDirectory('source-viewer-spec');
+lib.configureCasper();
casper.test.begin(testName('Link to Raw'), function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-should-not-show-source-if-no-permission.js b/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-should-not-show-source-if-no-permission.js
index 49406ab01ee..363a63f5ebc 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-should-not-show-source-if-no-permission.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-should-not-show-source-if-no-permission.js
@@ -5,6 +5,7 @@ var lib = require('../lib'),
lib.initMessages();
lib.changeWorkingDirectory('source-viewer-should-not-show-source-if-no-permission');
+lib.configureCasper();
casper.test.begin(testName('source-viewer-should-not-show-source-if-no-permission'), function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-should-open-in-new-window-with-line.js b/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-should-open-in-new-window-with-line.js
index 1b39fdbbabe..ceaa0f3420e 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-should-open-in-new-window-with-line.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-should-open-in-new-window-with-line.js
@@ -5,6 +5,7 @@ var lib = require('../lib'),
lib.initMessages();
lib.changeWorkingDirectory('source-viewer-should-open-in-new-window');
+lib.configureCasper();
casper.test.begin(testName('source-viewer-should-open-in-new-window-with-line'), function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-should-open-in-new-window.js b/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-should-open-in-new-window.js
index 56cb84f2855..0f910958616 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-should-open-in-new-window.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-should-open-in-new-window.js
@@ -5,6 +5,7 @@ var lib = require('../lib'),
lib.initMessages();
lib.changeWorkingDirectory('source-viewer-should-open-in-new-window');
+lib.configureCasper();
casper.test.begin(testName('source-viewer-should-open-in-new-window'), function (test) {
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-spec.js b/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-spec.js
new file mode 100644
index 00000000000..45ab591bc39
--- /dev/null
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/source-viewer-spec.js
@@ -0,0 +1,122 @@
+/* global casper:false */
+
+
+var lib = require('../lib'),
+ testName = lib.testName('Source Viewer');
+
+lib.initMessages();
+lib.changeWorkingDirectory('source-viewer-spec');
+lib.configureCasper();
+
+
+casper.test.begin(testName('Base'), function (test) {
+ casper
+ .start(lib.buildUrl('source-viewer'), function () {
+ lib.setDefaultViewport();
+
+ lib.mockRequest('/api/l10n/index', '{}');
+ lib.mockRequestFromFile('/api/components/app', 'app.json');
+ lib.mockRequestFromFile('/api/sources/lines', 'lines.json');
+ lib.mockRequestFromFile('/api/issues/search', 'issues.json');
+ })
+
+ .then(function () {
+ casper.waitForSelector('.source-line', function () {
+ // Check header elements
+ test.assertExists('.source-viewer-header');
+ test.assertSelectorContains('.source-viewer-header', 'SonarQube');
+ test.assertSelectorContains('.source-viewer-header', 'SonarQube :: Batch');
+ test.assertSelectorContains('.source-viewer-header', 'src/main/java/org/sonar/batch/index/Cache.java');
+ test.assertExists('.source-viewer-header .js-favorite');
+ test.assertExists('.source-viewer-header-actions');
+
+ // Check main measures
+ // FIXME enable lines check
+ //test.assertSelectorContains('.source-viewer-header-measure', '379');
+ test.assertSelectorContains('.source-viewer-header-measure', 'A');
+ test.assertSelectorContains('.source-viewer-header-measure', '2h 10min');
+ test.assertSelectorContains('.source-viewer-header-measure', '6');
+ test.assertSelectorContains('.source-viewer-header-measure', '74.3%');
+ test.assertSelectorContains('.source-viewer-header-measure', '5.8%');
+
+ // Check source
+ // FIXME enable source lines count check
+ //test.assertElementCount('.source-line', 518);
+ test.assertSelectorContains('.source-viewer', 'public class Cache');
+ });
+ })
+
+ .run(function () {
+ test.done();
+ });
+});
+
+
+casper.test.begin(testName('Decoration'), function (test) {
+ casper
+ .start(lib.buildUrl('source-viewer'), function () {
+ lib.setDefaultViewport();
+
+ lib.mockRequest('/api/l10n/index', '{}');
+ lib.mockRequestFromFile('/api/components/app', 'app.json');
+ lib.mockRequestFromFile('/api/sources/lines', 'lines.json');
+ lib.mockRequestFromFile('/api/issues/search', 'issues.json');
+ })
+
+ .then(function () {
+ casper.waitForSelector('.source-line');
+ })
+
+ .then(function () {
+ // Check issues decoration
+ test.assertElementCount('.has-issues', 6);
+ })
+
+ .then(function () {
+ // Check coverage decoration
+ test.assertElementCount('.source-line-covered', 142);
+ test.assertElementCount('.source-line-uncovered', 50);
+ test.assertElementCount('.source-line-partially-covered', 2);
+ })
+
+ .then(function () {
+ // Check duplications decoration
+ test.assertElementCount('.source-line-duplicated', 30);
+ })
+
+ .then(function () {
+ // Check scm decoration
+ test.assertElementCount('.source-line-scm-inner', 186);
+ test.assertExists('.source-line-scm-inner[data-author="simon.brandhof@gmail.com"]');
+ test.assertExists('.source-line-scm-inner[data-author="julien.henry@sonarsource.com"]');
+ })
+
+ .run(function () {
+ test.done();
+ });
+});
+
+
+casper.test.begin(testName('Test File'), function (test) {
+ casper
+ .start(lib.buildUrl('source-viewer'), function () {
+ lib.setDefaultViewport();
+
+ lib.mockRequest('/api/l10n/index', '{}');
+ lib.mockRequestFromFile('/api/components/app', 'tests/app.json');
+ lib.mockRequestFromFile('/api/sources/lines', 'tests/lines.json');
+ lib.mockRequestFromFile('/api/issues/search', 'issues.json');
+ })
+
+ .then(function () {
+ casper.waitForSelector('.source-line');
+ })
+
+ .then(function () {
+ test.assertSelectorContains('.source-viewer-header-measure', '6');
+ })
+
+ .run(function () {
+ test.done();
+ });
+});
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/treemap-spec.js b/server/sonar-web/src/main/js/tests/e2e/tests/treemap-spec.js
index 36b41eb7003..2da6d88f776 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/treemap-spec.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/treemap-spec.js
@@ -2,6 +2,7 @@ var lib = require('../lib');
lib.initMessages();
lib.changeWorkingDirectory('treemap-spec');
+lib.configureCasper();
casper.test.begin('Treemap', function (test) {