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

Protractor tests on Firefox fail for Angular apps using Zone.JS > 0.7.2 #616

Closed
AlexandrosD opened this issue Jan 24, 2017 · 30 comments · Fixed by #699
Closed

Protractor tests on Firefox fail for Angular apps using Zone.JS > 0.7.2 #616

AlexandrosD opened this issue Jan 24, 2017 · 30 comments · Fixed by #699

Comments

@AlexandrosD
Copy link

All protractor tests are failing on Firefox 50+, using Angular v2.4.4, zone.js v0.7.6, Geckodriver 0.13.0, protractor 4.0.13.

The error is the following:
Permission denied to access property "invoke"

This seems similar to angular/protractor#2784 and can be solved only by downgrading Zone.js to v0.7.2.

@JiaLiPassion
Copy link
Collaborator

Could you provide a sample repo?

herkulano pushed a commit to RADAR-base/RADAR-Dashboard that referenced this issue Feb 1, 2017
remove Firefox because of this issue
angular/zone.js#616
herkulano pushed a commit to RADAR-base/RADAR-Dashboard that referenced this issue Feb 1, 2017
* chore(protractor): fix browser support

* chore(protractor): fix

* chore(protractor): fix

remove Firefox because of this issue
angular/zone.js#616

* chore(protractor): fix

* chore(protractor): fix
@rolandjitsu
Copy link

I have the same issues. Check angular-lab repo.

@johnstaveley
Copy link

I have the same issue running Selenium tests on zone.js 0.7.7, FF 51.0.1 and Selenium WebDriver 3.0.1. Same error as reported above

@JiaLiPassion
Copy link
Collaborator

@rolandjitsu @johnstaveley , can you tell me how to reproduce the issue? I use the angular-lab repo, but I don't know how to configure the protractor to run with Firefox 51.

@rolandjitsu
Copy link

@JiaLiPassion just use capabilities: {browserName: 'firefox'} I guess. It should work if you have firefox installed. You can also set the binary path to Firefox.

@JiaLiPassion
Copy link
Collaborator

@rolandjitsu , I have tried to add a capabilities {browserName: 'firefox'}, it is not working, the protractor complains can't download firefoxdriver, it seems that webdriver doesnot support firefox 50

@rolandjitsu
Copy link

As far as I know, Firefox is supported, it just seems to be an issue with selenium, see angular/protractor#886 (comment)

@johnstaveley
Copy link

I'm not using protractor, I'm just running web tests using C# on zone.js 0.7.7, FF 51.0.1 and Selenium WebDriver 3.0.1 but it is the same issue. There is a dynamic component built using Angular 2 it fails to find (the first it tries to find). It fails with the error message above on:

_wait.Until(ExpectedConditions.ElementIsVisible(by));

where by is find the element by id

nickcmaynard added a commit to nickcmaynard/jsonschemalint that referenced this issue Mar 7, 2017
nickcmaynard added a commit to nickcmaynard/jsonschemalint that referenced this issue Mar 13, 2017
nickcmaynard added a commit to nickcmaynard/jsonschemalint that referenced this issue Mar 13, 2017
nickcmaynard added a commit to nickcmaynard/jsonschemalint that referenced this issue Mar 13, 2017
nickcmaynard added a commit to nickcmaynard/jsonschemalint that referenced this issue Mar 13, 2017
@heathkit
Copy link

heathkit commented Mar 23, 2017

This is still an issue in 0.8.5. It seems the problem was introduced in 0fd8c03. Geckodriver will throw an error on any page with Zones patched in if setTimeout is called in an async script (which is how Protractor tests for Angular). This is only a problem in Firefox 50+ (Firefox 47 seems ok).

This demonstrates the problem:

let webdriver = require('selenium-webdriver');
let capabilities = webdriver.Capabilities.firefox();
driver = new webdriver.Builder().usingServer('http://localhost:4444/wd/hub').withCapabilities(capabilities).build();
driver.get("http://material.angular.io");
driver.executeAsyncScript((cb) => { window.setTimeout(cb,1000) });

I'm guessing the issue is that the patched setTimeout can't call invoke in the WebDriver sandbox. Related to mozilla/geckodriver#515 and https://bugzilla.mozilla.org/show_bug.cgi?id=1322862

@JiaLiPassion
Copy link
Collaborator

@mgiambalvo , thank you for the information, I will try to research more, but I am still stuck at the environment, my selenium can't work with firefox 50+.

@heathkit
Copy link

The easiest way to do that would be to use webdriver-manager. It'll be available in any project with Protractor (or anything created with angular-cli), but you can also just install it directly.

npm install webdriver-manager
webdriver-manager update
webdriver-manager start

That should start a selenium server listening on port :4444 - you should then be able to run the script I posted. I also put together a repo with everything set up https://github.com/mgiambalvo/firefox-zonejs-issue-demo

@JiaLiPassion
Copy link
Collaborator

@mgiambalvo , thank you, I will try your repository to reproduce the issue.

@JiaLiPassion
Copy link
Collaborator

@mgiambalvo , still not working, what firefox version are you using? I tried firefox 50, 51, 52 on mac os 10.12.3, all report org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms.

@JiaLiPassion
Copy link
Collaborator

@mgiambalvo , I think I know how to fix it, I will make a PR to fix it.

JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Mar 24, 2017
mhevery pushed a commit that referenced this issue Apr 10, 2017
…on denied error (#699)

* fix(listener): fix #616, webdriver removeEventListener will throw permission denied error

* add test cases of webdriver cross site context
@pedrotst
Copy link

When can I expect the next release to fetch this fix?

@AlexandrosD
Copy link
Author

@mhevery please reopen the issue as it is not fixed yet.
Even with the latest version of zone.js (from master branch) the tests continue to fail on firefox.

@JiaLiPassion
Copy link
Collaborator

@AlexandrosD, could you post your repo, I tested with @mgiambalvo 's sample, so I would like to research with your repo. thank you.

@AlexandrosD
Copy link
Author

@JiaLiPassion please try with the most widely-used angular seed: https://github.com/mgechev/angular-seed

Run protractor with latest webdriver (v3.3.1), gekcodriver (v0.15.0), and firefox (v51+).

Just reproduced this one:

alex@laptop /c/projects/angular-seed (master)
$ protractor --baseUrl=http://localhost:5556/ --seleniumAddress=http://localhost:4444/wd/hub --browser=firefox
[13:19:33] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[13:19:33] I/launcher - Running 1 instances of WebDriver
Started
[13:19:48] E/launcher - Error while running testForAngular: Error: Permission denied to access property "invoke"
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'
System info: host: 'AL471531', ip: '172.17.66.36', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_102'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=C:\Users\alex\AppData\Local\Temp\rust_mozprofile.35X6HsIWf4AJ, rotatable=false, timeouts={implicit=0, pageLoad=300000, script=30000}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=54.0a2, platformVersion=6.1, moz:processID=13440, browserName=firefox, platformName=windows_nt}]
Session ID: a6ba1ede-e0b0-4ac9-8700-2fe91e1fbb53
[13:19:48] E/launcher - Error: Error while running testForAngular: Error: Permission denied to access property "invoke"
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'
System info: host: 'AL471531', ip: '172.17.66.36', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_102'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=C:\Users\alex\AppData\Local\Temp\rust_mozprofile.35X6HsIWf4AJ, rotatable=false, timeouts={implicit=0, pageLoad=300000, script=30000}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=54.0a2, platformVersion=6.1, moz:processID=13440, browserName=firefox, platformName=windows_nt}]
Session ID: a6ba1ede-e0b0-4ac9-8700-2fe91e1fbb53
    at c:\projects\angular-seed\node_modules\protractor\built\browser.js:512:19
    at ManagedPromise.invokeCallback_ (c:\projects\angular-seed\node_modules\selenium-webdriver\lib\promise.js:1379:14)
    at TaskQueue.execute_ (c:\projects\angular-seed\node_modules\selenium-webdriver\lib\promise.js:2913:14)
    at TaskQueue.executeNext_ (c:\projects\angular-seed\node_modules\selenium-webdriver\lib\promise.js:2896:21)
    at asyncRun (c:\projects\angular-seed\node_modules\selenium-webdriver\lib\promise.js:2775:27)
    at c:\projects\angular-seed\node_modules\selenium-webdriver\lib\promise.js:639:7
    at process._tickCallback (internal/process/next_tick.js:103:7)
[13:19:48] E/launcher - Process exited with error code 199

@JiaLiPassion
Copy link
Collaborator

JiaLiPassion commented Apr 18, 2017

@AlexandrosD , the reason is in master branch of zone.js, dist folder is still 0.8.5, not updated, it will only updated when version number change, you can clone the master and run gulp build, then copy the dist to your repo/node_modules/zone.js/dist, it should work.

And after the 0.8.6 is released, everything should work.

@AlexandrosD
Copy link
Author

@JiaLiPassion Hm.. indeed - you are right. After building the dist folder locally and copying its contents in the respective directory of our repo the tests run.
Do you have an estimation regarding when v0.8.6 is going to be released?

@JiaLiPassion
Copy link
Collaborator

@AlexandrosD , I don't know when it will be released, but I believe it will be soon, because several high priority issues have been merged.

@user2301
Copy link

user2301 commented Jun 9, 2017

I am facing the same issue. Failed: Error while running testForAngular: Error: Permission denied to access property "invoke

"zone.js": "0.7.2"
"@angular/core": "2.4.10"
"typescript": "2.2.2"
browserName=firefox
browserVersion=53.0.3

@JiaLiPassion
Copy link
Collaborator

@mythrimanjunath , this has been fixed in 0.8.6, so please update to the newest version.

@user2301
Copy link

user2301 commented Jun 9, 2017

@JiaLiPassion I upgraded to "zone.js": "0.8.6" . I get the same error.

@JiaLiPassion
Copy link
Collaborator

@mythrimanjunath , could you post the full stack trace? It should not throw error in 0.8.6

@user2301
Copy link

user2301 commented Jun 9, 2017

@JiaLiPassion Okay sure. Here is the stack trace. Let me know if anything else is required thank you .

Message:
    Failed: Error while running testForAngular: Error: Permission denied to access property "invoke"
    Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
    System info: host: 'ubuntu', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-78-generic', java.version: '1.8.0_121'
    Driver info: org.openqa.selenium.firefox.FirefoxDriver
    Capabilities [{moz:profile=/tmp/rust_mozprofile.Vaed6CZZUubM, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=53.0.3, platformVersion=4.4.0-78-generic, moz:processID=3625.0, browserName=firefox, javascriptEnabled=true, platformName=linux}]
    Session ID: ed2b609a-e0e3-446b-8812-e33c5f50107b
  Stack:
    Error: Error while running testForAngular: Error: Permission denied to access property "invoke"
    Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
    System info: host: 'ubuntu', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-78-generic', java.version: '1.8.0_121'
    Driver info: org.openqa.selenium.firefox.FirefoxDriver
    Capabilities [{moz:profile=/tmp/rust_mozprofile.Vaed6CZZUubM, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=53.0.3, platformVersion=4.4.0-78-generic, moz:processID=3625.0, browserName=firefox, javascriptEnabled=true, platformName=linux}]
    Session ID: ed2b609a-e0e3-446b-8812-e33c5f50107b
        at executeAsyncScript_.then (/usr/lib/node_modules/protractor/lib/browser.ts:945:27)
        at ManagedPromise.invokeCallback_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1366:14)
        at TaskQueue.execute_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2970:14)
        at TaskQueue.executeNext_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2953:27)
        at asyncRun (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2813:27)
        at /usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:676:7
        at process._tickCallback (internal/process/next_tick.js:103:7)
    From: Task: Run beforeEach in control flow
        at Object.<anonymous> (/usr/lib/node_modules/protractor/node_modules/jasminewd2/index.js:94:19)
    From asynchronous test: 
    Error
        at Suite.<anonymous> (/home/ubuntu/git/idevops/Test/demoDashboardTest/test/menu.js:2:4)
        at Object.<anonymous> (/home/ubuntu/git/idevops/Test/demoDashboardTest/test/menu.js:1:1)
        at Module._compile (module.js:571:32)
        at Object.Module._extensions..js (module.js:580:10)
        at Module.load (module.js:488:32)
        at tryModuleLoad (module.js:447:12)

@JiaLiPassion
Copy link
Collaborator

@mythrimanjunath , the stack trace is protractor side.... could you post your reproduce repository?

@user2301
Copy link

user2301 commented Jun 9, 2017

@JiaLiPassion Sorry. I do not have permission to share the repository. Thank you!

@JiaLiPassion
Copy link
Collaborator

@mythrimanjunath , sure, maybe you can confirm that you upgrade zone.js to 0.8.6 or higher version correctly by print some information by modifying node_modules/zone.s/dist/zone.js, the invoke should not throw error because all invoke call have been try/catched from 0.8.6.

@user2301
Copy link

user2301 commented Jun 9, 2017

@JiaLiPassion Okay sure. I will do that and Thank you so much for a quick response.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
7 participants