Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

refactor(testing): split travis end to end tests into separate jobs for jquery and jqlite #6159

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ node_js:
env:
matrix:
- JOB=unit
- JOB=e2e-chrome
- JOB=e2e-firefox
- JOB=e2e-safari
- JOB=e2e BROWSER=chrome JQVERSION=jqlite
- JOB=e2e BROWSER=firefox JQVERSION=jqlite
- JOB=e2e BROWSER=safari JQVERSION=jqlite
- JOB=e2e BROWSER=chrome JQVERSION=jquery
- JOB=e2e BROWSER=firefox JQVERSION=jquery
- JOB=e2e BROWSER=safari JQVERSION=jquery
global:
- SAUCE_USERNAME=angular-ci
- SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987
Expand Down
2 changes: 2 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ module.exports = function(grunt) {

protractor: {
normal: 'protractor-conf.js',
jquery: 'protractor-jquery-conf.js',
jenkins: 'protractor-jenkins-conf.js'
},

Expand Down Expand Up @@ -292,6 +293,7 @@ module.exports = function(grunt) {
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:protractor', 'Run the end to end tests with Protractor and keep a test server running in the background', ['webdriver', 'connect:testserver', 'protractor:normal']);
grunt.registerTask('test:jq-protractor', 'Run the end to end tests against jquery with Protractor and keep a test server running in the background', ['webdriver', 'connect:testserver', 'protractor:jquery']);
grunt.registerTask('test:ci-protractor', 'Run the end to end tests with Protractor and keep a test server running in the background', ['webdriver', 'connect:testserver', 'protractor:jenkins']);
grunt.registerTask('test:e2e', 'Alias for test:protractor', ['test:protractor']);
grunt.registerTask('test:docgen', ['jasmine_node']);
Expand Down
5 changes: 4 additions & 1 deletion docs/src/gen-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ writer.makeDir('build/docs/', true).then(function() {
fileFutures.push(writer.output('partials/' + doc.section + '/' + id + '.html', doc.html()));
// If it has a sample Protractor test, output that as well.
if (doc.protractorTests.length) {
fileFutures.push(writer.output('ptore2e/' + doc.section + '/' + id + '_test.js', ngdoc.writeProtractorTest(doc)));
fileFutures.push(writer.output('ptore2e/' + doc.section + '/' + id + '.jquery_test.js',
ngdoc.writeProtractorTest(doc, 'index-jq-nocache.html#!/')));
fileFutures.push(writer.output('ptore2e/' + doc.section + '/' + id + '.jqlite_test.js',
ngdoc.writeProtractorTest(doc, 'index-nocache.html#!/')));
}
});

Expand Down
21 changes: 5 additions & 16 deletions docs/src/ngdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1110,28 +1110,17 @@ function scenarios(docs){
}
}

function writeProtractorTest(doc){
function writeProtractorTest(doc, pathPrefix){
var lines = [];
lines.push('describe("' + doc.section + '/' + doc.id + '", function() {');
lines.push(' describe("angular+jqLite", function() {')
lines.push(' beforeEach(function() {');
lines.push(' browser.get("index-nocache.html#!/' + doc.section + '/' + doc.id + '");');
lines.push(' });');
lines.push('');
doc.protractorTests.forEach(function(test){
lines.push(indentCode(trim(test), 4));
lines.push('');
});
lines.push(' beforeEach(function() {');
lines.push(' browser.get("' + pathPrefix + doc.section + '/' + doc.id + '");');
lines.push(' });');
lines.push(' describe("angular+jQuery", function() {')
lines.push(' beforeEach(function() {');
lines.push(' browser.get("index-jq-nocache.html#!/' + doc.section + '/' + doc.id + '");');
lines.push(' });');
lines.push('');
doc.protractorTests.forEach(function(test){
lines.push(indentCode(trim(test), 4));
lines.push(indentCode(trim(test), 0));
lines.push('');
});
lines.push(' });');
lines.push('});');
lines.push('');
return lines.join('\n');
Expand Down
5 changes: 3 additions & 2 deletions protractor-conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ exports.config = {
allScriptsTimeout: 11000,

specs: [
'build/docs/ptore2e/**/*.js',
'build/docs/ptore2e/**/*jqlite_test.js',
'test/e2e/docsAppE2E.js'
],

capabilities: {
'browserName': 'chrome'
'browserName': 'chrome',
'name': 'Angular E2E: jqlite'
},

baseUrl: 'http://localhost:8000/build/docs/',
Expand Down
32 changes: 32 additions & 0 deletions protractor-jquery-conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
exports.config = {
allScriptsTimeout: 11000,

specs: [
'build/docs/ptore2e/**/*jquery_test.js',
'test/e2e/docsAppE2E.js'
],

capabilities: {
'browserName': 'chrome',
'name': 'Angular E2E: jquery'
},

baseUrl: 'http://localhost:8000/build/docs/',

framework: 'jasmine',

onPrepare: function() {
// Disable animations so e2e tests run more quickly
var disableNgAnimate = function() {
angular.module('disableNgAnimate', []).run(function($animate) {
$animate.enabled(false);
});
};

browser.addMockModule('disableNgAnimate', disableNgAnimate);
},

jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
9 changes: 6 additions & 3 deletions scripts/travis/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
set -e

export SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev`
export BROWSER=${JOB#*-}

if [ $JOB = "unit" ]; then
grunt ci-checks
grunt test:docgen
grunt test:promises-aplus
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:protractor --sauceUser $SAUCE_USERNAME \
elif [ $JOB = "e2e" ]; then
export GRUNT_TARGET="test:protractor"
if [ $JQVERSION = "jquery" ]; then
GRUNT_TARGET="test:jq-protractor"
fi
grunt $GRUNT_TARGET --sauceUser $SAUCE_USERNAME \
--sauceKey $SAUCE_ACCESS_KEY \
--capabilities.tunnel-identifier=$TRAVIS_JOB_NUMBER \
--capabilities.build=$TRAVIS_BUILD_NUMBER \
Expand Down