DevExpress / testcafe

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

Testcafe hangs on taking screenshot #8310

Closed getahead closed 3 weeks ago

getahead commented 1 month ago

What is your Scenario?

Testcafe hangs trying to capture a screenshot in google chrome v130. Meanwhile, test executes well in Firefox

What is the Current behavior?

Testcafe fails to create a screenshot with the following log:

2024-10-22T13:20:14.917Z testcafe:browser-tools:exec NativeBinaryHasFailedError: The find-window process failed with the 103 exit code.
Process output:

Exit code: 103
    at runWithMacApp (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe-browser-tools/src/utils/exec.js:113:19)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at execFile (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe-browser-tools/src/utils/exec.js:126:20)
    at runFindWindowBinary (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe-browser-tools/src/api/find-window.js:23:16)
    at default_1 (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe-browser-tools/src/api/find-window.js:43:15)
    at checkAuthentication (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe/src/cli/authentication-helper.ts:28:26)
    at authenticationHelper (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe/src/cli/authentication-helper.ts:43:29)
    at Runner._checkRequiredPermissions (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe/src/runner/index.js:652:27)
    at Runner._validateBrowsers (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe/src/runner/index.js:318:13)
    at Runner._validateRunOptions (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe/src/runner/index.js:486:9)
    at Runner._prepareOptions (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe/src/runner/index.js:599:9)
    at Runner._getRunTaskOptions (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe/src/runner/index.js:603:9) {
  data: {
    binary: 'find-window',
    exitCode: 103,
    output: '\nExit code: 103\n'
  },
  code: 'E003'
}
2024-10-22T13:20:14.924Z testcafe:hammerhead:proxy:router register route GET /hammerhead.js
2024-10-22T13:20:14.932Z testcafe:hammerhead:proxy:router register route GET /transport-worker.js
2024-10-22T13:20:14.932Z testcafe:hammerhead:proxy:router register route GET /worker-hammerhead.js
2024-10-22T13:20:14.933Z testcafe:hammerhead:proxy:router register route GET /messaging
2024-10-22T13:20:14.933Z testcafe:hammerhead:proxy:router register route POST /messaging
2024-10-22T13:20:14.933Z testcafe:hammerhead:proxy:router register route OPTIONS /messaging
2024-10-22T13:20:14.933Z testcafe:hammerhead:proxy:router register route GET /task.js
2024-10-22T13:20:14.933Z testcafe:hammerhead:proxy:router register route GET /iframe-task.js
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route GET /browser/connect/{id}
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route GET /browser/heartbeat/{id}
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route GET /browser/idle/{id}
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route GET /browser/idle-forced/{id}
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route GET /browser/status/{id}
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route GET /browser/status-done/{id}
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route GET /browser/init-script/{id}
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route POST /browser/init-script/{id}
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route GET /browser/active-window-id/{id}
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route POST /browser/active-window-id/{id}
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route POST /browser/ensure-window-in-native-automation/{id}
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route POST /browser/close-window/{id}
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route POST /browser/open-file-protocol/{id}
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route POST /browser/dispatch-native-automation-event/{id}
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route POST /parse-selector/{id}
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route POST /browser/dispatch-native-automation-event-sequence/{id}
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route GET /browser/connect
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route GET /browser/connect/
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route GET /service-worker.js
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route GET /browser/assets/index.js
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route GET /browser/assets/styles.css
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route GET /browser/assets/logo.svg
2024-10-22T13:20:14.937Z testcafe:hammerhead:proxy:router register route GET /about:error
2024-10-22T13:20:14.938Z testcafe:hammerhead:proxy:router register route GET /testcafe-core.js
2024-10-22T13:20:14.938Z testcafe:hammerhead:proxy:router register route GET /testcafe-driver.js
2024-10-22T13:20:14.939Z testcafe:hammerhead:proxy:router register route GET /testcafe-legacy-runner.js
2024-10-22T13:20:14.940Z testcafe:hammerhead:proxy:router register route GET /testcafe-automation.js
2024-10-22T13:20:14.941Z testcafe:hammerhead:proxy:router register route GET /testcafe-ui.js
2024-10-22T13:20:14.941Z testcafe:hammerhead:proxy:router register route GET /testcafe-ui-sprite.png
2024-10-22T13:20:14.941Z testcafe:hammerhead:proxy:router register route GET /testcafe-ui-sprite.svg
2024-10-22T13:20:14.941Z testcafe:hammerhead:proxy:router register route GET /favicon.ico
2024-10-22T13:20:14.941Z testcafe:hammerhead:proxy:router register route GET /testcafe-ui-styles.css
2024-10-22T13:20:14.972Z testcafe:bootstrapper tests compilation took 22 ms
2024-10-22T13:20:14.972Z testcafe:utils:temp-directory Found temp directories: [ 'chrome-profile-71934znpaL55sW3Cp' ]
2024-10-22T13:20:14.972Z testcafe:utils:temp-directory:lockfile Failed to init lockfile /var/folders/wl/l124v7_x167ccm2lc68jmx7w0000gn/T/testcafe/chrome-profile-71934znpaL55sW3Cp/.testcafe-lockfile
2024-10-22T13:20:14.973Z testcafe:utils:temp-directory:lockfile Error: EEXIST: file already exists, open '/var/folders/wl/l124v7_x167ccm2lc68jmx7w0000gn/T/testcafe/chrome-profile-71934znpaL55sW3Cp/.testcafe-lockfile'
    at Object.openSync (node:fs:573:18)
    at Object.writeFileSync (node:fs:2380:35)
    at LockFile._open (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe/src/utils/temp-directory/lockfile.js:17:16)
    at LockFile.init (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe/src/utils/temp-directory/lockfile.js:46:18)
    at TempDirectory._findFreeTmpDir (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe/src/utils/temp-directory/index.js:40:26)
    at TempDirectory.init (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe/src/utils/temp-directory/index.js:89:48)
    at Function.createDirectory (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe/src/utils/temp-directory/index.js:73:9)
    at default_1 (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe/src/browser/provider/built-in/dedicated/chrome/create-temp-profile.ts:7:28)
    at ChromeRuntimeInfo.createTempProfile (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe/src/browser/provider/built-in/dedicated/chrome/runtime-info.ts:23:16)
    at Function.create (/Users/mpetrov/projects/testcafe_reproduction/node_modules/testcafe/src/browser/provider/built-in/dedicated/chrome/runtime-info.ts:30:42)
2024-10-22T13:20:14.974Z testcafe:utils:temp-directory Temp directory path:  /var/folders/wl/l124v7_x167ccm2lc68jmx7w0000gn/T/testcafe/chrome-profile-87710GuRV1pI9s122
2024-10-22T13:20:15.026Z testcafe:browser-tools:open 'open -n -a "/Applications/Google Chrome.app" --args http://localhost:52851/browser/connect/Y4X9b6p --remote-debugging-port=52871 --user-data-dir=/var/folders/wl/l124v7_x167ccm2lc68jmx7w0000gn/T/testcafe/chrome-profile-87710GuRV1pI9s122 --disable-popup-blocking --disable-infobars --disable-session-crashed-bubble --no-first-run --new-window --disable-background-networking --disable-ipc-flooding-protection --disable-background-timer-throttling --disable-backgrounding-occluded-windows --autoplay-policy=no-user-gesture-required --disable-search-engine-choice-screen'
2024-10-22T13:20:15.881Z testcafe:browser:connection:Y4X9b6p status changed to 'ready'
2024-10-22T13:20:15.952Z testcafe:browser:provider:built-in:chrome:browser-client:Y4X9b6p CDP method 'PageEnable' took 869 μs
2024-10-22T13:20:15.954Z testcafe:native-automation starting
2024-10-22T13:20:15.959Z testcafe:native-automation started
2024-10-22T13:20:15.988Z testcafe:browser:provider:built-in:chrome:browser-client:Y4X9b6p CDP method 'PageEnable' took 452 μs
2024-10-22T13:20:15.996Z testcafe:browser:provider:chrome browser opened Y4X9b6p
2024-10-22T13:20:16.923Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.13 interception-job-1.0 request http://localhost:52851/browser/status/Y4X9b6p
2024-10-22T13:20:16.925Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.14 interception-job-2.0 request http://localhost:52851/browser/init-script/Y4X9b6p
2024-10-22T13:20:16.936Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.13 interception-job-1.0 response http://localhost:52851/browser/status/Y4X9b6p
2024-10-22T13:20:16.942Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.14 interception-job-2.0 response http://localhost:52851/browser/init-script/Y4X9b6p
2024-10-22T13:20:17.913Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.15 interception-job-3.0 request http://localhost:52851/browser/heartbeat/Y4X9b6p
2024-10-22T13:20:17.917Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.15 interception-job-3.0 response http://localhost:52851/browser/heartbeat/Y4X9b6p
2024-10-22T13:20:17.951Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.16 interception-job-4.0 request http://localhost:52851/browser/init-script/Y4X9b6p
2024-10-22T13:20:17.955Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.17 interception-job-5.0 request http://localhost:52851/browser/status/Y4X9b6p
2024-10-22T13:20:17.958Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.16 interception-job-4.0 response http://localhost:52851/browser/init-script/Y4X9b6p
2024-10-22T13:20:17.960Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.17 interception-job-5.0 response http://localhost:52851/browser/status/Y4X9b6p
2024-10-22T13:20:18.964Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.18 interception-job-6.0 request http://localhost:52851/browser/init-script/Y4X9b6p
2024-10-22T13:20:18.970Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.18 interception-job-6.0 response http://localhost:52851/browser/init-script/Y4X9b6p
2024-10-22T13:20:18.972Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.19 interception-job-7.0 request http://localhost:52851/browser/status/Y4X9b6p
2024-10-22T13:20:18.973Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.20 interception-job-8.0 request http://localhost:52851/browser/init-script/Y4X9b6p
2024-10-22T13:20:18.974Z testcafe:browser:connection:Y4X9b6p status changed to 'opened'
2024-10-22T13:20:18.979Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.19 interception-job-7.0 response http://localhost:52851/browser/status/Y4X9b6p
2024-10-22T13:20:18.979Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.20 interception-job-8.0 response http://localhost:52851/browser/init-script/Y4X9b6p
2024-10-22T13:20:19.913Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.21 interception-job-9.0 request http://localhost:52851/browser/heartbeat/Y4X9b6p
2024-10-22T13:20:19.920Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.21 interception-job-9.0 response http://localhost:52851/browser/heartbeat/Y4X9b6p
2024-10-22T13:20:19.986Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.22 interception-job-10.0 request http://localhost:52851/browser/init-script/Y4X9b6p
2024-10-22T13:20:19.988Z testcafe:native-automation:request-pipeline:service-request requestPaused 87732.23 interception-job-11.0 request http://localhost:52851/browser/status/Y4X9b6p

What is the Expected behavior?

testcafe makes a screenshot and continues tests execution without hanging

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

https://devexpress.github.io/testcafe/example/

What is your TestCafe test code?

//  index.js
fixture('Getting Started')
    .page('https://devexpress.github.io/testcafe/example');

test('My first test', async t => {
    await t.takeScreenshot({ path: 'screenshots/chrome/test.png' });
    await t
        .typeText('#developer-name', 'John Smith')
        .click('#submit-button');
});

Your complete configuration file

No response

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

  1. add t.takeScreenshot to any of your tests or use code from the "TestCafe test code" section
  2. run the test in chrome@130 testcafe chrome --disable-search-engine-choice-screen index.js
  3. see what happens

TestCafe version

3.7.0-rc.1

Node.js version

20.18.0, 16.20.0

Command-line arguments

testcafe chrome --disable-search-engine-choice-screen

Browser name(s) and version(s)

Chrome 130

Platform(s) and version(s)

mac os 14.05, Fedora 33

Other

No response

github-actions[bot] commented 1 month ago

We appreciate you taking the time to share information about this issue. We reproduced the bug and added this ticket to our internal task queue. We'll update this thread once we have news.

Bayheck commented 3 weeks ago

Hello, the issue has been fixed in https://github.com/DevExpress/testcafe/issues/8300.

We are currently preparing a TestCafe release that includes this fix, but please note that an ETA might be misleading.

In the meantime, you can try using TestCafe 3.7.0-rc.2 as a temporary solution.

I will be closing this issue now.