Skip to content

Conversation

MikeMcC399
Copy link
Collaborator

Situation

Google targets web app testing with their Chrome for Testing flavor of Chrome.

Currently the cypress/factory build process supports the installation of Google Chrome by specifying CHROME_VERSION. It does not support Chrome for Testing.

Cypress introduced support for Chrome for Testing in [email protected].

Google has restricted the use of the --load-extension flag in Chrome version 137 and above and continues to allow its use in Chrome for Testing. See also [email protected] changelog.

The directory examples/chrome-for-testing shows how to add Chrome for Testing to a custom Cypress Docker image using shell commands in a Dockerfile. This diverges from the method used to install other browsers through cypress/factory that require only a single version parameter to install any of the browsers: Chrome, Edge or Firefox.

Change

Add an option to install the Google Chrome for Testing browser using the cypress/factory build process.

  • Chrome for Testing is downloaded from https://storage.googleapis.com/chrome-for-testing-public as defined in Chrome for Testing > JSON API endpoints. Puppeteer is not used.

  • The Docker ARG parameter is CHROME_FOR_TESTING_VERSION

  • Factory version is bumped to 5.11.0

  • CircleCI contains an additional test: test-factory-chrome-for-testing

Verification

cd factory
docker compose --progress plain build factory
docker compose --progress plain build chrome-for-testing
docker compose --progress plain build cypress-chrome-for-testing
cd test-project
set -a && . ../.env && set +a
docker compose --progress plain run --build --rm test-factory-chrome-for-testing

@cypress-app-bot
Copy link

Copy link
Contributor

@AtofStryker AtofStryker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @MikeMcC399. I'm having some trouble running the verification steps on the chrome for testing example. It looks like none of the browsers are installed in the image? I am thinking I missed something here

Screenshot 2025-06-16 at 4 01 30 PM

@MikeMcC399
Copy link
Collaborator Author

MikeMcC399 commented Jun 17, 2025

@AtofStryker

If you're running the verification steps that I provided, then the only browser that is supposed to be installed is chrome-for-testing. If it's not getting installed, then either an old cypress/factory image is being used or the environment variable CHROME_FOR_TESTING_VERSION isn't being set. The logs you posted don't show that phase, so I can't diagnose further.

Here is a simplified set of steps you can try, together with logs:

git clone --branch factory/cft https://github.com/MikeMcC399/cypress-docker-images
cd cypress-docker-images
cd factory
docker compose build factory
cd test-project
set -a && . ../.env && set +a
docker compose run --build --rm test-factory-chrome-for-testing
$ git clone --branch factory/cft https://github.com/MikeMcC399/cypress-docker-images
cd cypress-docker-images
cd factory
docker compose build factory
cd test-project
set -a && . ../.env && set +a
docker compose run --build --rm test-factory-chrome-for-testing
Cloning into 'cypress-docker-images'...
remote: Enumerating objects: 6698, done.
remote: Counting objects: 100% (956/956), done.
remote: Compressing objects: 100% (243/243), done.
remote: Total 6698 (delta 818), reused 745 (delta 713), pack-reused 5742 (from 3)
Receiving objects: 100% (6698/6698), 1.94 MiB | 6.44 MiB/s, done.
Resolving deltas: 100% (4340/4340), done.
[+] Building 76.3s (10/10) FINISHED
 => [internal] load local bake definitions                                                                                                                                                                   0.0s
 => => reading from stdin 631B                                                                                                                                                                               0.0s
 => [internal] load build definition from factory.Dockerfile                                                                                                                                                 0.0s
 => => transferring dockerfile: 5.82kB                                                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/debian:12.11-slim                                                                                                                                         1.6s
 => [internal] load .dockerignore                                                                                                                                                                            0.0s
 => => transferring context: 2B                                                                                                                                                                              0.0s
 => [1/3] FROM docker.io/library/debian:12.11-slim@sha256:e5865e6858dacc255bead044a7f2d0ad8c362433cfaa5acefb670c1edf54dfef                                                                                   5.2s
 => => resolve docker.io/library/debian:12.11-slim@sha256:e5865e6858dacc255bead044a7f2d0ad8c362433cfaa5acefb670c1edf54dfef                                                                                   0.0s
 => => sha256:e5865e6858dacc255bead044a7f2d0ad8c362433cfaa5acefb670c1edf54dfef 8.56kB / 8.56kB                                                                                                               0.0s
 => => sha256:f957d7d19c4171aded89330899c1501c03707d879f200001aa47af87d98b3c70 1.02kB / 1.02kB                                                                                                               0.0s
 => => sha256:6ba4ddadd113af5ae1a6014da46e3074d5adcdf58a973c8b653f54b1374778cb 453B / 453B                                                                                                                   0.0s
 => => sha256:dad67da3f26bce15939543965e09c4059533b025f707aad72ed3d3f3a09c66f8 28.23MB / 28.23MB                                                                                                             3.7s
 => => extracting sha256:dad67da3f26bce15939543965e09c4059533b025f707aad72ed3d3f3a09c66f8                                                                                                                    1.4s
 => [internal] load build context                                                                                                                                                                            0.0s
 => => transferring context: 19.65kB                                                                                                                                                                         0.0s
 => [2/3] RUN ls -la /root   && chmod 777 /root   && apt-get update   && apt-get install --no-install-recommends -y     xvfb     libglib2.0-0     libnss3     libatk1.0-0     libatk-bridge2.0-0     libcu  67.1s
 => [3/3] COPY ./installScripts /opt/installScripts                                                                                                                                                          0.0s
 => exporting to image                                                                                                                                                                                       1.9s
 => => exporting layers                                                                                                                                                                                      1.9s
 => => writing image sha256:3dcebddef0fe8897f4464cfc8764cab11d1d788db36b52ede0246f5a4e88619c                                                                                                                 0.0s
 => => naming to docker.io/cypress/factory:latest                                                                                                                                                            0.0s
 => => naming to docker.io/cypress/factory:5.11.0                                                                                                                                                            0.0s
 => => naming to docker.io/cypress/factory                                                                                                                                                                   0.0s
 => resolving provenance for metadata file                                                                                                                                                                   0.0s
[+] Building 1/1
 ✔ cypress/factory  Built                                                                                                                                                                                    0.0s
[+] Creating 1/1
 ✔ Network test-project_default  Created                                                                                                                                                                     0.0s
[+] Building 122.2s (22/22) FINISHED
 => [internal] load local bake definitions                                                                                                                                                                   0.0s
 => => reading from stdin 680B                                                                                                                                                                               0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                         0.0s
 => => transferring dockerfile: 253B                                                                                                                                                                         0.0s
 => [internal] load metadata for docker.io/cypress/factory:5.11.0                                                                                                                                            0.0s
 => [internal] load .dockerignore                                                                                                                                                                            0.0s
 => => transferring context: 2B                                                                                                                                                                              0.0s
 => [1/6] FROM docker.io/cypress/factory:5.11.0                                                                                                                                                              0.0s
 => [internal] load build context                                                                                                                                                                            0.0s
 => => transferring context: 88.83kB                                                                                                                                                                         0.0s
 => [ 2/26] ONBUILD RUN bash /opt/installScripts/node/install-node-version.sh 22.16.0                                                                                                                       14.7s
 => [ 3/26] ONBUILD RUN node /opt/installScripts/yarn/install-yarn-version.js ${YARN_VERSION}                                                                                                                0.3s
 => [ 4/26] ONBUILD RUN node /opt/installScripts/chrome/install-chrome-version.js ${CHROME_VERSION}                                                                                                          0.4s
 => [ 5/26] ONBUILD RUN node /opt/installScripts/chrome-for-testing/install-chrome-for-testing-version.js 137.0.7151.70                                                                                     50.7s
 => [ 6/26] ONBUILD RUN node /opt/installScripts/edge/install-edge-version.js ${EDGE_VERSION}                                                                                                                0.4s
 => [ 7/26] ONBUILD RUN node /opt/installScripts/firefox/install-firefox-version.js ${FIREFOX_VERSION}                                                                                                       0.3s
 => [ 8/26] ONBUILD RUN node /opt/installScripts/geckodriver/install-geckodriver-version.js ${GECKODRIVER_VERSION}                                                                                           0.3s
 => [ 9/26] ONBUILD RUN node /opt/installScripts/cypress/install-cypress-version.js ${CYPRESS_VERSION}                                                                                                       0.3s
 => [10/26] ONBUILD RUN apt-get purge -y --auto-remove     curl     bzip2     gnupg     dirmngr  && rm -rf /usr/share/doc   && rm -rf /var/lib/apt/lists/*   && rm -rf /opt/installScripts                   2.3s
 => [11/26] RUN echo "current user: $(whoami)"                                                                                                                                                               0.3s
 => [12/26] COPY . /opt/app                                                                                                                                                                                  0.0s
 => [13/26] WORKDIR /opt/app                                                                                                                                                                                 0.0s
 => [14/26] RUN npm install --save-dev cypress                                                                                                                                                              43.8s
 => [15/26] RUN ./node_modules/.bin/cypress verify                                                                                                                                                           1.9s
 => exporting to image                                                                                                                                                                                       6.1s
 => => exporting layers                                                                                                                                                                                      6.1s
 => => writing image sha256:fd91edc68e48cd2ffa0872655b05a123328d8f7653a85b3ddfa04e0f4525c163                                                                                                                 0.0s
 => => naming to docker.io/library/test-project-test-factory-chrome-for-testing                                                                                                                              0.0s
 => resolving provenance for metadata file                                                                                                                                                                   0.0s

> [email protected] test
> cypress run -b chrome-for-testing


DevTools listening on ws://127.0.0.1:35151/devtools/browser/e310acf1-be38-4a64-bf73-f186e5cdb564

====================================================================================================

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:        14.4.1                                                                         │
  │ Browser:        Chrome for Testing 137 (headless)                                              │
  │ Node Version:   v22.16.0 (/usr/local/bin/node)                                                 │
  │ Specs:          20 found (1-getting-started/todo.cy.js, 2-advanced-examples/actions.cy.js, 2-a │
  │                 dvanced-examples/aliasing.cy.js, 2-advanced-examples/assertions.cy.js, 2-advan │
  │                 ced-examples/connectors.cy.js, 2-advanced-examples/cookies.cy.js, 2-advanced-e │
  │                 xamples/cypress_api.cy....)                                                    │
  │ Searched:       cypress/e2e/**/*.cy.{js,jsx,ts,tsx}                                            │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘

@AtofStryker
Copy link
Contributor

@MikeMcC399 I think I know whats going on. I am on arm64, which isn't supported for chrome-for-testing. Going to post the logs for posterity, but I have a feeling the install script is silently failing. Going to test on my amd64 machine in a few

docker compose build factory
Compose can now delegate builds to bake for better performance.
 To do so, set COMPOSE_BAKE=true.
[+] Building 2.7s (9/9) FINISHED                                                                                                                                                                 docker:desktop-linux
 => [factory internal] load build definition from factory.Dockerfile                                                                                                                                             0.0s
 => => transferring dockerfile: 5.86kB                                                                                                                                                                           0.0s
 => [factory internal] load metadata for docker.io/library/debian:12.11-slim                                                                                                                                     0.9s
 => [factory internal] load .dockerignore                                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                                                  0.0s
 => [factory 1/3] FROM docker.io/library/debian:12.11-slim@sha256:e5865e6858dacc255bead044a7f2d0ad8c362433cfaa5acefb670c1edf54dfef                                                                               0.0s
 => => resolve docker.io/library/debian:12.11-slim@sha256:e5865e6858dacc255bead044a7f2d0ad8c362433cfaa5acefb670c1edf54dfef                                                                                       0.0s
 => [factory internal] load build context                                                                                                                                                                        0.0s
 => => transferring context: 2.56kB                                                                                                                                                                              0.0s
 => CACHED [factory 2/3] RUN ls -la /root   && chmod 777 /root   && apt-get update   && apt-get install --no-install-recommends -y     xvfb     libglib2.0-0     libnss3     libatk1.0-0     libatk-bridge2.0-0  0.0s
 => CACHED [factory 3/3] COPY ./installScripts /opt/installScripts                                                                                                                                               0.0s
 => [factory] exporting to image                                                                                                                                                                                 1.7s
 => => exporting layers                                                                                                                                                                                          0.0s
 => => exporting manifest sha256:ef263cb8e13fe9406d059e70b515b43a4ce89f1691061b3b6ac45062fb396426                                                                                                                0.0s
 => => exporting config sha256:d5d855577eb4e9ad3e5595c8c0f28221de863ff0e4a389b2f7619cb44e5990e9                                                                                                                  0.0s
 => => exporting attestation manifest sha256:a690891d546ceba04900cf70c0eaef62645fe5b3f52b90ccaff1fdd5b15d99cd                                                                                                    0.0s
 => => exporting manifest list sha256:c0edbce710c583964ab52d09783d1bb64c721135ad2edc16998c6838baebd2c8                                                                                                           0.0s
 => => naming to docker.io/cypress/factory:latest                                                                                                                                                                0.0s
 => => unpacking to docker.io/cypress/factory:latest                                                                                                                                                             1.7s
 => => naming to docker.io/cypress/factory:5.11.0                                                                                                                                                                0.0s
 => => unpacking to docker.io/cypress/factory:5.11.0                                                                                                                                                             0.0s
 => [factory] resolving provenance for metadata file                                                                                                                                                             0.0s
[+] Building 1/1
 ✔ factory  Built  

docker compose run --build --rm test-factory-chrome-for-testing                                                                           

Compose can now delegate builds to bake for better performance.
 To do so, set COMPOSE_BAKE=true.
[+] Building 5.1s (21/21) FINISHED                                                                                                                                                               docker:desktop-linux
 => [test-factory-chrome-for-testing internal] load build definition from Dockerfile                                                                                                                             0.0s
 => => transferring dockerfile: 290B                                                                                                                                                                             0.0s
 => [test-factory-chrome-for-testing internal] load metadata for docker.io/cypress/factory:5.11.0                                                                                                                0.0s
 => [test-factory-chrome-for-testing internal] load .dockerignore                                                                                                                                                0.0s
 => => transferring context: 2B                                                                                                                                                                                  0.0s
 => [test-factory-chrome-for-testing 1/6] FROM docker.io/cypress/factory:5.11.0@sha256:c0edbce710c583964ab52d09783d1bb64c721135ad2edc16998c6838baebd2c8                                                          0.7s
 => => resolve docker.io/cypress/factory:5.11.0@sha256:c0edbce710c583964ab52d09783d1bb64c721135ad2edc16998c6838baebd2c8                                                                                          0.7s
 => [test-factory-chrome-for-testing internal] load build context                                                                                                                                                0.0s
 => => transferring context: 3.60kB                                                                                                                                                                              0.0s
 => CACHED [test-factory-chrome-for-testing  2/26] ONBUILD RUN bash /opt/installScripts/node/install-node-version.sh 22.16.0                                                                                     0.0s
 => CACHED [test-factory-chrome-for-testing  3/26] ONBUILD RUN node /opt/installScripts/yarn/install-yarn-version.js ${YARN_VERSION}                                                                             0.0s
 => CACHED [test-factory-chrome-for-testing  4/26] ONBUILD RUN node /opt/installScripts/chrome/install-chrome-version.js ${CHROME_VERSION}                                                                       0.0s
 => CACHED [test-factory-chrome-for-testing  5/26] ONBUILD RUN node /opt/installScripts/chrome-for-testing/install-chrome-for-testing-version.js 137.0.7151.70                                                   0.0s
 => CACHED [test-factory-chrome-for-testing  6/26] ONBUILD RUN node /opt/installScripts/edge/install-edge-version.js ${EDGE_VERSION}                                                                             0.0s
 => CACHED [test-factory-chrome-for-testing  7/26] ONBUILD RUN node /opt/installScripts/firefox/install-firefox-version.js ${FIREFOX_VERSION}                                                                    0.0s
 => CACHED [test-factory-chrome-for-testing  8/26] ONBUILD RUN node /opt/installScripts/geckodriver/install-geckodriver-version.js ${GECKODRIVER_VERSION}                                                        0.0s
 => CACHED [test-factory-chrome-for-testing  9/26] ONBUILD RUN node /opt/installScripts/cypress/install-cypress-version.js ${CYPRESS_VERSION}                                                                    0.0s
 => CACHED [test-factory-chrome-for-testing 10/26] ONBUILD RUN apt-get purge -y --auto-remove     curl     bzip2     gnupg     dirmngr  && rm -rf /usr/share/doc   && rm -rf /var/lib/apt/lists/*   && rm -rf /  0.0s
 => CACHED [test-factory-chrome-for-testing 11/26] RUN echo "current user: $(whoami)"                                                                                                                            0.0s
 => CACHED [test-factory-chrome-for-testing 12/26] COPY . /opt/app                                                                                                                                               0.0s
 => CACHED [test-factory-chrome-for-testing 13/26] WORKDIR /opt/app                                                                                                                                              0.0s
 => CACHED [test-factory-chrome-for-testing 14/26] RUN npm install --save-dev cypress                                                                                                                            0.0s
 => CACHED [test-factory-chrome-for-testing 15/26] RUN ./node_modules/.bin/cypress verify                                                                                                                        0.0s
 => [test-factory-chrome-for-testing] exporting to image                                                                                                                                                         4.3s
 => => exporting layers                                                                                                                                                                                          0.0s
 => => exporting manifest sha256:0995527dce6b1406eac4e4d2d3aaf4b39b7059c27f6adba5cc325314735ca900                                                                                                                0.0s
 => => exporting config sha256:ec45c52342063945713ab3b1250bc3f0860ffed81bb533aeac9a5d120046fd29                                                                                                                  0.0s
 => => exporting attestation manifest sha256:1ff4c6e40d56f3df7b59815762fe7c18ae25cb1311d1d46300fc498d11b0eff6                                                                                                    0.0s
 => => exporting manifest list sha256:979e52a00bb98e0d31480ab42d1c952bd202129960fd3c4d5360a1464d38ad71                                                                                                           0.0s
 => => naming to docker.io/library/test-project-test-factory-chrome-for-testing:latest                                                                                                                           0.0s
 => => unpacking to docker.io/library/test-project-test-factory-chrome-for-testing:latest                                                                                                                        4.3s
 => [test-factory-chrome-for-testing] resolving provenance for metadata file                                                                                                                                     0.0s

> [email protected] test
> cypress run -b chrome-for-testing


DevTools listening on ws://127.0.0.1:43441/devtools/browser/c73edbf8-f71e-46c9-b812-6c8e999344bf
Can't run because you've entered an invalid browser name.

Browser: chrome-for-testing was not found on your system or is not supported by Cypress.

Cypress supports the following browsers:
 - electron
 - chrome
 - chromium
 - chrome-for-testing
 - edge
 - firefox

You can also use a custom browser: https://on.cypress.io/customize-browsers

Available browsers found on your system are:
 - electron
Can't run because you've entered an invalid browser name.

Browser: chrome-for-testing was not found on your system or is not supported by Cypress.

Cypress supports the following browsers:
 - electron
 - chrome
 - chromium
 - chrome-for-testing
 - edge
 - firefox

You can also use a custom browser: https://on.cypress.io/customize-browsers

Available browsers found on your system are:
 - electron

@MikeMcC399
Copy link
Collaborator Author

MikeMcC399 commented Jun 17, 2025

@AtofStryker

@MikeMcC399 I think I know whats going on. I am on arm64, which isn't supported for chrome-for-testing. Going to post the logs for posterity, but I have a feeling the install script is silently failing. Going to test on my amd64 machine in a few

The fact that Chrome for Testing, like Chrome, isn't available for arm64 should probably be added to the main README. So it's good that you hit this issue.

It does say so on https://github.com/MikeMcC399/cypress-docker-images/tree/factory/cft/examples/chrome-for-testing though and on https://github.com/MikeMcC399/cypress-docker-images/blob/factory/cft/factory/README.md#chrome_for_testing_version

IIRC you only see the arm64 skip message if you use --progress plain, otherwise it gets overwritten quickly. It shouldn't be silently failing as such.

if (process.arch !== 'x64') {
  console.log(`Chrome for Testing only available for x64. Not currently available for architecture: ${process.arch}`)
  process.exit(0)
}

@MikeMcC399
Copy link
Collaborator Author

I've added notes for the README and the .env file to call out the non-availability of Chrome for Testing on Linux/arm64. It is only available for Linux/amd64.

@AtofStryker
Copy link
Contributor

I've added notes for the README and the .env file to call out the non-availability of Chrome for Testing on Linux/arm64. It is only available for Linux/amd64.

@MikeMcC399 thanks for adding this! I was able to test on my amd64 machine and things worked as expected.

@AtofStryker AtofStryker merged commit 06117f5 into cypress-io:master Jun 17, 2025
49 checks passed
@MikeMcC399
Copy link
Collaborator Author

@AtofStryker

Thanks for testing it out! I'm glad to see it merged 😄

@MikeMcC399 MikeMcC399 deleted the factory/cft branch June 17, 2025 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Chrome for Testing to cypress/factory build process

3 participants