question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ignoreSynchronization still has immediate side effects, needs to be executed on control flow

See original GitHub issue

Protractor Version: 5.1

I have tests that navigate to a non-Angular page (OAuth login), then after login they continue on my Angular app. The outline looks like this:

// Gonna leave to 3rd party page, disable synchronization
browser.ignoreSynchronization = true;
element(by.css('.sign-in-button')).click();

// Now we're on the login page
browser.wait(ExpectedConditions.visibilityOf(element(by.id('Email'))));
element(by.id('Email')).sendKeys('jimmy');
element(by.id('next')).click();
// .. and so on
// This one redirects back to my page:
element(by.id('submit_approve_access')).click();

// Now I want to proceed with testing my app
browser.ignoreSynchronization = false;
// Run test scenario

As you can see, I am updating ignoreSynchronization twice. Problem is, part of the call is executed in control flow, but it also immediately (synchronously) updates internalIgnoreSynchronization. As a result, this whole test fails because after navigating away to OAuth provider, it’s still looking for window.angular there.

I think it can be worked around by manually putting that in control flow:

browser.controlFlow().execute(() => { browser.ignoreSynchronization = false; });

However, it seems like a bug to me. If it is intended, I would really like to understand the rationale and correct usage (docs needed?).

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
konrad-garuscommented, Feb 3, 2017

Actually, that workaround still does not put things in the right order. What seems to be working for me is:

element(by.id('submit_approve_access')).click().then(() =>
    browser.ignoreSynchronization = false);
0reactions
jan-molakcommented, May 5, 2017

Thanks, glad you like it :-)Yes, Blocking Proxy is a really cool project, great job! I wrote a piece on it some time ago.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is browser.ignoreSynchronization in protractor?
There are cases when an understanding of the control flow, ... to the control flow after the rest of the functions in the...
Read more >
chore(core): Add better error message for client-side redirects ...
My use case: I have a test that enters username/password and hits a log ... waitForAngular() because protractor will continue control flow ......
Read more >
Untitled
IgnoreSynchronization still has immediate side effects, needs to be executed on control flow #4061. Protractor Version: 5.1 I have tests that navigate to...
Read more >
Untitled
IgnoreSynchronization still has immediate side effects, needs to be executed on control flow #4061. Protractor Version: 5.1 I have tests that navigate to...
Read more >
Silk Test 21.0 - Micro Focus
Do I Need Administrator Privileges to Run Silk4J? ... If you have not created the package yet, type the package name into the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found