Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Firefox with screenshots and videos activated may hang TestCafe on a test failure #8374

Open
AlexZagriychuk opened this issue Feb 11, 2025 · 1 comment
Labels
STATE: Need clarification An issue lacks information for further research. TYPE: bug The described behavior is considered as wrong (bug).

Comments

@AlexZagriychuk
Copy link

What is your Scenario?

Run TestCafe tests on Firefox with screenshots, videos, retries (quarantineMode) activated.

What is the Current behavior?

Sometimes execution hangs on the test failure.

  • When it hangs, it happens because both takeScreenshot and getVideoFrameData functions called the getScreenshotData almost at the same time and then "intercepted" each other's responses, and execution hanged (probably in one of the while loops in the _getPacket firefox/marionette-client).
    Logs (_logs_with_error.log):
[TMP][1739243838950] getVideoFrameData - before getScreenshotData
[TMP][1739243838952] takeScreenshot - before getScreenshotData
[TMP] _getResponse wrong packetNumber "502" (expected "501")
[TMP] _getResponse wrong packetNumber "501" (expected "502")

What is the Expected behavior?

TestCafe execution does not hang, test fails, and has screenshots and videos in the required folder

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

N/A

What is your TestCafe test code?

test-cafe-bug.zip

Your complete configuration file

In the attached archive

Your complete test report

In the attached archive

Screenshots

No response

Steps to Reproduce

  • Download the attached archive with the simple TestCafe repo setup to reproduce this issue
  • npm i
  • (Optional) add a few "debug" logs which seem to have helped me pin point the issue
    • Open node_modules/testcafe/lib/browser/provider/built-in/dedicated/firefox/marionette-client/index.js, go to the _getResponse fn and replace the while loop with:
          while (!responsePacket.body || responsePacket.body[1] !== packetNumber) {
             console.log(`[TMP] _getResponse wrong packetNumber "${responsePacket.body[1]}" (expected "${packetNumber}")`)
             responsePacket = await this._getPacket();
             console.log(`[TMP] _getResponse wrong packetNumber - responsePacket for retry (packetNumber: "${responsePacket.body[1]}"):\n${JSON.stringify(responsePacket, null, 2)}`)
         }
    
    • Open the node_modules/testcafe/lib/browser/provider/built-in/dedicated/base.js file, go to the takeScreenshot fn and add a log console.log(`[TMP][${Date.now()}] takeScreenshot - before getScreenshotData`) before the await browserClient.getScreenshotData
    • Open the node_modules/testcafe/lib/browser/provider/built-in/dedicated/firefox/index.js file, go to the getVideoFrameData fn and add a log console.log(`[TMP][${Date.now()}] getVideoFrameData - before getScreenshotData`) before return marionetteClient.getScreenshotData()
  • Run the test multiple times until the execution hangs (2-10 times) rm -rf artifacts; DEBUG=testcafe:* npx testcafe firefox:headless Tests/. --page-load-timeout 15000 --skip-js-errors > _logs.log 2>&1

TestCafe version

3.7.0

Node.js version

No response

Command-line arguments

firefox:headless Tests/. --page-load-timeout 15000 --skip-js-errors

Browser name(s) and version(s)

No response

Platform(s) and version(s)

No response

Other

No response

@AlexZagriychuk AlexZagriychuk added the TYPE: bug The described behavior is considered as wrong (bug). label Feb 11, 2025
@testcafe-need-response-bot testcafe-need-response-bot bot added the STATE: Need response An issue that requires a response or attention from the team. label Feb 11, 2025
@Bayheck
Copy link
Collaborator

Bayheck commented Feb 14, 2025

Hello,

Your archive does not include config. Please update the archive.

In addition, please share the following information: OS and its version, Firefox version, and Node version.

Image

@Bayheck Bayheck added STATE: Need clarification An issue lacks information for further research. and removed STATE: Need response An issue that requires a response or attention from the team. labels Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STATE: Need clarification An issue lacks information for further research. TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

No branches or pull requests

2 participants