rochejul / gulp-angular-protractor

Gulp plugin to run protractor tests
MIT License
25 stars 25 forks source link

Fails with Chrome 57 #41

Closed davidsulc closed 7 years ago

davidsulc commented 7 years ago

Seems to be the same issue as https://github.com/rochejul/gulp-angular-protractor/issues/26

The version of Chromedriver currently used (via the webdriver-manager dependency) is 2.25, which doesn't support Chrome 57.

Updating the webdriver-manager to version 12.0.4 should solve the issue, as it depends on Chromedriver v. 2.29

(It would also be helpful to update the protractor dependency, as the current version doesn't seem to work with the protractor-console-plugin package)

morozserg commented 7 years ago

+1. Tried to set in protractor config _seleniumServerJar: '/node_modules/protractor/nodemodules/webdriver-manager/selenium-server-standalone-3.3.1.jar', Didn't work. Could you please take a look. Some workaround needed. The best solution is to move protractor version to the latest one

guan01 commented 7 years ago

+1, would like to test latest Chrome version. Not urgent for me, please update dependency when you have a chance. thanks

fertavora commented 7 years ago

I tried to create a branch and push an update but I got a 403 error. Bascially, I updated package.json dependencies to "protractor": "5.1.1" Not sure if that fully helps but we can give it a try.

jrichter1 commented 7 years ago

Would this help? #42

fertavora commented 7 years ago

Go ahead and merge the PR. Thanks!

rochejul commented 7 years ago

Hi

I prefer doing the following stuff: https://github.com/rochejul/gulp-angular-protractor/issues/40#issuecomment-287297009

If I have some time in the next week, I will achieve it

Regards

fertavora commented 7 years ago

Makes sense, thanks!

benburton-se commented 7 years ago

Hi, is there a workaround for this? Rolling back Chrome is not supported

davidsulc commented 7 years ago

Hi @rochejul,

Yes, I think the proposed solution in #40 will be the best solution. But note that the version of webdriver-manager should also be possible to specify. In fact, (for this issue) it is more important to be able to specify the webdriver version than protractor: outdated webdriver versions seem to be the main issue with Chrome updates breaking testing setups. By making it possible to update the webdriver to follow Chrome updates, it should no longer be necessary to update gulp-angular-protractor for these cases.

fertavora commented 7 years ago

Why should webdriver-manager be handled as a different dependency? It comes within protractor so I guess using the latest protractor version it indeed uses latest webdriver-manager version.

davidsulc commented 7 years ago

But then you're once again dependent on the update schedule of somebody's package for your tests to be working. If you can use the webdrirver-manager version that you want, you can update as soon as Chrome introduces breaking changes, regardless of when the protractor package updates its own dependencies. Or am I missing something?

dannyskoog commented 7 years ago

@rochejul What's the status of what you talked about doing in your previous comment?

rochejul commented 7 years ago

@dannyskoog I try to deliver a 1.0.0 as soon as possible See https://github.com/rochejul/gulp-angular-protractor/tree/releases/1.0.0

Regards

dannyskoog commented 7 years ago

@rochejul Sounds great. Cheers!

benburton-se commented 7 years ago

Just upgraded to 1.0.0 and it's working for us. Thanks :)

rochejul commented 7 years ago

@benburton-capgemini you are welcome

fertavora commented 7 years ago

@benburton-capgemini How did you make it to work? I updated to 1.0.0 but it is still using Chrome Driver 2.26 🤔

rochejul commented 7 years ago

I think you should do first an npm uninstall of the plugin, install nexte the expected version of protractor and webdriver-manager, and then install the plugin

benburton-se commented 7 years ago

@fertavora killed running instances of Chrome/Chrome driver on build machine. Pushed the change to package.json for 1.0.0 and then npm install in the build did the rest. I've just tried the gulp task locally and it's working fine there also. If @rochejul's advice doesn't work, maybe try deleting your node_modules folder?

guan01 commented 7 years ago

Hi guys, first want to thanks for the big update. I am new and sorry for some newbie questions. I did the update and maybe I did the wrong step, please correct me. thanks in advance. Please help

  1. good baseline Chrome v53 and v0.4.2
  2. npm uninstall gulp-angular-protractor (and delete dir from node_modules)
  3. npm install --save-dev protractor (version 5.1.1)
  4. npm install --save-dev webdriver-manager (version 12.0.5) webdriver-manager start (no error)
  5. npm install --save-dev gulp-angular-protractor (version 1.0.0)
  6. run tests and compare with step 1.

1) [11:53:36] gulp-angular-protractor - Webdriver standalone server is started [11:53:36] gulp-angular-protractor - We will run the Protractor engine [11:53:36] I/launcher - Running 1 instances of WebDriver [11:53:36] E/local - Error code: 135 [11:53:36] E/local - Error message: No update-config.json found. Run 'webdriver-manager update' to download binaries. [11:53:36] E/local - Error: No update-config.json found. Run 'webdriver-manager update' to download binaries. at IError (C:\Automation\node_modules\protractor\built\exitCodes.js:5:1) at ProtractorError (C:\Automation\node_modules\protractor\built\exitCodes.js:10:9) at BrowserError (C:\Automation\nodemodules\protractor\built\exitCodes.js:51:9) at Local.addDefaultBinaryLocs (C:\Automation\node_modules\protractor\built\driverProviders\local.js:40:23) at Local.setupDriverEnv (C:\Automation\node_modules\protractor\built\driverProviders\local.js:81:14) at Local.setupEnv (C:\Automation\node_modules\protractor\built\driverProviders\driverProvider.js:110:34) at q.then (C:\Automation\node_modules\protractor\built\runner.js:334:41) at _fulfilled (C:\Automation\node_modules\protractor\node_modules\q\q.js:834:54) at self.promiseDispatch.done (C:\Automation\node_modules\protractor\node_modules\q\q.js:863:30) at Promise.promise.promiseDispatch (C:\Automation\node_modules\protractor\node_modules\q\q.js:796:13) [11:53:36] E/launcher - Process exited with error code 135 [11:53:37] gulp-angular-protractor - Webdriver standalone server is stopped { [Error: protractor exited with code 135] message: 'protractor exited with code 135', showStack: false, showProperties: true, plugin: 'gulp-angular-protractor', __safety: { toString: [Function: bound ] } } [11:53:37] 'e2e' errored after 3.28 s [11:53:37] Error in plugin 'gulp-angular-protractor' Message: protractor exited with code 135

rochejul commented 7 years ago

@guan01 Hi Maybe the downloaded version of protractor or webdriver need this file ?

In the readme, I show you a stable example:

{
  "name": "example-gulp-protractor",
  "version": "0.0.1",
  "description": "",
  "scripts": {
    "gulp": "node node_modules/gulp/bin/gulp.js",
    "test": "npm run gulp protractor"
  },
  "devDependencies": {
    "gulp": "latest",
    "gulp-angular-protractor": "latest",
    "protractor": "4.0.11",
    "webdriver-manager": "10.2.8"
  }
}

And said this:

Be carefull: some protractor and webdriver dependencies version required:

Some specific node version
Some specific npm version
Some specific browser version
...

Regards

guan01 commented 7 years ago

@rochejul, Many thanks, I was able to run your example. I am running into another issue which totally not related to the framework, but perhaps you can help point me in the right direction?

After changing the Gulpfile.js and protractor.conf.js I got an error that google show very few solutions. Here is the error:

[17:19:11] I/update - selenium standalone: v2.53.1 up to date [17:19:12] I/update - IEDriverServer: unzipping C:\e2e\node_modules\webdriver-manager\selenium\IEDriverServer_Win32_2.53.1.zip [17:19:12] I/update - IEDriverServer: unzipping C:\e2e\node_modules\webdriver-manager\selenium\IEDriverServer_Win32_2.53.1.zip [17:19:12] I/update - geckodriver: file exists C:\e2e\node_modules\webdriver-manager\selenium\geckodriver-v0.11.1-win64.zip [17:19:12] I/update - geckodriver: unzipping geckodriver-v0.11.1-win64.zip [17:19:12] I/update - geckodriver: vv0.11.1 up to date [17:19:12] gulp-angular-protractor - Webdriver standalone is updated [17:19:12] gulp-angular-protractor - Webdriver standalone server will be started [17:19:13] gulp-angular-protractor - Webdriver standalone server is started [17:19:13] gulp-angular-protractor - We will run the Protractor engine [17:19:13] I/local - Starting selenium standalone server... [17:19:13] I/launcher - Running 1 instances of WebDriver [17:19:14] I/local - Selenium standalone server started at http://192.168.201.134:58045/wd/hub [17:19:17] E/launcher - Error: C:\e2e\node_modules.bin\cucumber.js:2 basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')") ^^^^^^^ SyntaxError: missing ) after argument list at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:542:28) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at getDefinitions (C:\e2e\node_modules\cucumber\lib\cucumber\cli\profiles_loader.js:8:23) [17:19:17] E/launcher - Process exited with error code 100 [17:19:17] gulp-angular-protractor - Webdriver standalone server is stopped { [Error: protractor exited with code 100] message: 'protractor exited with code 100', showStack: false, showProperties: true, plugin: 'gulp-angular-protractor', __safety: { toString: [Function: bound ] } } [17:19:17] gulp-angular-protractor - Webdriver standalone server will be closed

C:\e2e>

===============gulp ============== /jshint node: true, camelcase: false/ /global require: true/

'use strict';

var gulp = require('gulp'), gulpProtractorAngular = require('gulp-angular-protractor'), tslint = require('gulp-tslint'), tsconfig = require('tsconfig-glob'), tscConfig = require('./tsconfig.json'), sourcemaps = require('gulp-sourcemaps'), typescript = require('gulp-typescript'), reporter = require('gulp-protractor-cucumber-html-report'), argv = require('yargs').argv, del = require('del');

// Setting up the test task gulp.task('e2e', function(callback) { gulp // .src(['example_spec.js']) .src(['/e2e/build/*/.feature']) .pipe(gulpProtractorAngular({ 'configFile': 'protractor.conf.js', 'debug': false, 'autoStartStopServer': true, 'verbose': false, 'webDriverUpdate': { 'browsers': ['ie'], 'args': ['--ie32'] }, 'webDriverStart': { 'args': ['--ie32'] } })) .on('error', function(e) { console.log(e); }) .on('end', callback); });

// clean the contents of the e2e/build directory gulp.task('clean-e2e', function () { return del('/e2e/build/*/'); });

// copy e2e files gulp.task('copy-e2e', ['clean-e2e'], function() { return gulp.src(['/e2e/app/*/', '!/e2e/app/*/.ts'], { base : '/e2e' }) .pipe(gulp.dest('/e2e/build')) });

// linting e2e gulp.task('tslint-e2e', function() { return gulp.src(['/e2e/app/*/.ts']) .pipe(tslint()) .pipe(tslint.report('verbose')); });

// TypeScript compile e2e gulp.task('compile-e2e', ['clean-e2e'], function () { return gulp .src(tscConfig.e2eFiles) .pipe(sourcemaps.init()) .pipe(typescript(tscConfig.compilerOptions)) .pipe(sourcemaps.write('.')) .pipe(gulp.dest('/e2e/build/app')); });

gulp.task('report', function () { return gulp .src('./e2e/reports/cucumber-test-results*.json') .pipe(reporter({ dest: '/e2e/reports/' })); });

//build e2e only gulp.task('build-e2e', ['tslint-e2e', 'compile-e2e', 'copy-e2e']);

=== protractor.conf.js ========== exports.config = { baseUrl: 'http://localhost:3000', specs: ['dist/*/.feature'], // directConnect: false, exclude: [], maxSessions: 1,

multiCapabilities: [{
    browserName: 'chrome',
}
],

allScriptsTimeout: 110000,
getPageTimeout: 100000,

framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
cucumberOpts: {
    require: ['../e2e/build/**/*steps.js', 'cucumber-hooks.js', 'screenshot.js'],
    format: 'pretty',
    tags: ['@Login', '@HomePage'],
    keepAlive: false
},

/**
 * ng2 related configuration
 *
 * useAllAngular2AppRoots: tells Protractor to wait for any angular2 apps on the page instead of just the one matching
 * `rootEl`
 *
 */
 useAllAngular2AppRoots: true

};

guan01 commented 7 years ago

Hi, is possible that you can help provide a working example with Cucumber instead of Jasmine?

rochejul commented 7 years ago

Hi @guan01

There is an old example with this project: https://github.com/plopcas/example-protractor

Maybe it works again ?

Regards

guan01 commented 7 years ago

Thank you, I managed to find the error in my environment. 1.0.0 is fully working.

rochejul commented 7 years ago

@guan01 Good news !

danyc commented 7 years ago

@guan01 could you please explain the finding? I had similar issue and did not have enough time to investigate. Thank you

guan01 commented 7 years ago

@danyc the issue for me was Cucumber.js was calling the wrong path. This is the original call from /node_modules/cucumber/lib/cli/profiles_loader.js line 8 var definitionFilePath = path.join(process.cwd(), 'cucumber.js'); if you print out the path, its going to /node_modules/.bin/cucumber.js, which is wrong

I hard coded the path to var definitionFilePath = 'C:\htmlDev35\node_modules\cucumber\lib\cucumber\cli\cucumber.js';

now works in latest chrome/ff/ie/edge for me.

Hope this fix your issue as well.