testcafe icon indicating copy to clipboard operation
testcafe copied to clipboard

Support multiple windows in native automation mode

Open Dmitry-Ostashev opened this issue 1 year ago • 18 comments

What is your Scenario?

At present, TestCafe does not support multiple windows in native automation mode.

What are you suggesting?

Support multiple windows in native automation mode.

Dmitry-Ostashev avatar Apr 26 '23 07:04 Dmitry-Ostashev

Thank you for opening this ticket - our team is looking for support of multiple windows in native mode too. Clicking links that open new pop out windows is something we need to cover, so we can't turn this on for every test yet.

tsherkqa avatar May 04 '23 17:05 tsherkqa

same or similar issue:

The application under test is programmed to open a new window or tab when a button is clicked. We need support for this type of interaction in TestCafe, because the application under test cannot always be modified to open in the same window.

patrickathompson avatar May 22 '23 17:05 patrickathompson

The same problem. We have many tests with multiple windows, and native automation mode doesn't work with them.

vlad-dargel avatar Jun 02 '23 09:06 vlad-dargel

Are there any workarounds with this @aleks-pro ? Or maybe at least to exclude certain tests from using native automation?

Thanks!

Jgrabenbauer avatar Jul 19 '23 19:07 Jgrabenbauer

Hi @Jgrabenbauer,

You can create two separate test runs - in Native Automation mode and without it. Specify test paths with the glob pattern as follows: Test files. Use the --disable-native-automation option for this purpose.

Run tests with NA:

testcafe chrome "tests/**/*" "!tests/multiple-tests/**/*"

Run tests without NA:

testcafe chrome "tests/multiple-tests/**/*" --disable-native-automation

You can do the same with configuration files or with a Runner object. Also, you can filter tests by metadata.

Aleksey28 avatar Jul 20 '23 09:07 Aleksey28

One more request https://stackoverflow.com/questions/76806603/how-to-use-disablenativeautomation-in-testcafe-for-one-test-only

aleks-pro avatar Aug 02 '23 06:08 aleks-pro

I have to work around particular situations, removing the target attribute with clientFunction and then clicking the element.

ClientFunction((locator) => {
            const element = document.querySelector(locator);
            element.removeAttribute("target");
});

Also, I had to use the "navigate()" function after getting the link from any attribute or API for those redirections that don't happen with an anchor tag and target attribute.

abdul-florez avatar Aug 14 '23 15:08 abdul-florez

We have the same issue - there is no workaround, 1 test is part of a larger group where we need to combine native and not native automation modes to avoid this bug Any ETA when this can be fixed/supported? It's a really nasty issue and a blocker for us.

Just to add - the issue happens when click on a link happens, which opens a new target window (tab). The step fails, and the report in json is not even created for us, this is not handled well.

gforepsly avatar Aug 23 '23 08:08 gforepsly

Hi @gforepsly,

We supported the --disable-multiple-windows option in Native Automation mode, and it's already published in TestCafe 3.3.0-rc.1. Please test it.

Aleksey28 avatar Aug 24 '23 07:08 Aleksey28

Is there an option to ignore popup window? I have an auto-closing popup, with proxy mode I just add a small t.wait, but in native mode Testcafe disable popup

tandreys avatar Sep 14 '23 08:09 tandreys

Could you elaborate on what you mean by popup window? Do you mean a real browser window or just some kind of DOM element with a fixed/absolute position? Please share a simple reproducible sample to demonstrate what kind of popup you have.

AlexKamaev avatar Sep 15 '23 07:09 AlexKamaev

I mean a real window that process authentication on remote system. I don't have access to the real code but it's something like the js below where instead of opening a website yahoo, it's open a auth.html page ... var myWindow = window.open('http://www.yahoo.com','1366002941508','width=600,height=400,left=5,top=3') setTimeout(function() { myWindow.close();}, 3000);

tandreys avatar Sep 15 '23 13:09 tandreys

@tandreys In this case, the only workaround is to use the --disable-native-automation option to disable the Native Automation mode.

AlexKamaev avatar Sep 18 '23 07:09 AlexKamaev

Testcafe released a new version v3.5.0. The experimental CLI flag ‘--experimental-multiple-windows’ allows multiple-window tests with native automation. Please try this solution and let us know if you encounter any issues.

Bayheck avatar Dec 29 '23 09:12 Bayheck

I have a RequestLogger in my test that expects a certain request to have been logged for the newly opened window. Unfortunately, it seems that all requests from the new window are not recorded with the RequestLogger, just the ones from the initial window. Is this still unsupported in 3.5.0?

mx-bernhard avatar Jan 17 '24 15:01 mx-bernhard

Hello,

Multiple windows mode with native automation is still an experimental feature. Thank you for your feedback. We will take it into account.

Bayheck avatar Jan 18 '24 15:01 Bayheck

I have a similar problem as @mx-bernhard. Any action unrelated the main window, i.e. if you open a new tab or window after clicking a button or resizing the browser window and then perform a validation in a same test, those actions are blocking all suite execution. It's a structural problem because if you have a test that performs any of these actions it completely freezes the execution and does not allow to launch any report. At the moment it's evident in local regression executions and in GitHub Actions executions

juan-garces avatar Feb 01 '24 20:02 juan-garces

Hello @juan-garces @mx-bernhard , Please create a separate ticket based on this template and also share a minimal working example in that ticket so that the TestCafe team can research the issue and help you.

Bayheck avatar Feb 05 '24 11:02 Bayheck

This issue has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this issue in the future. If it still affects you or you have any additional information regarding it, please leave a comment and we will keep it open.

github-actions[bot] avatar Aug 04 '24 01:08 github-actions[bot]

We're closing this issue after a prolonged period of inactivity. If it still affects you, please add a comment to this issue with up-to-date information. Thank you.

github-actions[bot] avatar Aug 15 '24 01:08 github-actions[bot]