3

This is a rough one. Two fellow developers and I have been working for nearly 24 hours on this. I have a conf.js that I can navigate to in Terminal and then run protractor conf.js (using the globally installed copy) and it runs perfectly. One at a time, each green dot appears after each successful test, and it takes about 80 seconds. Here's where it gets tricky.

If I force the local installation of Protractor to run by executing (path of project)/node_modules/protractor/bin/protractor conf.js then it fires up, shows me several green dots all at once, then throws an error about not being able to hook into angular. This is causing trouble with integrating with our build, since grunt looks for and uses the local copy of Protractor.

To further complicate matters, one of the two other developers can pull down my repo and run the local protractor installation on my conf.js no problem. It works 100%.

Error while waiting for Protractor to sync with the page: "window.angular is 
undefined. This could be either because this is a non-angular page or because your 
test involves client-side navigation, which can interfere with Protractor's 
bootstrapping. See http://git.io/v4gXM for details"

We've checked all of the following:

  • Both local and global installations of Protractor are the same version, installed with npm.

    Richards-MacBook-Pro:protractor richardpressler$ npm ls protractor
    wear-test-web-framework@0.0.1 
    /path_to_project/wear-test-track0
    └── protractor@3.1.1 
    
    Richards-MacBook-Pro:protractor richardpressler$ npm ls -g protractor
    /usr/local/lib
    └── protractor@3.1.1 
    
  • Selenium is up-to date. We have run both (path to project)/node_modules/protractor/bin/webdriver-manager update as well as webdriver-manager update to update both local and global selenium server installations

  • I've tried firing up Selenium separately and then pointing Protractor to it so that I can see the output and it looks great when I run the conf.js using the global protractor (protractor conf.js), showing several [Executing] statements each followed by a [Done] statement. However, when I run the local protractor binary with (path to project)/node_modules/protractor/bin/protractor conf.js, I see that Protractor was able to connect to the Selenium instance, but didn't do much afterword:

When the protractor output looks like this:

Richards-MacBook-Pro:protractor richardpressler$ ../../node_modules/protractor/bin/protractor conf.js
Using the selenium server at http://127.0.0.1:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Started
.......................

The Selenium server only outputs this:

10:35:47.612 INFO - Selenium Server is up and running
10:35:49.479 INFO - Executing: [new session: Capabilities [{count=1, browserName=chrome}]])
10:35:49.487 INFO - Creating a new session for Capabilities [{count=1, browserName=chrome}]
Starting ChromeDriver 2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4) on port 34848
Only local connections are allowed.
10:35:50.516 INFO - Done: [new session: Capabilities [{count=1, browserName=chrome}]]
10:35:50.532 INFO - Executing: [set script timeout: 11000])
10:35:50.537 INFO - Done: [set script timeout: 11000]

Has anyone had similar misbehavior by Protractor when comparing the global, command-line version and the locally installed version in the project?

Thanks

Richard Pressler
  • 494
  • 3
  • 11

1 Answers1

4

Turns out all of the dependencies for protractor, grunt, selenium, etc. were in devDependencies so when I initially ran npm install it simply didn't install all of the sub-dependencies for those packages. If I move them into dependencies in the package.json, then re-run npm install, it works like a charm. Alternatively, running npm install --dev with those dependencies in devDependencies works fine too.

More info on the differences between dependencies, devDependencies, and peerDependencies can be found here: What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?

Community
  • 1
  • 1
Richard Pressler
  • 494
  • 3
  • 11