aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gruntfile.js9
-rwxr-xr-xjenkins_build.sh1
-rw-r--r--lib/grunt/plugins.js8
-rw-r--r--lib/grunt/utils.js32
-rw-r--r--package.json1
-rw-r--r--protractor-conf.js19
-rwxr-xr-xscripts/travis/build.sh4
7 files changed, 73 insertions, 1 deletions
diff --git a/Gruntfile.js b/Gruntfile.js
index 0127f2c4..203cc3be 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -101,6 +101,11 @@ module.exports = function(grunt) {
},
+ runprotractor: {
+ normal: 'protractor-conf.js'
+ },
+
+
clean: {
build: ['build'],
tmp: ['tmp']
@@ -283,13 +288,15 @@ module.exports = function(grunt) {
//alias tasks
- grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['jshint', 'package','test:unit','test:promises-aplus', 'tests:docs', 'test:e2e']);
+ grunt.registerTask('test', 'Run unit, docs and e2e tests with Karma', ['jshint', 'package','test:unit','test:promises-aplus', 'tests:docs', 'test:e2e', 'webdriver', 'runprotractor:normal']);
grunt.registerTask('test:jqlite', 'Run the unit tests with Karma' , ['tests:jqlite']);
grunt.registerTask('test:jquery', 'Run the jQuery unit tests with Karma', ['tests:jquery']);
grunt.registerTask('test:modules', 'Run the Karma module tests with Karma', ['tests:modules']);
grunt.registerTask('test:docs', 'Run the doc-page tests with Karma', ['package', 'tests:docs']);
grunt.registerTask('test:unit', 'Run unit, jQuery and Karma module tests with Karma', ['tests:jqlite', 'tests:jquery', 'tests:modules']);
grunt.registerTask('test:e2e', 'Run the end to end tests with Karma and keep a test server running in the background', ['connect:testserver', 'tests:end2end']);
+ // This should eventually replace test:e2e
+ grunt.registerTask('test:protractor', 'Run the end to end tests with Protractor and keep a test server running in the background', ['webdriver', 'connect:testserver', 'runprotractor:normal']);
grunt.registerTask('test:docgen', ['jasmine_node']);
grunt.registerTask('test:promises-aplus',['build:promises-aplus-adapter','shell:promises-aplus-tests']);
diff --git a/jenkins_build.sh b/jenkins_build.sh
index d4f66c11..60a702b4 100755
--- a/jenkins_build.sh
+++ b/jenkins_build.sh
@@ -36,6 +36,7 @@ grunt test:unit --browsers $BROWSERS --reporters=dots,junit --no-colors --no-col
# END TO END TESTS #
grunt test:e2e --browsers $BROWSERS_E2E --reporters=dots,junit --no-colors --no-color
+grunt test:protractor
# Promises/A+ TESTS #
grunt test:promises-aplus --no-color
diff --git a/lib/grunt/plugins.js b/lib/grunt/plugins.js
index 363b8698..a269cf82 100644
--- a/lib/grunt/plugins.js
+++ b/lib/grunt/plugins.js
@@ -61,6 +61,14 @@ module.exports = function(grunt) {
util.startKarma.call(util, this.data, false, this.async());
});
+ grunt.registerTask('webdriver', 'Update webdriver', function() {
+ util.updateWebdriver.call(util, this.async());
+ });
+
+ grunt.registerMultiTask('runprotractor', 'Run Protractor integration tests', function() {
+ util.startProtractor.call(util, this.data, this.async());
+ });
+
grunt.registerTask('collect-errors', 'Combine stripped error files', function () {
util.collectErrors();
});
diff --git a/lib/grunt/utils.js b/lib/grunt/utils.js
index 51ebcc70..7b772c34 100644
--- a/lib/grunt/utils.js
+++ b/lib/grunt/utils.js
@@ -84,6 +84,38 @@ module.exports = {
},
+ updateWebdriver: function(done){
+ var p = spawn('node', ['node_modules/protractor/bin/webdriver-manager', 'update']);
+ p.stdout.pipe(process.stdout);
+ p.stderr.pipe(process.stderr);
+ p.on('exit', function(code){
+ if(code !== 0) grunt.fail.warn('Webdriver failed to update');
+ done();
+ });
+ },
+
+ startProtractor: function(config, done){
+ var sauceUser = grunt.option('sauceUser');
+ var sauceKey = grunt.option('sauceKey');
+ var tunnelIdentifier = grunt.option('capabilities.tunnel-identifier');
+ var sauceBuild = grunt.option('capabilities.build');
+ var args = ['node_modules/protractor/bin/protractor', config];
+ if (sauceUser) args.push('--sauceUser=' + sauceUser);
+ if (sauceKey) args.push('--sauceKey=' + sauceKey);
+ if (tunnelIdentifier) args.push('--capabilities.tunnel-identifier=' + tunnelIdentifier);
+ if (sauceBuild) args.push('--capabilities.build=' + sauceBuild);
+
+
+ var p = spawn('node', args);
+ p.stdout.pipe(process.stdout);
+ p.stderr.pipe(process.stderr);
+ p.on('exit', function(code){
+ if(code !== 0) grunt.fail.warn('Protractor test(s) failed. Exit code: ' + code);
+ done();
+ });
+ },
+
+
wrap: function(src, name){
src.unshift('src/' + name + '.prefix');
src.push('src/' + name + '.suffix');
diff --git a/package.json b/package.json
index f706969a..798b9570 100644
--- a/package.json
+++ b/package.json
@@ -29,6 +29,7 @@
"karma-sauce-launcher": "0.2.0",
"karma-script-launcher": "0.1.0",
"karma-browserstack-launcher": "0.0.7",
+ "protractor": "~0.16.1",
"yaml-js": "~0.0.8",
"marked": "0.2.9",
"rewire": "1.1.3",
diff --git a/protractor-conf.js b/protractor-conf.js
new file mode 100644
index 00000000..4039d5fc
--- /dev/null
+++ b/protractor-conf.js
@@ -0,0 +1,19 @@
+exports.config = {
+ allScriptsTimeout: 11000,
+
+ specs: [
+ 'build/docs/ptore2e/**/*.js',
+ ],
+
+ capabilities: {
+ 'browserName': 'chrome'
+ },
+
+ baseUrl: 'http://localhost:8000/build/docs/',
+
+ framework: 'jasmine',
+
+ jasmineNodeOpts: {
+ defaultTimeoutInterval: 30000
+ }
+};
diff --git a/scripts/travis/build.sh b/scripts/travis/build.sh
index 6467bc1a..094859e6 100755
--- a/scripts/travis/build.sh
+++ b/scripts/travis/build.sh
@@ -11,6 +11,10 @@ if [ $JOB = "unit" ]; then
grunt test:unit --browsers SL_Chrome,SL_Safari,SL_Firefox,SL_IE_8,SL_IE_9,SL_IE_10,SL_IE_11 --reporters dots
elif [ $JOB = "e2e" ]; then
grunt test:e2e --browsers SL_Chrome --reporters dots
+ grunt test:protractor --sauceUser $SAUCE_USERNAME \
+ --sauceKey $SAUCE_ACCESS_KEY \
+ --capabilities.tunnel-identifier=$TRAVIS_JOB_NUMBER \
+ --capabilities.build=$TRAVIS_BUILD_NUMBER
else
echo "Unknown job type. Please set JOB=unit or JOB=e2e."
fi