-
Notifications
You must be signed in to change notification settings - Fork 393
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
Merged
AtofStryker
merged 5 commits into
cypress-io:master
from
MikeMcC399:add/factory-geckodriver
May 23, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a251d6d
feat: add geckodriver to factory process
MikeMcC399 88134bc
remove lint warning
MikeMcC399 615fb0f
change geckodriver ownership to root:root
MikeMcC399 a878b5e
fix conflict
MikeMcC399 daeca85
use name Mozilla geckodriver in README
MikeMcC399 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM cypress/factory | ||
COPY . /opt/app | ||
WORKDIR /opt/app |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM cypress/factory | ||
COPY . /opt/app | ||
WORKDIR /opt/app | ||
RUN npx cypress install # Install Cypress binary into image |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM cypress/factory | ||
COPY . /opt/app | ||
WORKDIR /opt/app | ||
RUN apt-get update # Update package index | ||
RUN apt-get install firefox-esr -y # Install Firefox ESR | ||
RUN npx cypress install # Install Cypress binary |
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#! /bin/bash | ||
|
||
# geckodriver for Firefox does not have a Debian package, so instead we download the tar to unzip. | ||
# | ||
# $1: version (example: 0.36.0) | ||
# $2: platformFilename (linux64 or linux-aarch64) | ||
|
||
wget --no-verbose -O /tmp/geckodriver.tar.gz https://github.com/mozilla/geckodriver/releases/download/v${1}/geckodriver-v${1}-${2}.tar.gz \ | ||
&& mkdir -p /opt/geckodriver \ | ||
&& tar -C /opt/geckodriver -xaf /tmp/geckodriver.tar.gz \ | ||
&& chown -R root:root /opt/geckodriver \ | ||
&& rm /tmp/geckodriver.tar.gz \ |
50 changes: 50 additions & 0 deletions
50
factory/installScripts/geckodriver/install-geckodriver-version.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/node | ||
const { spawn } = require('child_process') | ||
|
||
const geckodriverVersion = process.argv.slice(2)[0] | ||
|
||
if (!geckodriverVersion) { | ||
console.log('No geckodriver version provided, skipping geckodriver install') | ||
process.exit(0) | ||
} | ||
|
||
// See https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html for compatibility matrix | ||
// geckodriver < 0.34.0 only supports up to Firefox 120, which is no longer supported by Cypress | ||
const MIN_GECKO = '0.34.0' | ||
|
||
if (geckodriverVersion < MIN_GECKO) { | ||
console.log(`geckodriver version ${geckodriverVersion} provided, minimum version ${MIN_GECKO} required, skipping geckodriver install`) | ||
process.exit(0) | ||
} | ||
|
||
const architecture = process.arch | ||
// Platform filenames taken from https://github.com/mozilla/geckodriver/releases | ||
let platformFilename | ||
|
||
switch (architecture) { | ||
case 'x64': | ||
platformFilename = 'linux64' | ||
break | ||
case 'arm64': | ||
platformFilename = 'linux-aarch64' | ||
break | ||
|
||
default: | ||
console.log(`Unsupported architecture ${architecture} for geckodriver installation, skipping install`) | ||
process.exit(0) | ||
} | ||
|
||
console.log(`Installing geckodriver version ${geckodriverVersion} for ${architecture}`) | ||
|
||
// Insert logic here if needed to run a different install script based on geckodriver version. | ||
const install = spawn(`${__dirname}/default.sh`, [geckodriverVersion, platformFilename], { 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) | ||
}) |
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
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.
Uh oh!
There was an error while loading. Please reload this page.