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

Safari Technology Preview can't find Angular 1 #4004

Open
thorn0 opened this issue Jan 24, 2017 · 14 comments
Open

Safari Technology Preview can't find Angular 1 #4004

thorn0 opened this issue Jan 24, 2017 · 14 comments

Comments

@thorn0
Copy link
Contributor

thorn0 commented Jan 24, 2017

Starting with the Release 19, Safari Technology Preview is incompatible with Protractor.

See https://webkit.org/blog/7093/release-notes-for-safari-technology-preview-19/:

Changed window.name to be cleared after a cross-origin navigation (r209076)

So if we try to test an Angular 1 app there, we get angular never provided resumeBootstrap.

I wish we didn't need the Preview in the first place and could just use the release version of Safari 10, but the web driver implementation in the release is broken. Specifically, visibility checks aren't implemented in it, which has been fixed in the preview.

Protractor 4.0.14 (tried 5.0.0 too), Node 6.9,4, Selenium Standalone Server 3.0.1, macOS 10.12

@heathkit
Copy link
Contributor

Well, that's not good.

@thorn0
Copy link
Contributor Author

thorn0 commented Jan 27, 2017

On the other hand, it has navigator.webdriver set to true when WebDriver is active. So my current workaround is

if (navigator.webdriver) {
  window.name = "NG_DEFER_BOOTSTRAP!" + window.name;
}

before calling angular.bootstrap.

@heathkit
Copy link
Contributor

heathkit commented May 1, 2017

So, the root issue with Safari is "window.name leaks information across domains". Which is true, this is the exact property that Protractor exploits to tell Angular that it's in an E2E test before the browser navigates to the page.

The only way I can see to fix this would be to implement @sjelin's plan for handling browser-initiated navigation, but even that wouldn't totally fix things.

Fundamentally, Protractor depends on some form of cross-domain information leaking so it can signal to Angular that it's running in a test. The alternative would be to load the app (or any page on that domain, I guess) and set something in sessionStore, then reload the app for testing. Alternately, Protractor could use a proxy to inject javascript before the app loads.

@underscorebrody
Copy link

underscorebrody commented Nov 7, 2017

This appears to be an issue now in Chrome 63 (which is in the beta channel) as well

@underscorebrody
Copy link

@heathkit I think this is going to become a much more prevalent issue very soon...

@flo223
Copy link

flo223 commented Feb 14, 2018

Any news about this issue?
We currently use Protractor 5.2.2 with Safari 11.0.3 and we're unable to make it work because of this error.

We have an Angular 1 app and we basically cannot run our tests for Safari, which represents a great portion of our user base.

Can we conclude that Protractor does not work with Safari 11 for Angular 1 app?

Any workaround or short term solution planned?

Many thanks in advance!

@thorn0
Copy link
Contributor Author

thorn0 commented Feb 14, 2018

@flo223 I wrote what my workaround was. Does it not work for you?

@ghost
Copy link

ghost commented Apr 20, 2018

@thorn0 where did you place your if (navigator.webdriver) { window.name = "NG_DEFER_BOOTSTRAP!" + window.name; } ??

@thorn0
Copy link
Contributor Author

thorn0 commented Apr 20, 2018

@GiovanyR Before the angular.bootstrap call.

@evilaliv3
Copy link
Contributor

@thorn0 : Do you have an example where i can look?

I'm trying a possible solution that could be written inside the protractor configuration file.

@thorn0
Copy link
Contributor Author

thorn0 commented Jun 5, 2020

@evilaliv3 It can't be written there. It's something you need to do in the app code before bootstrapping AngularJS. I didn't touch those things for years and have no idea whether that workaround still works.

@Splaktar
Copy link

Splaktar commented Apr 3, 2021

This same breakage also occurs in Firefox 86

@yoavweiss
Copy link

There's an intent to similarly break this in Chromium. Do y'all have plans to stop relying on window.name for cross-site communication?

@Splaktar
Copy link

Splaktar commented Jun 7, 2021

@yoavweiss not at this time. We need to come up with some...

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

No branches or pull requests

7 participants