Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ Cypress officially [supports][Cypress Browser Support] the latest 3 major versio

### Chrome for Testing

[Google Chrome for Testing][Chrome for Testing] is an alternate version of Chrome which is supported by [Cypress 13.17.0](https://docs.cypress.io/app/references/changelog#13-17-0) and above. The [examples/chrome-for-testing](./examples/chrome-for-testing/) directory shows how it can be built into a custom Cypress Docker image.
The [Google Chrome for Testing][Chrome for Testing] browser is supported by [Cypress 13.17.0](https://docs.cypress.io/app/references/changelog#13-17-0) and above.

[cypress/factory](./factory/) provides the parameter [CHROME_FOR_TESTING_VERSION](./factory/README.md#chrome_for_testing_version) to optionally add Chrome for Testing to a custom image. The [examples/chrome-for-testing](./examples/chrome-for-testing/) directory describes an alternate way to install Chrome for Testing into a custom image using the [@puppeteer/browsers command-line utility](https://pptr.dev/browsers-api). At this time, Chrome for Testing is not included in [cypress/browsers](./browsers/) or [cypress/included](./included/) images. Chrome for Testing is currently not available for the `linux/arm64` platform.

### Mozilla geckodriver

Expand Down
1 change: 1 addition & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ workflows:
[
test-factory-electron,
test-factory-chrome,
test-factory-chrome-for-testing,
test-factory-chrome-non-root-user,
test-factory-firefox,
test-factory-edge,
Expand Down
6 changes: 5 additions & 1 deletion examples/chrome-for-testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ Note that Chrome for Testing is currently not available for the `linux/arm64` pl

## Docker

The example below downloads Chrome for Testing using [@puppeteer/browsers](https://pptr.dev/browsers-api).

[cypress/factory](../../factory/) also supports building a custom Docker image with Chrome for Testing using the parameter [CHROME_FOR_TESTING_VERSION](../../factory/README.md#chrome_for_testing_version) which must be a full version specification. This is more restrictive than the example below with [@puppeteer/browsers](https://pptr.dev/browsers-api), which has the flexibility of using a version alias, such as `stable` or a short version specification.

### Docker build and run

In this example we use a customized `Dockerfile` which bases a new image on `cypress/base`, copies the complete Cypress project into the image, including installed dependencies, then installs the Cypress binary and Chrome for Testing into the image.

The file is [examples/chrome-for-testing/Dockerfile](./Dockerfile). It has the following contents which build a custom Docker image using the `stable` version of Chrome for Testing:
The file is [examples/chrome-for-testing/Dockerfile](./Dockerfile). It has the following contents which build a custom Docker image using the `stable` version of Chrome for Testing, downloaded with [@puppeteer/browsers](https://pptr.dev/browsers-api):

```dockerfile
FROM cypress/base
Expand Down
7 changes: 6 additions & 1 deletion factory/.env
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@ NODE_VERSION="${FACTORY_DEFAULT_NODE_VERSION}"

# Update the FACTORY_VERSION to deploy cypress/factory if you make changes to
# BASE_IMAGE, FACTORY_DEFAULT_NODE_VERSION, YARN_VERSION, factory.Dockerfile or installScripts
FACTORY_VERSION='5.10.0'
FACTORY_VERSION='5.11.0'

# Chrome versions: https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable
# Linux/amd64 only
CHROME_VERSION='137.0.7151.68-1'

# Chrome for Testing versions: https://googlechromelabs.github.io/chrome-for-testing/
# not currently used for cypress/browsers and cypress/included images
# Linux/amd64 only
CHROME_FOR_TESTING_VERSION='137.0.7151.70'

# Cypress versions: https://www.npmjs.com/package/cypress
CYPRESS_VERSION='14.4.1'

Expand Down
4 changes: 4 additions & 0 deletions factory/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change log

## 5.11.0

- Added ability to install Google [Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing/) with `CHROME_FOR_TESTING_VERSION`. Addresses [#1367](https://github.com/cypress-io/cypress-docker-images/issues/1367).

## 5.10.0

- Updated Debian base image to `debian:12.11-slim` using [Debian 12.11](https://www.debian.org/News/2025/20250517), released on May 17, 2025. Addresses [#1352](https://github.com/cypress-io/cypress-docker-images/issues/1352).
Expand Down
11 changes: 11 additions & 0 deletions factory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Node.js
- Yarn v1 Classic
- Chrome
- Chrome for Testing
- Firefox
- geckodriver
- Edge
Expand Down Expand Up @@ -76,6 +77,16 @@ Example: `CHROME_VERSION='131.0.6778.264-1'`

This browser is currently available only for the `Linux/amd64` platform.

### CHROME_FOR_TESTING_VERSION

The version of [Google Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing/) to install. If the `ARG` variable is unset or an empty string, Chrome for Testing is not installed.

Example: `CHROME_FOR_TESTING_VERSION='137.0.7151.70'`

Refer to [Chrome for Testing availability](https://googlechromelabs.github.io/chrome-for-testing/) for current versions or [available downloads](https://googlechromelabs.github.io/chrome-for-testing/files) for other versions.

The parameter `CHROME_FOR_TESTING_VERSION` can be used for custom-built images based on `cypress/factory`. The browser is however not currently built into `cypress/browsers` or `cypress/included` images and is currently available only for the `Linux/amd64` platform.

### FIREFOX_VERSION

The version of Mozilla Firefox to install. If the `ARG` variable is unset or an empty string, Firefox is not installed. The exact version must be used, no wildcards or shorthands are supported.
Expand Down
27 changes: 27 additions & 0 deletions factory/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,19 @@ services:
- ${REPO_PREFIX-}cypress/chrome:${CHROME_VERSION}
command: google-chrome --version

chrome-for-testing:
image: '${REPO_PREFIX-}cypress/chrome-for-testing'
build:
target: default_image
context: .
args:
NODE_VERSION: ${NODE_VERSION}
FACTORY_VERSION: ${FACTORY_VERSION}
CHROME_FOR_TESTING_VERSION: ${CHROME_FOR_TESTING_VERSION}
tags:
- ${REPO_PREFIX-}cypress/chrome-for-testing:${CHROME_FOR_TESTING_VERSION}
command: chrome --version

edge:
image: ${REPO_PREFIX-}cypress/edge
build:
Expand Down Expand Up @@ -154,6 +167,20 @@ services:
- ${REPO_PREFIX-}cypress/cypress-chrome:cypress-${CYPRESS_VERSION}-chrome-${CHROME_VERSION}
command: node -v

cypress-chrome-for-testing:
image: ${REPO_PREFIX-}cypress/cypress-chrome
build:
target: default_image
context: .
args:
NODE_VERSION: ${NODE_VERSION}
FACTORY_VERSION: ${FACTORY_VERSION}
CYPRESS_VERSION: ${CYPRESS_VERSION}
CHROME_FOR_TESTING_VERSION: ${CHROME_FOR_TESTING_VERSION}
tags:
- ${REPO_PREFIX-}cypress/cypress-chrome-for-testing:cypress-${CYPRESS_VERSION}-chrome-for-testing-${CHROME_FOR_TESTING_VERSION}
command: node -v

cypress-edge:
image: ${REPO_PREFIX-}cypress/cypress-edge
build:
Expand Down
5 changes: 5 additions & 0 deletions factory/factory.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ ONBUILD ARG CHROME_VERSION

ONBUILD RUN node /opt/installScripts/chrome/install-chrome-version.js ${CHROME_VERSION}

# Install Chrome for Testing: optional
ONBUILD ARG CHROME_FOR_TESTING_VERSION

ONBUILD RUN node /opt/installScripts/chrome-for-testing/install-chrome-for-testing-version.js ${CHROME_FOR_TESTING_VERSION}

# Install Edge: optional
ONBUILD ARG EDGE_VERSION

Expand Down
14 changes: 14 additions & 0 deletions factory/installScripts/chrome-for-testing/default.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#! /bin/bash

# Download locations on https://googlechromelabs.github.io/chrome-for-testing/ - see JSON endpoints

wget --no-verbose -P /tmp/chrome-for-testing https://storage.googleapis.com/chrome-for-testing-public/${1}/linux64/chrome-linux64.zip
unzip /tmp/chrome-for-testing/chrome-linux64.zip -d /tmp/chrome-for-testing
mv /tmp/chrome-for-testing/chrome-linux64 /opt/chrome-for-testing
apt-get update
while read -r pkg
do
apt-get satisfy -y --no-install-recommends "${pkg}"
done < /opt/chrome-for-testing/deb.deps
ln -fs /opt/chrome-for-testing/chrome /usr/local/bin/chrome
rm -rf /tmp/chrome-for-testing
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/node
const { spawn } = require('child_process')

const chromeVersion = process.argv.slice(2)[0]

if (!chromeVersion) {
console.log('No Chrome for Testing version provided, skipping Chrome for Testing install')
process.exit(0)
}

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

console.log('Installing Chrome for Testing version: ', chromeVersion)

// Insert logic here if needed to run a different install script based on chrome version.
const install = spawn(`${__dirname}/default.sh`, [chromeVersion], { stdio: 'inherit' })

install.on('error', function (error) {
console.log('child process errored with ' + error.toString())
process.exit(1)
})

install.on('exit', function (code) {
console.log('child process exited with code ' + code.toString())
process.exit(code)
})
9 changes: 9 additions & 0 deletions factory/test-project/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ services:
context: .
command: npm run test -- -b chrome

test-factory-chrome-for-testing:
build:
args:
NODE_VERSION: ${NODE_VERSION}
CHROME_FOR_TESTING_VERSION: ${CHROME_FOR_TESTING_VERSION}
BASE_TEST_IMAGE: cypress/factory:${FACTORY_VERSION}
context: .
command: npm run test -- -b chrome-for-testing

test-factory-chrome-non-root-user:
user: node
build:
Expand Down