testcafe ERROR Unable to open the "chrome:headless" browser

227 Views Asked by At

I have a maven project running end-to-end tests on the integration-test phase with testcafe

I'm getting ERROR Unable to open the "chrome:headless" browser on the aws codepipeline for 2 days, before that, without any change on the pipeline it was running successfully.

command for testcafe: testcafe chrome:headless

To run npm commands in the maven project I use the com.github.eirslett:frontend-maven-plugin:1.15.0 plugin and this was part of the integration-test phase on my pipeline.

[INFO] > [email protected] test-shop-chrome
[INFO] > testcafe chrome:headless
[INFO] 
[INFO] Using CONFIG: {"baseUrl":"http://localhost:18888"}
[INFO] ERROR Unable to open the "chrome:headless" browser due to the following error:
[INFO] 
[INFO] Error: No inspectable targets
[INFO]     at defaultTarget (/codebuild/output/src123/src/git-codecommit.eu-central-1.amazonaws.com/v1/repos/shop/src/test/e2e/node_modules/chrome-remote-interface/lib/chrome.js:48:23)
[INFO]     at Chrome._fetchDebuggerURL (/codebuild/output/src123/src/git-codecommit.eu-central-1.amazonaws.com/v1/repos/shop/src/test/e2e/node_modules/chrome-remote-interface/lib/chrome.js:193:28)
[INFO]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[INFO]     at Chrome._start (/codebuild/output/src123/src/git-codecommit.eu-central-1.amazonaws.com/v1/repos/shop/src/test/e2e/node_modules/chrome-remote-interface/lib/chrome.js:140:25)
[INFO] 
[INFO] Type "testcafe -h" for help.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  03:10 min
[INFO] Finished at: 2024-02-23T10:29:34Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.15.0:npm (e2e-npm-test) on project shop: Failed to run task: 'npm run test-shop-chrome' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.15.0:npm (e2e-npm-test) on project shop: Failed to run task
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)

First, I thought there was a problem with installing Chrome but it installed successfully.

Afterwards, I updated the frontend-maven-plugin version and there was no change as well.

I'm not sure what could've been changed, any help would be appreciated.

3

There are 3 best solutions below

0
omerhakanbilici On BEST ANSWER

as @Pavel Morozov stated in his comment, testcafe is aware of the problem and they are working on the fix.

As a workaround from the github issue I had to use the new headless mode of Chrome(it's also required for Chromium)

testcafe 'chrome --headless=new'

quotes are needed

1
Hemal Pandya On

You should provide your code. so I can give you the way how to open chrome in headless mode. You can cross-verify with how you do it

from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--headless=new")

Please Give me feedback as it is my first time answering

1
user23471458 On

I ran into this as well when running testcafe on chromium:headless in debian. I noticed it went from version 121.0.6167.160 when it was last successful to 122.0.6261.57 today.

When I install the older version, I don't run into the issue. Not a solution, but a workaround for now.