testcafe: TestCafe fails with latest stable chrome version 122.0.6261.57

What is your Scenario?

Running testcafe with chrome:headless and the latest version of chrome installed

What is the Current behavior?

Error: Unable to open the "chrome:headless" browser due to the following error:

Error: No inspectable targets
    at defaultTarget (/home/circleci/project/node_modules/chrome-remote-interface/lib/chrome.js:48:23)
    at Chrome._fetchDebuggerURL (/home/circleci/project/node_modules/chrome-remote-interface/lib/chrome.js:194:28)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Chrome._start (/home/circleci/project/node_modules/chrome-remote-interface/lib/chrome.js:141:25)
    at BrowserConnection._runBrowser (/home/circleci/project/node_modules/testcafe/src/browser/connection/index.ts:290:32)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

What is the Expected behavior?

Tests run

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

any. google.com

What is your TestCafe test code?

fixture.page("https://www.google.com")

test("Test", async t => {
  await t.expect(true).ok();
});

Your complete configuration file

No response

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

1.Run testcafe with latest chrome

TestCafe version

3.5.0

Node.js version

No response

Command-line arguments

api runner

Browser name(s) and version(s)

Chrome 122.0.6261.57

Platform(s) and version(s)

Ubuntu

Other

No response

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Reactions: 15
  • Comments: 30 (1 by maintainers)

Most upvoted comments

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.

We found that the issue relates to the chrome --headless flag used in TestCafe chromium:headless.

As a workaround, please try running your tests with chromium --headless=new.

For example: chromium:headless becomes chromium --headless=new.

Please let us know if you encounter any issues.

thank you for the workaround, for me, there was another trick to be able to run with the new headless mode: testcafe 'chrome --headless=new' be aware of the quotes

We found that the issue relates to the chrome --headless flag used in TestCafe chromium:headless.

As a workaround, please try running your tests with chromium --headless=new.

For example: chromium:headless becomes chromium --headless=new.

Please let us know if you encounter any issues.

This workaround worked for us! Thanks, @Bayheck

In our case, we replaced chrome:headless with chromium --headless=new.

.circleci/config.yml

version: 2.1
orbs:
  browser-tools: circleci/browser-tools@1.4.8
  node: circleci/node@5.2.0
jobs:
  testcafe-chrome:
    docker:
      - image: cimg/node:lts-browsers
    resource_class: small
    steps:
      - browser-tools/install-chrome
      - checkout
      - run: npm i testcafe
      - run: npx -- testcafe chrome:headless test.js
workflows:
  run-tests:
    jobs:
      - testcafe-chrome

test.js

fixture`Test`.page`https://example.org`;
test("test", async (t) => {
  await t;
});

Logs

Env

Build-agent version 1.0.224070-c3d6799a (2024-02-22T14:18:38+0000).
System information:
 Server Version: 24.0.9
 Storage Driver: overlay2
  Backing Filesystem: xfs
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Kernel Version: 5.15.0-1053-aws
 Operating System: Ubuntu 20.04.6 LTS
 OSType: linux
 Architecture: x86_64

Starting container cimg/node:lts-browsers
cimg/node:lts-browsers:
  using image cimg/node@sha256:1abceae9c9423f54a372eb28a75694ecd0f436ea8eae703e8fb25f66827b23a1
  pull stats: Image was already available so the image was not pulled
  time to create container: 68ms
Warning: No authentication provided, using CircleCI credentials for pulls from Docker Hub.
  image is cached as cimg/node:lts-browsers, but refreshing...
lts-browsers: Pulling from cimg/node
Digest: sha256:1abceae9c9423f54a372eb28a75694ecd0f436ea8eae703e8fb25f66827b23a1
Status: Image is up to date for cimg/node:lts-browsers
Time to upload agent and config: 227.361325ms
Time to start containers: 236.573336ms

Chrome install

Unpacking libu2f-udev (1.1.10-3build2) ...
Selecting previously unselected package libvulkan1:amd64.
Preparing to unpack .../2-libvulkan1_1.3.204.1-2_amd64.deb ...
Unpacking libvulkan1:amd64 (1.3.204.1-2) ...
Selecting previously unselected package google-chrome-stable.
Preparing to unpack .../3-google-chrome-stable_122.0.6261.69-1_amd64.deb ...
Unpacking google-chrome-stable (122.0.6261.69-1) ...
Selecting previously unselected package mesa-vulkan-drivers:amd64.
Preparing to unpack .../4-mesa-vulkan-drivers_23.2.1-1ubuntu3.1~22.04.2_amd64.deb ...
Unpacking mesa-vulkan-drivers:amd64 (23.2.1-1ubuntu3.1~22.04.2) ...
Selecting previously unselected package systemd-hwe-hwdb.
Preparing to unpack .../5-systemd-hwe-hwdb_249.11.5_all.deb ...
Unpacking systemd-hwe-hwdb (249.11.5) ...
Setting up systemd (249.11-0ubuntu3.12) ...
/usr/lib/tmpfiles.d/static-nodes-permissions.conf:17: Failed to resolve group 'kvm'.
/usr/lib/tmpfiles.d/static-nodes-permissions.conf:18: Failed to resolve group 'kvm'.
/usr/lib/tmpfiles.d/static-nodes-permissions.conf:19: Failed to resolve group 'kvm'.
Setting up udev (249.11-0ubuntu3.12) ...
A chroot environment has been detected, udev not started.
Setting up libvulkan1:amd64 (1.3.204.1-2) ...
Setting up systemd-hwe-hwdb (249.11.5) ...
Setting up mesa-vulkan-drivers:amd64 (23.2.1-1ubuntu3.1~22.04.2) ...
Setting up systemd-sysv (249.11-0ubuntu3.12) ...
Setting up libu2f-udev (1.1.10-3build2) ...
Setting up libpam-systemd:amd64 (249.11-0ubuntu3.12) ...
Setting up google-chrome-stable (122.0.6261.69-1) ...
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/x-www-browser (x-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode
update-alternatives: using /usr/bin/google-chrome-stable to provide /usr/bin/google-chrome (google-chrome) in auto mode
Processing triggers for dbus (1.12.20-2ubuntu4.1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.5) ...
Google Chrome 122.0.6261.69  has been installed to /usr/bin/google-chrome-stable

Test run

ERROR Unable to open the "chrome:headless" browser due to the following error:

Error: No inspectable targets
    at defaultTarget (/home/circleci/project/node_modules/chrome-remote-interface/lib/chrome.js:48:23)
    at Chrome._fetchDebuggerURL (/home/circleci/project/node_modules/chrome-remote-interface/lib/chrome.js:194:28)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Chrome._start (/home/circleci/project/node_modules/chrome-remote-interface/lib/chrome.js:141:25)

Type "testcafe -h" for help.

Exited with code exit status 1

Also ran into this issue with TestCafe 3.5.0 when using the latest Chrome 122.0.6261.57 on a CircleCi Ubuntu container. Pinning our Chrome version to 121.0.6167.184 worked as a short-term fix.

I can confirm that using --headless=new with the docker example that I’ve created for the issue.

  1. I’ve updated the chromium version of my docker to 122.0.6261.94-r0
  2. It’s tested with docker run --rm testcafe:issue-8145 chromium --headless=new test.js and it ran well.
  3. I’ve tested with docker run --rm testcafe:issue-8145 chromium:headless test.js and it failed to confirm that it wasn’t fixed via a Chromium update in between.

I am not seeing it on my local machine, but am seeing it in CircleCI. I created this bare-bones repo with a CircleCI config to reproduce the issue: https://github.com/codambro/testcafe-issue-8145

We’re getting the same issue started yesterday with TestCafe 3.1.0 & it affects all the remote runs on Circle. I hope this can get significant attention to get us unblocked.

Experiencing the same problem

We found that the issue is related to old headless not providing the target list.

Here is the issue on Chromium: https://issues.chromium.org/issues/40256248.

Old headless is going to be discontinued.

However, the new headless is not yet stable enough at this moment for TestCafe to use it as default. The solution for now is to use the workaround above.

When I tried the workaround it did not work for me:

> E2E_RUN=true testcafe chromium --headless=new tests/e2e/ --hostname 127.0.0.1 --app 'pnpm dev'
ERROR Your Linux version does not have a graphic subsystem to run chromium with a GUI. You can launch the browser in headless mode. If you use a portable browser executable, specify the browser alias before the path instead of the 'path' prefix. For more information, see https://testcafe.io/documentation/402828/guides/concepts/browsers#test-in-headless-mode
Type "testcafe -h" for help.

Then I tried @omerhakanbilici variant. That one worked for me as well.

I’m still seeing the issue with Chrome 122.0.6261.69 Also - we’re installing TestCafe on one of CircleCi’s Docker runners, which uses cimg/node:18.9.1-browsers image. We’re not building the custom docker image ourselves.

Same here. Google Chrome 122.0.6261.57 has been installed to /usr/bin/google-chrome-stable ERROR Unable to open the "chrome:headless....

We’re having the issue with a freshly pull version of the test-café docker on version 3.5.0 which uses chromium 122.0.6261.57-r0

I’ve been able to return our tests to the normal by forcing the version to chromium 121.0.6167.184-r0 from alpine v3.19 community by inheriting from the original docker and adding these lines:

FROM testcafe/testcafe:3.5.0 as testcafe-chromium-fix

USER root
RUN apk --no-cache $ALPINE_REPOS --repository http://dl-cdn.alpinelinux.org/alpine/v3.19/community/ upgrade && \
 apk --no-cache $ALPINE_REPOS --repository http://dl-cdn.alpinelinux.org/alpine/v3.19/community/ add 'chromium=121.0.6167.184-r0'
USER user

and then using testcafe-chromium-fix:latest in my docker command.

Currently, we can’t reproduce the issue (chrome 122.0.6261.57 / node 18 - 20 / ubuntu 22.04 - 20.04 / testcafe 2.6.2 - 3.1.0 - 3.5.0).

As soon as we are able to reproduce it, we will address it immediately.

Also, Chrome has released a new version 122.0.6261.69. Does the issue occur with it?