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

Protractor 3.1.1 doesn't run test for application having .debugInfoEnalbled(false) #3009

Closed
ravitej-klair opened this issue Mar 8, 2016 · 6 comments

Comments

@ravitej-klair
Copy link

Pretty new here,

Recently upgraded to Protractor 3.1.1 and testing the debug feature (148f020)

I understand that the debug flag added in the protractor.js helps to run the tests for applications with .debugInfoEnabled(false);

But my test doesn't without the following hack
browser.executeScript('window.name = "NG_ENABLE_DEBUG_INFO!"');

But wasn't this the whole point of upgrading to Protractor 3.1.1 so you don't have to do this?!

Any suggestions?

@juliemr
Copy link
Member

juliemr commented Mar 8, 2016

It looks like that commit has the order wrong - Angular first checks if the string starts with NG_ENABLE_DEBUG_INFO, and then checks for the NG_DEFER_BOOTSTRAP string. Needs to be switched.

@juliemr juliemr self-assigned this Mar 8, 2016
juliemr added a commit to juliemr/protractor that referenced this issue Mar 10, 2016
Note that in most cases, this should not have surfaced as an issue because
the base test mock modules will also try to turn on debug info.

Closes angular#3009
cnishina pushed a commit to cnishina/protractor that referenced this issue Mar 18, 2016
closes angular#3035

Note that in most cases, this should not have surfaced as an issue because
the base test mock modules will also try to turn on debug info.

Closes angular#3009
@ravitej-klair
Copy link
Author

Hi Guys,

I'm using protractor 3.2.2 now and still not able to run my test WITHOUT hacking it with
browser.executeScript('window.name = "NG_ENABLE_DEBUG_INFO!"');

@juliemr
Copy link
Member

juliemr commented Apr 21, 2016

I'm rolling back the associated PR since it is causing issues with older versions of Angular.

Note that if you are not using manual bootstrap, we should be able to turn on debug info by using Protractor's default set of mock modules. @ravitej-klair can you provide a test application that we can run against showing where this fails?

@machtyn
Copy link

machtyn commented Apr 26, 2016

I'm using Protratctor 3.2.2 and attempted to use elementExplorer. Here are the results of running various commands. For details on the setup, see this page: http://stackoverflow.com/questions/36851322/attempting-to-select-angular-component-element-and-getting-an-error?noredirect=1#comment61273847_36851322

> browser.executeScript('window.name = "NG_ENABLE_DEBUG_INFO!"');
null
> element(by.css('state-selection-component')).getText()
Error while waiting for Protractor to sync with the page: "Could not find testability for element."
> element(by.css('state-selection-component')).getLocation()
Error while waiting for Protractor to sync with the page: "Could not find testability for element."
> element(by.css('state-selection-component')).isEnabled()
Error while waiting for Protractor to sync with the page: "Could not find testability for element."
> element(by.css('state-selection-component div > p')).isEnabled()
Error while waiting for Protractor to sync with the page: "Could not find testability for element."
>

@machtyn
Copy link

machtyn commented Apr 26, 2016

I noticed that the status and type was changed. I'm not sure if you need something more reproducible, but if it helps, here's what I did.
Create a new folder (angular2play).
Follow instructions on Angular 2 quick start guide, with the following addition to the package.json file:
"devDependencies": { ..., "protractor": "^3.2.2", ... }

Run npm start which displayed the "My First Angular 2 App" text appropriately.
In a new terminal, run protractor --elementExplorer
Within elementExplorer run the following commands:
> browser.get('http://localhost:3000')
> element(by.css('my-app h1')).getText();
Error while waiting for Protractor to sync with the page: "Could not find testability for element."

See attached file for the result of
> element(by.css('my-app h1'));
elementResult.txt

This was performed on a MacOS (El Capitan 10.11.4). For the tutorial, I copied the text and pasted it in the files using Sublime Text (I decided to remove the IDE variable).

$ npm ls --depth=0
angular2play@1.0.0 /Users/machtyn/Projects/angular2play
├── angular2@2.0.0-beta.16
├── concurrently@2.0.0
├── es6-shim@0.35.0
├── lite-server@2.2.0
├── protractor@3.3.0
├── reflect-metadata@0.1.2
├── rxjs@5.0.0-beta.2
├── systemjs@0.19.26
├── typescript@1.8.10
├── typings@0.8.1
└── zone.js@0.6.12

@juliemr
Copy link
Member

juliemr commented Apr 26, 2016

OH this is for Angular2. Angular2 does not respond to the NG_ENABLE_DEBUG_INFO window name modifier. You'll need to change the mode in the application you are serving - no way around that in Angular2.

I'm not sure if that was the original issue from @ravitej-klair or not, but in either case, I'm closing this as infeasible to change for now. See instead clean new issue: #3174

@juliemr juliemr closed this as completed Apr 26, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants