mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-01-12 22:45:52 +08:00
chore(travis): reorganize protractor configs to group by spec instead of by browser
Use the multiConfiguration ability of Protractor to start tests on multiple browsers from the same travis cell. Group tests by type (jquery, jqlite, or docs tests) instead of by browser. Turn on tests for jQuery.
This commit is contained in:
@@ -9,12 +9,9 @@ branches:
|
||||
env:
|
||||
matrix:
|
||||
- JOB=unit
|
||||
- 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
|
||||
- JOB=e2e TEST_TARGET=jqlite
|
||||
- JOB=e2e TEST_TARGET=jquery
|
||||
- JOB=e2e TEST_TARGET=doce2e
|
||||
global:
|
||||
- SAUCE_USERNAME=angular-ci
|
||||
- SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987
|
||||
|
||||
@@ -92,7 +92,7 @@ module.exports = function(grunt) {
|
||||
|
||||
protractor: {
|
||||
normal: 'protractor-conf.js',
|
||||
jquery: 'protractor-jquery-conf.js',
|
||||
travis: 'protractor-travis-conf.js',
|
||||
jenkins: 'protractor-jenkins-conf.js'
|
||||
},
|
||||
|
||||
@@ -293,8 +293,8 @@ 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:travis-protractor', 'Run the end to end tests with Protractor for Travis CI builds', ['connect:testserver', 'protractor:travis']);
|
||||
grunt.registerTask('test:ci-protractor', 'Run the end to end tests with Protractor for Jenkins CI builds', ['webdriver', 'connect:testserver', 'protractor:jenkins']);
|
||||
grunt.registerTask('test:e2e', 'Alias for test:protractor', ['test:protractor']);
|
||||
grunt.registerTask('test:promises-aplus',['build:promises-aplus-adapter','shell:promises-aplus-tests']);
|
||||
|
||||
|
||||
@@ -5,6 +5,26 @@ var trimIndentation = require('dgeni/lib/utils/trim-indentation');
|
||||
var code = require('dgeni/lib/utils/code');
|
||||
var protractorFolder;
|
||||
|
||||
function createProtractorDoc(example, file, env) {
|
||||
var protractorDoc = {
|
||||
docType: 'e2e-test',
|
||||
id: 'protractorTest' + '-' + example.id,
|
||||
template: 'protractorTests.template.js',
|
||||
outputPath: path.join(protractorFolder, example.id, env + '_test.js'),
|
||||
innerTest: file.fileContents,
|
||||
pathPrefix: '.', // Hold for if we test with full jQuery
|
||||
exampleId: example.id,
|
||||
description: example.doc.id
|
||||
};
|
||||
|
||||
if (env === 'jquery') {
|
||||
protractorDoc.examplePath = example.outputFolder + '/index-jquery.html'
|
||||
} else {
|
||||
protractorDoc.examplePath = example.outputFolder + '/index.html'
|
||||
}
|
||||
return protractorDoc;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: 'protractor-generate',
|
||||
description: 'Generate a protractor test file from the e2e tests in the examples',
|
||||
@@ -23,22 +43,9 @@ module.exports = {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a new file for the test.
|
||||
// TODO - at the moment, only jqLite is being used. Will need to generate
|
||||
// another doc for jQuery if we want to test against that.
|
||||
var protractorDoc = {
|
||||
docType: 'e2e-test',
|
||||
id: 'protractorTest' + '-' + example.id,
|
||||
template: 'protractorTests.template.js',
|
||||
outputPath: path.join(protractorFolder, example.id, 'jqlite' + '_test.js'),
|
||||
innerTest: file.fileContents,
|
||||
pathPrefix: '.', // Hold for if we test with full jQuery
|
||||
exampleId: example.id,
|
||||
description: example.doc.id,
|
||||
examplePath: example.outputFolder + '/index.html'
|
||||
};
|
||||
|
||||
docs.push(protractorDoc);
|
||||
// Create new files for the tests.
|
||||
docs.push(createProtractorDoc(example, file, 'jquery'));
|
||||
docs.push(createProtractorDoc(example, file, 'jqlite'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -247,14 +247,15 @@ module.exports = {
|
||||
var tunnelIdentifier = grunt.option('capabilities.tunnel-identifier');
|
||||
var sauceBuild = grunt.option('capabilities.build');
|
||||
var browser = grunt.option('browser');
|
||||
var specs = grunt.option('specs');
|
||||
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);
|
||||
if (specs) args.push('--specs=' + specs);
|
||||
if (browser) {
|
||||
args.push('--browser=' + browser);
|
||||
args.push('--params.browser=' + browser);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
"karma-sauce-launcher": "0.2.0",
|
||||
"karma-script-launcher": "0.1.0",
|
||||
"karma-browserstack-launcher": "0.0.7",
|
||||
"protractor": "~0.18.0",
|
||||
"protractor": "~0.19.0",
|
||||
"yaml-js": "~0.0.8",
|
||||
"rewire": "1.1.3",
|
||||
"promises-aplus-tests": "~1.3.2",
|
||||
|
||||
@@ -1,32 +1,12 @@
|
||||
exports.config = {
|
||||
allScriptsTimeout: 11000,
|
||||
var config = require('./protractor-shared-conf').config;
|
||||
|
||||
specs: [
|
||||
'build/docs/ptore2e/**/*jqlite_test.js',
|
||||
'test/e2e/docsAppE2E.js'
|
||||
],
|
||||
config.specs = [
|
||||
'build/docs/ptore2e/**/*.js',
|
||||
'test/e2e/docsAppE2E.js'
|
||||
];
|
||||
|
||||
capabilities: {
|
||||
'browserName': 'chrome',
|
||||
'name': 'Angular E2E: jqlite'
|
||||
},
|
||||
|
||||
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
|
||||
}
|
||||
config.capabilities = {
|
||||
browserName: 'chrome',
|
||||
};
|
||||
|
||||
exports.config = config;
|
||||
|
||||
@@ -1,16 +1,6 @@
|
||||
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',
|
||||
@@ -24,6 +14,11 @@ exports.config = {
|
||||
};
|
||||
|
||||
browser.addMockModule('disableNgAnimate', disableNgAnimate);
|
||||
|
||||
// Store the name of the browser that's currently being used.
|
||||
browser.getCapabilities().then(function(caps) {
|
||||
browser.params.browser = caps.get('browserName');
|
||||
});
|
||||
},
|
||||
|
||||
jasmineNodeOpts: {
|
||||
25
protractor-travis-conf.js
Normal file
25
protractor-travis-conf.js
Normal file
@@ -0,0 +1,25 @@
|
||||
var config = require('./protractor-shared-conf').config;
|
||||
|
||||
config.sauceUser = process.env.SAUCE_USERNAME;
|
||||
config.sauceKey = process.env.SAUCE_ACCESS_KEY;
|
||||
|
||||
config.multiCapabilities = [{
|
||||
'browserName': 'chrome',
|
||||
'name': 'Angular E2E',
|
||||
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
|
||||
'build': process.env.TRAVIS_BUILD_NUMBER
|
||||
}, {
|
||||
'browserName': 'firefox',
|
||||
'name': 'Angular E2E',
|
||||
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
|
||||
'build': process.env.TRAVIS_BUILD_NUMBER
|
||||
}, {
|
||||
browserName: 'safari',
|
||||
'platform': 'OS X 10.9',
|
||||
'version': '7',
|
||||
'name': 'Angular E2E',
|
||||
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
|
||||
'build': process.env.TRAVIS_BUILD_NUMBER
|
||||
}];
|
||||
|
||||
exports.config = config;
|
||||
@@ -10,15 +10,13 @@ if [ $JOB = "unit" ]; then
|
||||
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
|
||||
export GRUNT_TARGET="test:protractor"
|
||||
if [ $JQVERSION = "jquery" ]; then
|
||||
GRUNT_TARGET="test:jq-protractor"
|
||||
export TARGET_SPECS="build/docs/ptore2e/**/*jqlite_test.js"
|
||||
if [ $TEST_TARGET = "jquery" ]; then
|
||||
TARGET_SPECS="build/docs/ptore2e/**/*jquery_test.js"
|
||||
elif [ $TEST_TARGET = "doce2e" ]; then
|
||||
TARGET_SPECS="test/e2e/docsAppE2E.js"
|
||||
fi
|
||||
grunt $GRUNT_TARGET --sauceUser $SAUCE_USERNAME \
|
||||
--sauceKey $SAUCE_ACCESS_KEY \
|
||||
--capabilities.tunnel-identifier=$TRAVIS_JOB_NUMBER \
|
||||
--capabilities.build=$TRAVIS_BUILD_NUMBER \
|
||||
--browser=$BROWSER
|
||||
grunt test:travis-protractor --specs "$TARGET_SPECS"
|
||||
else
|
||||
echo "Unknown job type. Please set JOB=unit or JOB=e2e-*."
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user