-
Notifications
You must be signed in to change notification settings - Fork 392
feat: add geckodriver to factory process #1353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MikeMcC399
wants to merge
4
commits into
cypress-io:master
Choose a base branch
from
MikeMcC399:add/factory-geckodriver
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
TestsCircleCI testsInclude additional Local testsTest with Docker Desktop Linux cd factory
docker compose build factory
cd .. Build testscd examples/basic
docker build -f Dockerfile.factory --build-arg GECKODRIVER_VERSION=0.36.0 -t firefox-test .
cd ../..
Run testsBuild custom images with network connected: cd examples/basic
docker build -f Dockerfile.factory \
--build-arg FIREFOX_VERSION=138.0.3 --build-arg GECKODRIVER_VERSION=0.36.0 \
-t firefox-browsers-test .
npm ci
cd ../basic-mini
docker build -f Dockerfile.factory \
--build-arg CYPRESS_VERSION=14.3.3 --build-arg FIREFOX_VERSION=138.0.3 --build-arg GECKODRIVER_VERSION=0.36.0 \
-t firefox-included-test .
docker build -f Dockerfile.factory \
--build-arg CYPRESS_VERSION=13.15.0 --build-arg FIREFOX_VERSION=138.0.3 \
-t firefox-included-13.15.0-test .
cd ../firefox-esr
docker build -f Dockerfile.factory --build-arg GECKODRIVER_VERSION=0.36.0 \
-t firefox-esr-test .
npm ci
cd ../.. Disconnect network and run each image: cd examples/basic
docker run -it --rm --entrypoint bash -v .:/app -w /app firefox-browsers-test -c "npx cypress run -b firefox"
cd ../basic-mini
docker run -it --rm --entrypoint cypress -v .:/app -w /app firefox-included-test run -b firefox
docker run -it --rm --entrypoint cypress -v .:/app -w /app -u node firefox-included-test run -b firefox # test non-root
docker run -it --rm --entrypoint cypress -v .:/app -w /app firefox-included-13.15.0-test run -b firefox
cd ../firefox-esr
docker run -it --rm --entrypoint bash -v .:/app -w /app firefox-esr-test -c "npx cypress run -b firefox"
cd ../.. |
This was referenced May 19, 2025
e806a42
to
dd3d948
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Situation
The mozilla/geckodriver is required to test Firefox. It is not part of the Firefox distribution, nor is it included in Cypress. If the driver is unavailable, then testing against Firefox fails. This is typically the case in an air-gapped environment.
If an attempt is made to run Cypress against a Firefox browser in a Cypress Docker container using
cypress/browsers
orcypress/included
images, Cypress tries to download mozilla/geckodriver. In an air-gapped environment (no Internet access) the download fails and it is not possible to test against Firefox. The same applies to any Docker images built for Firefox with the current version ofcypress/factory
.Secondly, in a regular environment with Internet connectivity, and no cached version of the mozilla/geckodriver stored in the Docker image, the driver version defaults to the latest, which means that the test configuration with Firefox is non-deterministic.
Assessment
Cypress uses the npm wrapper package geckodriver, bundled into the Cypress binary, in order to ensure the availability of the mozilla/geckodriver driver for Firefox testing.
By manually installing the mozilla/geckodriver in a Docker build process, and then setting the geckodriver environment variable GECKODRIVER_PATH, the wrapper package is instructed not to download and to use the locally stored driver instead.
If the mozilla/geckodriver can first be built into a Cypress Docker image in an environment with Internet connectivity, the Docker image can later be used in an environment without Internet to test against Firefox.
Change
Introduce a new Cypress build parameter
GECKODRIVER_VERSION
to direct the Cypress factory build process to install the corresponding version of mozilla/geckodriver into a Cypress Docker image being built. The driver is stored in the GECKODRIVER_PATH/opt/geckodriver/geckodriver
.The published images
cypress/browsers
andcypress/included
are left unchanged, with nogeckodriver
pre-installed. An enhancement to these images is left for a follow-on PR.This is a backwards-compatible feature addition.
Detailed changes
Bump
FACTORY_VERSION
Add documentation to factory/README.md with new
GECKODRIVER_VERSION
sectionUpdate the CONTRIBUTING document
Add the Cypress Docker parameter
GECKODRIVER_VERSION
to factory/.env to specify a version of the driver packagemozilla/geckodriver
from mozilla/geckodriver in the Cypress Docker factory build process. The default is set to the current latest version0.36.0
.Add install scripts for
mozilla/geckodriver
to thecypress/factory
image so that the installation is compatible with use by the npm wrapper package geckodriver bundled in the Cypress binary (see https://github.com/cypress-io/cypress/blob/develop/packages/server/package.json) since [email protected].Use new install scripts in factory/factory.Dockerfile, setting GECKODRIVER_PATH to
/opt/geckodriver/geckodriver
Harmonize the use of
platformFilename
forFirefox
andgeckodriver
scripts. (Filename conventions are different for the two different package downloads.)Add new build compose services to factory/docker-compose.yml and to factory/test-project/docker-compose.yml
Add CircleCI tests
Add
Dockerfile.factory
to the following example directories to allow easier local testing: