Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
fix(protractor): updating gulp-protractor
Browse files Browse the repository at this point in the history
  • Loading branch information
lirantal committed Apr 8, 2017
1 parent e5d7f15 commit 75af262
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 9 deletions.
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@ before_install:
- gem install sass --version "=3.3.7"
- npm i nsp -g
- npm i snyk -g
- npm install protractor
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- 'node_modules/protractor/bin/webdriver-manager update --standalone --firefox'
- 'node_modules/protractor/bin/webdriver-manager start 2>&1 &'
- export DISPLAY=:99.0
- bash scripts/setup-protractor.sh
- sleep 3
#before_script:
# - snyk auth $SNYK_TOKEN
Expand Down
41 changes: 38 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,23 @@ gulp.task('env:prod', function () {

// Nodemon task
gulp.task('nodemon', function () {

var nodeVersions = process.versions;
var debugArgument = '--debug';
switch (nodeVersions.node.substr(0, 1)) {
case '4':
case '5':
case '6':
debugArgument = '--debug';
break;
case '7':
debugArgument = '--inspect';
break;
}

return plugins.nodemon({
script: 'server.js',
nodeArgs: ['--inspect'],
nodeArgs: [debugArgument],
ext: 'js,html',
verbose: true,
watch: _.union(defaultAssets.server.views, defaultAssets.server.allJS, defaultAssets.server.config)
Expand Down Expand Up @@ -371,8 +385,29 @@ gulp.task('dropdb', function (done) {
});
});

// Downloads the selenium webdriver
gulp.task('webdriver_update', webdriver_update);
// Downloads the selenium webdriver if protractor version is compatible
gulp.task('webdriver_update', function() {
var nodeVersions = process.versions;
switch (nodeVersions.node.substr(0, 1)) {
case '4':
case '5':
console.log('E2E testing doesnt support v4 and v5');
process.exit(0);
break;
case '6':
if (parseInt(nodeVersions.node.substr(1, 1), 10) < 9) {
console.log('E2E testing with latest protractor requires v >= 6.9 ');
process.exit(0);
}
break;
default:
console.log('Detecting support for protractor E2E tests');
break;
}

return webdriver_update;
});


// Start the standalone selenium server
// NOTE: This is not needed if you reference the
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"gulp-mocha": "~3.0.1",
"gulp-ng-annotate": "~2.0.0",
"gulp-nodemon": "~2.2.1",
"gulp-protractor": "~3.0.0",
"gulp-protractor": "^4.1.0",
"gulp-refresh": "~1.1.0",
"gulp-rename": "~1.2.2",
"gulp-rev": "^7.1.2",
Expand Down
10 changes: 10 additions & 0 deletions scripts/setup-protractor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash -x

if [[ "$TRAVIS_NODE_VERSION" == "6" || "$TRAVIS_NODE_VERSION" == "7" ]]
then
npm install protractor
export DISPLAY=:99.0
bash -e /etc/init.d/xvfb start
./node_modules/protractor/bin/webdriver-manager update --standalone --firefox
./node_modules/protractor/bin/webdriver-manager start 2>&1 &
fi

0 comments on commit 75af262

Please sign in to comment.