protractor icon indicating copy to clipboard operation
protractor copied to clipboard

both angularJS testability and angular testability are undefined

Open jagdheesh-github opened this issue 7 years ago • 9 comments

My protractor scripts were running fine on Windows 10 Pro. but when i launch them on Windows server 2016, then they throw the below error.

E/launcher - Error: Error from waitForAngular: both angularJS testability and angular testability are 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.

When i launched the same scripts on another windows 10 pro VM, initially i saw above error , later i fixed it by including a simple command "browser.waitForAngularEnabled(false);" inside the OnPrepare() function of protractor config file. The same trick is not working if i run the scripts on windows server 2016 VM.

Any reason why this error occurs frequently and any resolution for this ?

jagdheesh-github avatar Mar 18 '19 11:03 jagdheesh-github

@jagdheesh-github my friend, it is not just the move to Windows 10 nor is it your code. What versions of protractor and webdriver-manager are you running on the 2016 VM?

Cheers, RW And the Crowe takes winge to the Roaky Wood

It seems that the combination below has introduced significant instability in the execution of Protractor.

--protractor v6.9.0 --webdriver-manager v13.0.0 --node v10.15.0 --windows 7 and/or 10 --Chrome 73.0.3683.86 (Official Build) (64-bit) --chromedriver 73.0.3683.86 (Have to force as an npm webdriver-manager bug forces search for the non-existent Chrome v74 https://github.com/angular/webdriver-manager/issues/351)

I now also have the cryptic catch-all: "Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are 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"

_at ProtractorBrowser.<anonymous> (C:\Users\Roaky\Protractor\node_modules\protractor\built\browser.js:354:27)
at Generator.next (<anonymous>)
at fulfilled (C:\Users\Roaky\Protractor\node_modules\protractor\built\browser.js:4:58)
at process._tickCallback (internal/process/next_tick.js:68:7)Error
at ElementArrayFinder.applyAction_ (C:\Users\Roaky\Protractor\node_modules\protractor\built\element.js:459:29)
at ElementArrayFinder.(anonymous function).args [as click] (C:\Users\Roaky\Protractor\node_modules\protractor\built\element.js:97:29)
at ElementFinder.(anonymous function).args [as click] (C:\Users\Roaky\Protractor\node_modules\protractor\built\element.js:818:22)
at UserContext.<anonymous> (C:\Users\Roaky\Source\Workspaces\Test_Automation\PNL_Tests\NewPNLGridTests\spec.js:28:15)
at QueueRunner.attempt (C:\Users\Roaky\Protractor\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:5462:44)
at QueueRunner.run (C:\Users\Roaky\Protractor\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:5500:25)
at runNext (C:\Users\Roaky\Protractor\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:5426:18)
at next (C:\Users\Roaky\Protractor\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:5433:11)
at QueueRunner.onComplete (C:\Users\Roaky\Protractor\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:5347:9)
at Immediate.<anonymous> (C:\Users\Roaky\Protractor\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:5516:12)_

This is a common and well-documented error, but not one that I have encountered with previously what was a rather robust Protractor.

I've tried several dozens of solutions for this regarding timeouts and timing, (No timing changes work and none were needed previously to get my tests to run.) but I believe that the timing is a red herring and some change made from previous versions causes even the simplest examples not to work,

P.S. I used the simple example from https://www.protractortest.org/#/tutorial

C:\Users\Roaky\Protractor\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:3190 throw arguments[0]; ^ Error: Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are 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" at ProtractorBrowser. (C:\Users\Roaky\Protractor\node_modules\protractor\built\browser.js:354:27) at Generator.next () at fulfilled (C:\Users\Roaky\Protractor\node_modules\protractor\built\browser.js:4:58) at process._tickCallback (internal/process/next_tick.js:68:7)

Cheers

ghost avatar Mar 26 '19 14:03 ghost

  • angular/webdriver-manager#351 is not a bug. It is discussed and this is the intent. If you need a specific version then it is best to use a flag to make this happen.
  • more questions. does this only fail on windows? does this work on other platforms like linux and mac? are your tests async / await? Is your plugin script async / await?

I haven't run into this error yet but I'll try it out when I get back from vacation. If this is a bug you want fix, please also feel free to contribute.

cnishina avatar Mar 27 '19 08:03 cnishina

Version 6.x was an unannounced change on async/await.

Not the README nor the online documentation, nor the tutorial were updated to reflect this change.

Anyone running existing tests or newbies trying the tutorial would be unable to get protractor working because of now requiring async/await.

Issue #351 is a bug. It was never required to specify a chrome driver version from the command line before, now it is and this is not reflected in the documentation.

The Chrome 74 browser does not yet exist, however protractor/webdriver-manager requires Chrome 74.

As stated above, I tried it on Windows 7/10. I will try it on Mac but I expect I will need the aforementioned dual workarounds.

Cheers, RW

ghost avatar Mar 27 '19 11:03 ghost

@RoakyWood i am using below versions on windows server 2016

protractor : 5.4.2 webdriver-manager : 12.1.1

jagdheesh-github avatar Mar 28 '19 07:03 jagdheesh-github

I am facing the same Issue with Mac OS X as well. I am simply not able to run the basic Quick Start Examples on Protractor Site :: https://www.protractortest.org/#/

I am getting the same above errors : P.S. I used the simple example from https://www.protractortest.org/#/tutorial

C

1) Protractor Demo App should have a title
  Message:
    Expected [object Promise] to equal 'Super Calculator'.
  Stack:
    Error: Expected [object Promise] to equal 'Super Calculator'.
        at <Jasmine>
        at UserContext.<anonymous> (/Users/mohitarora/WebstormProjects/protractorSite/demoapp-spec.js:6:32)
        at <Jasmine>

1 spec, 1 failure
Finished in 0.013 seconds
/Users/mohitarora/.nvm/versions/node/v11.12.0/lib/node_modules/protractor/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:3190
        throw arguments[0];
        ^

Error: Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are 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"
    at ProtractorBrowser.<anonymous> (/Users/mohitarora/.nvm/versions/node/v11.12.0/lib/node_modules/protractor/built/browser.js:354:27)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/mohitarora/.nvm/versions/node/v11.12.0/lib/node_modules/protractor/built/browser.js:4:58)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)

I am using below versions : node v11.12.0 protractor Version 6.0.0 webdriver-manager status chromedriver: 73.0.3683.68 (latest), 74.0.3729.6 selenium: 3.141.59 (latest) OS X : 10.13.16

mmtmohit avatar Mar 28 '19 08:03 mmtmohit

I also experienced this following the https://www.protractortest.org/ setup and example.

node v10.15.3 protractor Version 6.0.0 chromedriver: 73.0.3683.68 (latest), 74.0.3729.6 selenium: 3.141.59 (latest) OS X : 10.13.3

[13:40:35] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
DEPRECATION: Setting randomizeTests directly is deprecated, please use the random option in `configure`
DEPRECATION: Setting specFilter directly on Env is deprecated, please use the specFilter option in `configure`
Started
F

Failures:
1) angularjs homepage todo list should add a todo
  Message:
    Expected [object Promise] to equal 3.
  Stack:
    Error: Expected [object Promise] to equal 3.
        at <Jasmine>
        at UserContext.<anonymous> (/Users/steveneck/protractortest/todo-spec.js:9:30)
        at <Jasmine>
  Message:
    Expected ElementFinder({ browser_: ProtractorBrowser({ execute: Function, setFileDetector: Function, getExecutor: Function, getSession: Function, getCapabilities: Function, quit: Function, actions: Function, executeScript: Function, executeAsyncScript: Function, wait: Function, sleep: Function, getWindowHandle: Function, getAllWindowHandles: Function, getPageSource: Function, close: Function, getCurrentUrl: Function, getTitle: Function, findElementInternal_: Function, findElementsInternal_: Function, takeScreenshot: Function, manage: Function, switchTo: Function, driver: mixin({ session_: [object Promise], executor_: Executor({ w3c: false, customCommands_: Map( [ 'launchApp', Object({ method: 'POST', path: '/session/:sessionId/chromium/launch_app' }) ], [ 'getNetworkConditions', Object({ method: 'GET', path: '/session/:sessionId/chromium/network_conditions' }) ], [ 'setNetworkConditions', Object({ method: 'POST', path: '/session/:sessionId/chromium/network_conditions' }) ], [ 'sendDevToolsC ... to equal 'write first protractor test'.
  Stack:
    Error: Expected ElementFinder({ browser_: ProtractorBrowser({ execute: Function, setFileDetector: Function, getExecutor: Function, getSession: Function, getCapabilities: Function, quit: Function, actions: Function, executeScript: Function, executeAsyncScript: Function, wait: Function, sleep: Function, getWindowHandle: Function, getAllWindowHandles: Function, getPageSource: Function, close: Function, getCurrentUrl: Function, getTitle: Function, findElementInternal_: Function, findElementsInternal_: Function, takeScreenshot: Function, manage: Function, switchTo: Function, driver: mixin({ session_: [object Promise], executor_: Executor({ w3c: false, customCommands_: Map( [ 'launchApp', Object({ method: 'POST', path: '/session/:sessionId/chromium/launch_app' }) ], [ 'getNetworkConditions', Object({ method: 'GET', path: '/session/:sessionId/chromium/network_conditions' }) ], [ 'setNetworkConditions', Object({ method: 'POST', path: '/session/:sessionId/chromium/network_conditions' }) ], [ 'sendDevToolsC ... to equal 'write first protractor test'.
        at <Jasmine>
        at UserContext.<anonymous> (/Users/steveneck/protractortest/todo-spec.js:10:39)
        at <Jasmine>
  Message:
    Expected [object Promise] to equal 2.
  Stack:
    Error: Expected [object Promise] to equal 2.
        at <Jasmine>
        at UserContext.<anonymous> (/Users/steveneck/protractortest/todo-spec.js:15:37)
        at <Jasmine>

1 spec, 1 failure
Finished in 0.037 seconds
/usr/local/lib/node_modules/protractor/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:3190
        throw arguments[0];
        ^

Error: Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are 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"
    at ProtractorBrowser.<anonymous> (/usr/local/lib/node_modules/protractor/built/browser.js:354:27)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/local/lib/node_modules/protractor/built/browser.js:4:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)Error
    at ElementArrayFinder.applyAction_ (/usr/local/lib/node_modules/protractor/built/element.js:459:29)
    at ElementArrayFinder.(anonymous function).args [as getText] (/usr/local/lib/node_modules/protractor/built/element.js:97:29)
    at ElementFinder.(anonymous function).args [as getText] (/usr/local/lib/node_modules/protractor/built/element.js:818:22)
    at UserContext.<anonymous> (/Users/steveneck/protractortest/todo-spec.js:10:28)
    at QueueRunner.attempt (/usr/local/lib/node_modules/protractor/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:5462:44)
    at QueueRunner.run (/usr/local/lib/node_modules/protractor/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:5500:25)
    at runNext (/usr/local/lib/node_modules/protractor/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:5426:18)
    at next (/usr/local/lib/node_modules/protractor/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:5433:11)
    at QueueRunner.onComplete (/usr/local/lib/node_modules/protractor/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:5347:9)
    at Immediate.<anonymous> (/usr/local/lib/node_modules/protractor/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:5516:12)

ghost avatar Mar 28 '19 20:03 ghost

Updates on the angularJS testability and angular testability are undefined bug:

@jagdheesh-github I'm working on reproducing this issue.

Addressing unrelated comments to added to this issue

So these are a lot of other issues and comments that are unrelated to the actual issue being reported. Here are some responses to the comments.

  • I have pull requests that update the examples so they are all async / await. I did not have time to get this done since I went on vacation.

  • The async / await change was announced in the changelog. It is the first bullet point.

Breaking changes
=============
- Control flow is removed and you should use async await to run your tests.
  • The webdriver-manager downloading version 74 of chromedriver is as designed. This is something that was decided to always download the latest. An example where this does not work, possibly a user might also run into this error if they have never updated Chrome and for example were on version 68. There are ways to get a specific version of ChromeDriver and that is documented. Most times this works but I do not control the Chrome and ChromeDriver releases. I have added some notes and thoughts about it in webdriver-manager.

  • The issues that were tagged were closed because they did not follow the instructions. It says Delete this intro and any unrelated text 😄 (if you do not we'll assume you haven't read these instructions and automatically close the issue.). If the issue is open without providing enough information, it is almost impossible to triage.

Again this is open source, and if you find something wrong, please feel free to write a pull request. I'll happily review it. Thanks!

cnishina avatar Mar 30 '19 01:03 cnishina

  1. From a software engineering standpoint, the changes were non-obvious on both issues as the primary documentation on the protractor site was not updated to reflect two major changes that broke the example. Thus, potential new users and newbies were chased away. Not a good look for selling an otherwise very good technology. None of the new users would look at the changelog because none of them ever used protractor before.

  2. The change to look for the newest Chrome version seems to have not been adequately vetted as to advantages/disadvantages from a user standpoint.

  3. If it can look for a non-existent future version of Chrome, and it requires a non-obvious workaround it is a design bug Q.E.D.

  4. The move to require async while it may be a good design to take advantage of the async feature, was also not broadcast on the site to new or existing users. Hence, a lack of communication with the user community.

Recommendation:

  1. coordinate changes with whoever publishes the outward-facing site.

  2. The site is badly out of date in other respects and it worth a review. F/X is Selendroid still maintained? If not, why is it in the documentation?

  3. Major changes should be vetted as to risks and design accordingly.

Remember that the user community are testers and QA, we are hard-wired to present defects and bugs.

We provide recommendations in good faith to improve the product and to encourage new users. It’s not a personal reflection on anyone.

Maybe I can make a contribution by reviewing the documentation and submit my recommendations.

Cheers RW

ghost avatar Mar 30 '19 03:03 ghost

Thanks for your comment. I'll keep those recommendations in mind.

cnishina avatar Mar 30 '19 06:03 cnishina