javamaventestcafeaws-codepipelinegoogle-chrome-headless

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


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] > shop-e2e@1.0.0 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.


Solution

  • 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