Headless Chrome workaround fails with Chrome 123.0.0.0
What is your Scenario?
Running Testcafe in AWS Codebuild, I experienced the issue with Chrome v122 described here: https://github.com/DevExpress/testcafe/issues/8145 - and using the workaround to pass in --headless=new fixed the issue.
Now with Chrome v123, running headless tests in codebuild throws this error: ERROR The Chrome 123.0.0.0 / Amazon Linux 2023.4.20240401 (Amazon Linux) browser disconnected. If you did not close the browser yourself, browser performance or network issues may be at fault. No changes to my configuration at all, the new chrome version introduced this problem.
What is the Current behavior?
Now with Chrome v123, running headless tests in codebuild throws this error: ERROR The Chrome 123.0.0.0 / Amazon Linux 2023.4.20240401 (Amazon Linux) browser disconnected. If you did not close the browser yourself, browser performance or network issues may be at fault.
Testcafe version: 3.5.0 Codebuild runtime: Node 18 Codebuild image: aws/codebuild/amazonlinux2-x86_64-standard:5.0 Image info- image_name="al2023-container" image_version="2023" image_arch="x86_64" image_file="al2023-container-2023.4.20240401.1-x86_64" image_stamp="380f-2370" image_date="20240401195520" recipe_name="al2023 container" recipe_id="d16da0fb-a0ea-71a0-40a9-5557-695a-45d9-6d4e30de"
Browser arg: chromium:/usr/bin/chromium --headless=new --no-sandbox --disable-dev-shm-usage --disable-setuid-sandbox --single-process --use-gl=swiftshader --no-first-run --no-zygote
^ Tried passing in the browser with & without quotes, with & without full path to chromium, passing in chrome instead of chromium; all throw the same error. Also tried passing in the original :headless instead of --headless=new and that throws the No inspectable targets error as mentioned in https://github.com/DevExpress/testcafe/issues/8145
What is the Expected behavior?
headless tests should run on Chrome v123 in Codebuild without error
What is the public URL of the test page? (attach your complete example)
no public url of my test page exists, issue is with browser connection
What is your TestCafe test code?
n/a - not an issue within test files
Your complete configuration file
{
"reporter": [
{
"name": "spec"
},
{
"name": "xunit",
"output": "spec_report.xml"
}
],
"disableMultipleWindows": true,
"filter": {
"fixtureMeta": {
"browser": "headless"
}
},
"skipJsErrors": true,
"concurrency": 2,
"browserInitTimeout": 480000,
"screenshotPath": "tmp/screenshots/",
"screenshotPathPattern": "${DATE}_${TIME}/test-${TEST_INDEX}/${USERAGENT}/${FILE_INDEX}.png",
"takeScreenshotsOnFails": true,
"port1": 1337,
"port2": 1338
}
Your complete test report
partial codebuild logs>>>
[Container] 2024/04/16 12:47:59.227726 Running command which testcafe /usr/local/bin/testcafe
[Container] 2024/04/16 12:47:59.234674 Running command which chromium /usr/bin/chromium
[Container] 2024/04/16 12:47:59.241373 Running command testcafe -v Using locally installed version of TestCafe. 3.5.0
[Container] 2024/04/16 12:48:00.282632 Running command export ENV_MODE=${ENVIRONMENT}
[Container] 2024/04/16 12:48:00.289295 Running command echo ${ENVIRONMENT} staging
[Container] 2024/04/16 12:48:00.294128 Phase complete: PRE_BUILD State: SUCCEEDED [Container] 2024/04/16 12:48:00.294144 Phase context status code: Message: [Container] 2024/04/16 12:48:00.327693 Entering phase BUILD [Container] 2024/04/16 12:48:00.328208 Running command testcafe -c ${CONCURRENCY} --config-file .testcaferc.json "${BROWSER}" ${TESTS} --fixture-meta browser=headless Using locally installed version of TestCafe. The "concurrency" and "filter" options from the configuration file will be ignored. ERROR The Chrome 123.0.0.0 / Amazon Linux 2023.4.20240401 (Amazon Linux) browser disconnected. If you did not close the browser yourself, browser performance or network issues may be at fault.
Screenshots
n/a
Steps to Reproduce
Run any tests in the AWS codebuild environment described above on latest headless chrome/chromium browser. Note: concurrency was set to 1 in this case.
TestCafe version
reproduced w/ 3.5.0 and 2.6.1
Node.js version
reproduced w/ 18 and 16
Command-line arguments
testcafe -c ${CONCURRENCY} --config-file .testcaferc.json "${BROWSER}" ${TESTS} --fixture-meta browser=headless
Browser name(s) and version(s)
Chrome 123.0.0.0
Platform(s) and version(s)
AWS Codebuild
Other
Buildspec configuration>>>
version: 0.2 batch: build-graph: - identifier: mod_forum_admin_tests env: variables: TESTS: tests/hus/moderation/forum-admin/ CONCURRENCY: 1 ignore-failure: true phases: install: runtime-versions: nodejs: 18 commands: - echo Image Info - cat /etc/image-id - echo Installing Chromium - wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm - sudo yum install -y ./google-chrome-stable_current_x86_64.rpm - sudo ln -s /usr/bin/google-chrome-stable /usr/bin/chromium - echo Installing Testcafe - npm install -g testcafe - npm install pre_build: commands: - which testcafe - which chromium - testcafe -v - export ENV_MODE=${ENVIRONMENT} - echo ${ENVIRONMENT} build: on-failure: CONTINUE commands: - testcafe -c ${CONCURRENCY} --config-file .testcaferc.json "${BROWSER}" ${TESTS} --fixture-meta browser=headless
^ see previous sections for complete browser argument
We were having same issue with a docker on version 3.5.0 which uses chromium 124.0.0.0
We've been able to run our tests by forcing the version to chromium 124.0.6367.60-r0 from alpine v3.19.
FROM testcafe/testcafe:3.5.0
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=124.0.6367.60-r0'
Hello @anthonyferroHU,
Is the problematic behavior reproduced locally? If not, then most likely, the issue relates to how this version of chromium works in the AWS Codebuild environment. Please try updating the chromium version as @ujjwol05 suggested and let us know you results.
This issue was automatically closed because there was no response to our request for more information from the original author. Currently, we don't have enough information to take action. Please reach out to us if you find the necessary information and are able to share it. We are also eager to know if you resolved the issue on your own and can share your findings with everyone.