DevExpress / testcafe

A Node.js tool to automate end-to-end web testing.
https://testcafe.io
MIT License
9.82k stars 671 forks source link

Testcafe is not opening any pop-up windows #8243

Closed sophia-cyclr closed 1 month ago

sophia-cyclr commented 2 months ago

What is your Scenario?

Testcafe no longer opens any pop-up windows, the button is clicked and nothing happens.

What is the Current behavior?

Nothing happens.

What is the Expected behavior?

The pop-up window opens.

What is the public URL of the test page? (attach your complete example)

https://pinterest.com

What is your TestCafe test code?

import { Selector, t } from "testcafe";

fixture`Test`;

test('pinterest', async t => {
    await t.navigateTo('https://pinterest.com/');
    await t.click(Selector('div').withExactText('Log in'));
    await t.click(Selector('span').withText('Continue with Google'));
    await t.typeText(Selector('#identifierId'), 'test@example.com');
});

Your complete configuration file

No response

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

  1. Run the test script, or any that use pop-up windows.

TestCafe version

3.6.2

Node.js version

20.16.0

Command-line arguments

testcafe chrome test.js --disable-native-automation

Browser name(s) and version(s)

Chrome 126

Platform(s) and version(s)

Windows

Other

No response

PavelMor25 commented 2 months ago

Hello @sophia-cyclr,

Try setting the --disable-native-automation option to --experimental-multiple-windows.

The --experimental-multiple-windows option allows TestCafe to use native automation when it runs multi-window tests.

Please let us know your results.

sophia-cyclr commented 2 months ago

Hello @sophia-cyclr,

Try setting the --disable-native-automation option to --experimental-multiple-windows.

The --experimental-multiple-windows option allows TestCafe to use native automation when it runs multi-window tests.

Please let us know your results.

This works, however, I cannot use this flag in my real scenario (not the test one in the issue) as the following console errors cause the page not to load. This is a private application so I can't provide repro details for it. image

Unfortunately, I have to use the TestCafe proxy until the multiple windows option becomes more stable.

In the pinterest example, the following console error appears:

The Cross-Origin-Opener-Policy header has been ignored, because the URL's origin was untrustworthy. It was defined either in the final response or a redirect. Please deliver the response using the HTTPS protocol. You can also use the 'localhost' origin instead. See https://www.w3.org/TR/powerful-features/#potentially-trustworthy-origin and https://html.spec.whatwg.org/#the-cross-origin-opener-policy-header.

Could this be a related thing and how can I resolve it?

PavelMor25 commented 2 months ago

Yes, this error can block the opening of certain windows and pop-ups, especially if the application relies on interaction between windows or uses specific APIs that require a secure context (like SharedArrayBuffer, Web Workers, etc.).

The error occurs when the Cross-Origin-Opener-Policy (COOP) header is ignored because the URL source is considered unsafe. This header is important for security and to prevent attacks related to cross-origin data access.

To avoid this error, try specifying the --hostname option to select the hostname on localhost. However, the example might still fail.

Please clarify if you encounter the same console error in your usage scenario as seen on Pinterest.

Since you cannot use the --experimental-multiple-windows option, the solution for the issue with Pinterest might differ from your use case. If you can share a minimal working example that’s not based on Pinterest, it will help us investigate your case and make the multiple windows option more stable in native automation.

github-actions[bot] commented 1 month ago

This issue was automatically closed because there was no response to our request for more information from the original author. Currently, we don't have enough information to take action. Please reach out to us if you find the necessary information and are able to share it. We are also eager to know if you resolved the issue on your own and can share your findings with everyone.