TestCafé hangs & fails when a button click triggers a download in a separate browser window #6242
Labels
FREQUENCY: level 2
SYSTEM: window management
TYPE: bug
The described behavior is considered as wrong (bug).
What is your Test Scenario?
As part of a test, we click on a button which leads to a document being downloaded. The download url is being supplied by our backend, and the frontend basically calls a window.open(documentUrl, "_blank") on it. TestCafe opens a blank window (about:blank), where the download is being completed in.
What is the Current behavior?
When a button is clicked that triggers a download, TestCafè opens a separate browser window and seems not to be able to switch to this download-window. Sooner or later the test runs into an error with the message "Cannot switch to the window.".
What is the Expected behavior?
TestCafé is able to continue with the test after clicking a button that triggers a download in a separate browser window.
What is your web application and your TestCafe test code?
A minimal example to reproduce the mentioned problem:
The HTML-Code:
The TestCafé/TypeScript code to reproduce the problem:
The TestCafé/TypeScript code including a workaround that I came up with:
Calling the ClientFunction "overrideWindowOpen" right before clicking the button solved the issue for me as a workaround.
Steps to Reproduce:
testcafe chrome src/to/my/testfile.ts
(has to be adjusted accordingly)Your Environment details:
The text was updated successfully, but these errors were encountered: