Skip to content

Commit

Permalink
feat(spec): add spec argument to the protractor config, allows to fil…
Browse files Browse the repository at this point in the history
…ter tests to run

Closes angular#695
  • Loading branch information
tbosch committed Feb 23, 2015
1 parent f54f4e8 commit 0a0c0d8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ to the preprocessor and run the tests without exiting karma
4. `protractor protractor-dart2js.conf.js`: Dart2JS e2e tests

Angular specific command line options when running protractor:
`protractor protractor-{js|dart2js}-conf.js --ng-help`
- `protractor protractor-{js|dart2js}-conf.js --ng-help`

### Performance tests

Expand Down
30 changes: 22 additions & 8 deletions protractor-shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var argv = require('yargs')
type: 'boolean'
},
'force-gc': {
describe: 'force gc',
describe: 'force gc.',
default: false,
type: 'boolean'
},
Expand All @@ -19,8 +19,12 @@ var argv = require('yargs')
default: false
},
'browsers': {
describe: 'preconfigured browsers that should be used',
describe: 'comma separated list of preconfigured browsers to use',
default: 'ChromeDesktop'
},
'spec': {
describe: 'comma separated file patterns to test',
default: false
}
})
.help('ng-help')
Expand Down Expand Up @@ -95,6 +99,21 @@ var BROWSER_CAPS = {
}
};

var getBenchmarkFiles = function (benchmark, spec) {
var specFiles = [];
var perfFiles = [];
if (spec.length) {
spec.split(',').forEach(function (name) {
specFiles.push('dist/js/cjs/**/e2e_test/' + name)
perfFiles.push('dist/js/cjs/**/e2e_test/' + name)
});
} else {
specFiles.push('dist/js/cjs/**/e2e_test/**/*_spec.js');
perfFiles.push('dist/js/cjs/**/e2e_test/**/*_perf.js');
}
return benchmark ? perfFiles : specFiles.concat(perfFiles);
};

var config = exports.config = {
// Disable waiting for Angular as we don't have an integration layer yet...
// TODO(tbosch): Implement a proper debugging API for Ng2.0, remove this here
Expand All @@ -110,12 +129,7 @@ var config = exports.config = {
}
},

specs: argv['benchmark'] ? [
'dist/js/cjs/**/e2e_test/**/*_perf.js'
] : [
'dist/js/cjs/**/e2e_test/**/*_spec.js',
'dist/js/cjs/**/e2e_test/**/*_perf.js'
],
specs: getBenchmarkFiles(argv['benchmark'], argv['spec']),

exclude: [
'dist/js/cjs/**/node_modules/**',
Expand Down

0 comments on commit 0a0c0d8

Please sign in to comment.