You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
Feature request: Allow users to specify which URLs to sync against #3858
Instead of forcing users to manage browser.ignoreSynchronization, we could allow users to tell us which URLs point to apps which need to be synced, and which do not. Probably, a good API would be:
type syncCondition: boolean|string|string[]|{[url: string]: boolean}|RegExp|RegExp[]|(url: string)=>boolean;config.synchronizeWhen: syncCondition;config.disableSynchronizeWhen: syncCondition;browser.setSynchronizeWhen: (synchronizeWhen: syncCondition|wdpromise.Promise<syncCondition>)=>wdpromise.Promise<syncCondition>;// Returns old `synchronizeWhen`browser.setDisableSynchronizeWhen: (disableSynchronizeWhen: syncCondition|wdpromise.Promise<syncCondition>)=>wdpromise.Promise<syncCondition>;// Returns old `disableSynchronizeWhen`/** * We will synchronize on a page if its url passes `synchronizeWhen` but not * `disableSynchronizeWhen`. `synchronizeWhen` defaults to `true` and * `disableSynchronizeWhen defaults to `false`. Users can modify these at run time * via the corresponding `browser` methods */
Users can use synchronizeWhen to specify the base URL for their app, and disableSynchronizeWhen to specify any sub pages which don't have angular. If there are special cases where they need finer control, they can do something like:
An issue with this idea is that if navigation happened via something other than browser.get (e.g. someone clicks on a link), we wouldn't get to bootstrap and would end up using an outdated synchronization setting from a previous page. However, #3857 should address that.
Edge Case: Blocking Proxy
Blocking Proxy currently does not have the APIs needed to support this change. There is an issue to expand the APIs on the Blocking Proxy repo: angular/blocking-proxy#16
FYI, we're replacing browser.ignoreSynchronization = true with browser.waitForAngularEnabled(false). I do like this more than #3859, since detecting Angular seems to be so messy and involved.
I like making it a function for maximum flexibility, but wouldn't most users be testing a single Angular app, and that's the only url they'd want to wait for Angular on? It'd be nice to make the common case easy.
Actually, thinking about this more, the most common case I see for people using ignoreSynchronization is a login page or a TOS page or something. So this would be a big improvement.
Activity
heathkit commentedon Dec 21, 2016
FYI, we're replacing
browser.ignoreSynchronization = truewithbrowser.waitForAngularEnabled(false). I do like this more than #3859, since detecting Angular seems to be so messy and involved.I like making it a function for maximum flexibility, but wouldn't most users be testing a single Angular app, and that's the only url they'd want to wait for Angular on? It'd be nice to make the common case easy.
sjelin commentedon Dec 21, 2016
Sure, we could have something like:
I don't think it gets much more general than that 😝
heathkit commentedon Dec 21, 2016
Actually, thinking about this more, the most common case I see for people using
ignoreSynchronizationis a login page or a TOS page or something. So this would be a big improvement.[-]Idea: `config.synchronizeOnUrl()`[/-][+]Feature request: Allow users to specify which URLs to sync against[/+]sjelin commentedon Feb 2, 2017
Blocked on #3857, as mentioned in the
Edge Case: Navigation without bootstrapsection