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.

Chrome hangs on application open intent with --waiting for new page to load--

See original GitHub issue

Current behavior:

Cypress waits indefinitely for window prompt

image

Desired behavior:

Testing commands should continue to execute regardless of the opened window

Test code to reproduce

Given we have an html defined using react (not using jsx to make it easier to run in a generic environment)

ReactDOM.render(React.createElement(
  'a',  {href:"vscode://someurl", 'data-cy':"testing-app"},
  "TESTING CYPRESS"
  ), document.getElementById('main-container'));

or in HTML

<a href="vscode://someurl" data-cy="testing-app">TESTING CYPRESS</a>

The follow test fails to pass

       it('does not work', () => {
          cy.visit('/')
          cy.get('[data-cy="testing-app"]').click();
          cy.get('[data-cy="testing-app"]').should('exist');
        });

Versions

Cypress: 5.10.0, 4.10.0 MacOS: Catalina 10.15.6 Browsers: Chrome 84

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
jepetkocommented, Jan 8, 2021

I’m referring to this as it is a real blocker for testing business applications. Let’s consider a typical scenario:

A (base url for Cypress tests) -> B (OAuth login form) -> A (redirect uri for OAuth). A and B don’t share the same site.

Note that:

  • I cannot use Chrome out of security reasons (despite disableWebSecurity = true I have to hack X-frame-options using a Chrome extension for fixing “Refused to display ‘https://login.provider.com’ in a frame because it set ‘X-Frame-Options’ to ‘deny’.” This happens because Cypress loads the application into an iframe. Unfortunately, I’m not allowed to load the according Chrome extension due to a corporate policy.)
  • In Firefox I’m able to bypass the security measures (X-frame-options, Same-Site policy etc.). Now, I’m looking for the proper preferences to bypass also the cross origin check (see below).
  • manual OAuth flow behind the scenes (described in https://docs.cypress.io/guides/guides/web-security.html#Form-Submission-Redirects) is not really possible due to additional security measures such as XSRF token etc.

With the following test, I can navigate to the OAuth login form hosted on domain B (meaning: I can see the rendered page):

  cy.server();
  cy.route('https://login.provider.com/**').as('oauth');

  getLoginButton().click(); // this navigates to https://login.provider.com/login

  cy.wait('@oauth');

however, then I also see this warning

(page load)--waiting for new page to load--

If I manually finish the OAuth flow using valid credentials (of course I have to do it within the timeout) then the state of that line turns to

"(page load)--page loaded--".

The state of the application is correct, I successfully finished the OAuth flow and the application has a correct state.

But Cypress shows this error:

Cypress detected a cross origin error happened on page load:

  > Permission denied to access property "document" on cross-origin object

Before the page load, you were bound to the origin policy:

  > https://mydomain.com

A cross origin error happens when your application navigates to a new URL which does not match the origin policy above.

A new URL does not match the origin policy if the 'protocol', 'port' (if specified), and/or 'host' (unless of the same superdomain) are different.

Cypress does not allow you to navigate to a different origin URL within a single test.

You may need to restructure some of your test code to avoid this problem.

Alternatively you can also disable Chrome Web Security in Chromium-based browsers which will turn off this restriction by setting { chromeWebSecurity: false } in cypress.json.Learn more

The stacktrace is:

    at onPageLoadErr (https://app.mydomain.com/__cypress/runner/cypress_runner.js:156215:18)
    at initialize (https://app.mydomain.com/__cypress/runner/cypress_runner.js:168094:18)
    at dispatch (https://app.mydomain.com/__cypress/runner/cypress_runner.js:90364:28)
    at add/elemData.handle (https://app.mydomain.com/__cypress/runner/cypress_runner.js:90172:29)
From previous event:
    at run (https://app.mydomain.com/__cypress/runner/cypress_runner.js:167762:20)
    at addCommand/cy[name] (https://app.mydomain.com/__cypress/runner/cypress_runner.js:168214:12)
    at runTest (../../node_modules/cypress-cucumber-preprocessor/lib/createTestFromScenario.js:47:1)
	...

I think some of the Firefox preferences could fix it. Do you know what is the counterpart of disableWebSecurity when running Firefox? I found https://bugzilla.mozilla.org/show_bug.cgi?id=1039678 which is still open but I assume that some combination of FF preferences could provide the same behavior.

0reactions
vertocodecommented, Sep 14, 2022

@vertocode take a look on this: https://medium.com/@benjaminpinto/cypress-waiting-for-a-page-to-load-after-downloading-a-file-quick-fix-210d89a02e1a

Hope it helps.

Thanks, but It not helps.

I want enter with contact with you! You can take a look in your LinkedIn?please

Read more comments on GitHub >

github_iconTop Results From Across the Web

[chromium-dev] Web application "stalled" for 1.3 min on initial ...
Open a new tab and visit the application URL app.boardingware.com; It will get stuck on "Connecting..." at the bottom left corner for ...
Read more >
Fix Chrome if it crashes or won't open - Computer
Quit Chrome and reopen it: Windows: Press Ctrl + q. Mac: Press ⌘ + q. Try loading the page again. Tip: You can...
Read more >
738724 - Chrome tabs not redirecting back to app without user ...
Chrome tabs should be closed and the app should catch the intent with the custom scheme even when there is no user interaction....
Read more >
App startup time - Android Developers
At the beginning of a cold start, the system has three tasks. These tasks are: Loading and launching the app. Displaying a blank...
Read more >
Chrome freezes when loading page - Stack Overflow
Try opening the console before you load the page. Specially the network tab, perhaps. – Alexander. Mar 8, 2014 at 16:29.
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