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

Protractor synchronization fails if multiple versions of selenium-webdriver are in node_modules #3505

@ghost

Description

Bug report

Setup

  • Node Version: 6.3.1
  • npm Version: 3.10.3
  • Protractor Version: 4.0.4 & 4.0.3
  • Browser(s): Chrome (52.0.2743.116 (Official Build) (64-bit))
  • Operating System and Version Ubuntu 16.04
  • Protractor configuration file
var SpecReporter = require('jasmine-spec-reporter');

exports.config = {
    allScriptsTimeout: 11000,
    specs: [
        '../e2e/**/*.e2e-spec.ts'
    ],
    capabilities: {
        'browserName': 'chrome'
    },
    directConnect: true,
    baseUrl: 'http://localhost:4200/',
    framework: 'jasmine',
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 30000,
        print: function() {}
    },
    useAllAngular2AppRoots: true,
    beforeLaunch: function() {
        require('ts-node').register({
            project: 'e2e'
        });
    },
    onPrepare: function() {
        jasmine.getEnv().addReporter(new SpecReporter());
    }
};

Bug description

Whenever I run my e2e tests, my browser opens and immediately closes. Protractor will then claim, that all tests have passed, which just can't be. I implemented a test like this to test this:

    it('should fail', () => {
        let ec = protractor.ExpectedConditions;
        let e = element(by.css('some-html-tag-which-definetly-doesnt-exist-in-my-app'));

        browser.wait(ec.presenceOf(e));
    });

Although this test should typically timeout, it will pass just fine in a split second.

If I add a spec like expect(true).toBe(false), the test will fail by the way.

I also had a beforeEach set up, with browser.ignoreSynchronization = true. After removing this line, all tests will pass like before, but protractor will fail anyway with this error:

/home/chris/workspace/mem-webclient/node_modules/protractor/built/exitCodes.js:87
if (e.message.indexOf(errMsg) !== -1) {                                                                                                         
              ^                                                                                                                                  

TypeError: Cannot read property 'indexOf' of undefined
    at Function.ErrorHandler.isError (/home/chris/workspace/mem-webclient/node_modules/protractor/built/exitCodes.js:87:30)
    at Function.ErrorHandler.parseError (/home/chris/workspace/mem-webclient/node_modules/protractor/built/exitCodes.js:98:26)
    at process.<anonymous> (/home/chris/workspace/mem-webclient/node_modules/protractor/built/launcher.js:169:54)
    at emitOne (events.js:96:13)
    at process.emit (events.js:188:7)
    at process.emit (/home/chris/workspace/mem-webclient/node_modules/ts-node/node_modules/source-map-support/source-map-support.js:419:21)
    at process.emit (/home/chris/workspace/mem-webclient/node_modules/protractor/node_modules/source-map-support/source-map-support.js:419:21)
    at process._fatalException (bootstrap_node.js:254:26)
/home/chris/workspace/my-webclient/node_modules/protractor/built/exitCodes.js:87
if (e.message.indexOf(errMsg) !== -1) {                                                                                                         
              ^                                                                                                                                  

TypeError: Cannot read property 'indexOf' of undefined
    at Function.ErrorHandler.isError (/home/chris/workspace/my-webclient/node_modules/protractor/built/exitCodes.js:87:30)
    at Function.ErrorHandler.parseError (/home/chris/workspace/my-webclient/node_modules/protractor/built/exitCodes.js:98:26)
    at process.<anonymous> (/home/chris/workspace/my-webclient/node_modules/protractor/built/launcher.js:169:54)
    at emitOne (events.js:96:13)
    at process.emit (events.js:188:7)
    at process.emit (/home/chris/workspace/my-webclient/node_modules/ts-node/node_modules/source-map-support/source-map-support.js:419:21)
    at process.emit (/home/chris/workspace/my-webclient/node_modules/protractor/node_modules/source-map-support/source-map-support.js:419:21)
    at process._fatalException (bootstrap_node.js:254:26)

(The error message above this sentence is copied from below referenced issue, since I currently can't access my own logs. I will insert my actual error message above this one as soon as I have time)

This also seems to be highly relevant, since it describes the very same behaviour: mgechev/angular-seed#1185
Sadly, this issue was closed without further investigation.

Since this issue seems to be quite rare, I assume that it is caused by some faulty dependency or so. Therefore I thought that maybe also my package.json file could help:

"dependencies": {
    "@angular/common": "2.0.0-rc.5",
    "@angular/compiler": "2.0.0-rc.5",
    "@angular/core": "2.0.0-rc.5",
    "@angular/forms": "0.3.0",
    "@angular/http": "2.0.0-rc.5",
    "@angular/platform-browser": "2.0.0-rc.5",
    "@angular/platform-browser-dynamic": "2.0.0-rc.5",
    "@angular/router": "3.0.0-rc.1",
    "@angular2-material/button": "2.0.0-alpha.7-4",
    "@angular2-material/card": "2.0.0-alpha.7-4",
    "@angular2-material/core": "2.0.0-alpha.7-4",
    "@angular2-material/grid-list": "2.0.0-alpha.7-4",
    "@angular2-material/list": "2.0.0-alpha.7-4",
    "@angular2-material/menu": "2.0.0-alpha.7-4",
    "@angular2-material/toolbar": "2.0.0-alpha.7-4",
    "angular2-moment": "1.0.0-beta.1",
    "core-js": "2.4.1",
    "moment": "2.14.1",
    "rxjs": "5.0.0-beta.11",
    "ts-helpers": "1.1.1",
    "zone.js": "0.6.12"
},
"devDependencies": {
    "@types/hammerjs": "2.0.32",
    "@types/jasmine": "2.2.33",
    "@types/protractor": "1.5.18",
    "angular-cli": "1.0.0-beta.11-webpack.8",
    "concurrently": "2.2.0",
    "codelyzer": "0.0.28",
    "jasmine-core": "2.5.0",
    "jasmine-spec-reporter": "2.7.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "2.0.0",
    "karma-jasmine": "1.0.2",
    "karma-remap-istanbul": "0.2.1",
    "protractor": "4.0.4",
    "ts-node": "1.3.0",
    "tslint": "3.15.1",
    "typescript": "2.0.0"
}

Reproduction

See #3505 (comment)

If you need more information, please let me know. I will try to get you everything you need to reproduce and hopefully eventually fix this

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions