-
Notifications
You must be signed in to change notification settings - Fork 78
ci: replace browser-driver-manager with browser-actions/setup-chrome #1345
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
base: develop
Are you sure you want to change the base?
Changes from 4 commits
1cf723b
dc63fba
fff6ff8
464befa
9848781
ffd70e1
3fb465f
ab13717
8a986b1
b66ff76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,10 +36,15 @@ jobs: | |
| node-version: ${{ matrix.node}} | ||
| cache: 'npm' | ||
| - run: npm ci | ||
| # HACK: Force a TTY to enable browser-driver-manager to manipulate stdout. | ||
| - shell: 'script -q -e -c "bash {0}"' | ||
| run: npx browser-driver-manager install chrome@145 | ||
| working-directory: packages/puppeteer | ||
| - uses: browser-actions/setup-chrome@v1 | ||
| id: setup-chrome | ||
| with: | ||
| chrome-version: ${{ vars.CHROME_VERSION || 'stable' }} | ||
| install-chromedriver: true | ||
|
Garbee marked this conversation as resolved.
|
||
| install-dependencies: true | ||
| - run: | | ||
| echo "CHROME_TEST_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV" | ||
| echo "CHROMEDRIVER_TEST_PATH=${{ steps.setup-chrome.outputs.chromedriver-path }}" >> "$GITHUB_ENV" | ||
| - run: npm run build --workspace=packages/puppeteer | ||
| - run: npm run coverage --workspace=packages/puppeteer | ||
| - run: npm run test:export --workspace=packages/puppeteer | ||
|
|
@@ -56,10 +61,15 @@ jobs: | |
| node-version: ${{ matrix.node }} | ||
| cache: 'npm' | ||
| - run: npm ci | ||
| # HACK: Force a TTY to enable browser-driver-manager to manipulate stdout. | ||
| - shell: 'script -q -e -c "bash {0}"' | ||
| run: npx browser-driver-manager install chrome@145 | ||
| working-directory: packages/cli | ||
| - uses: browser-actions/setup-chrome@v1 | ||
| id: setup-chrome | ||
| with: | ||
| chrome-version: ${{ vars.CHROME_VERSION || 'stable' }} | ||
| install-chromedriver: true | ||
| install-dependencies: true | ||
| - run: | | ||
| echo "CHROME_TEST_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV" | ||
| echo "CHROMEDRIVER_TEST_PATH=${{ steps.setup-chrome.outputs.chromedriver-path }}" >> "$GITHUB_ENV" | ||
| - run: npm run coverage --workspace=packages/cli | ||
|
|
||
| webdriverjs: | ||
|
|
@@ -74,10 +84,15 @@ jobs: | |
| node-version: ${{ matrix.node }} | ||
| cache: 'npm' | ||
| - run: npm ci | ||
| # HACK: Force a TTY to enable browser-driver-manager to manipulate stdout. | ||
| - shell: 'script -q -e -c "bash {0}"' | ||
| run: npx browser-driver-manager install chrome@145 | ||
| working-directory: packages/webdriverjs | ||
| - uses: browser-actions/setup-chrome@v1 | ||
| id: setup-chrome | ||
| with: | ||
| chrome-version: ${{ vars.CHROME_VERSION || 'stable' }} | ||
| install-chromedriver: true | ||
| install-dependencies: true | ||
| - run: | | ||
| echo "CHROME_TEST_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV" | ||
| echo "CHROMEDRIVER_TEST_PATH=${{ steps.setup-chrome.outputs.chromedriver-path }}" >> "$GITHUB_ENV" | ||
| - run: npm run build --workspace=packages/webdriverjs | ||
| - run: npm run coverage --workspace=packages/webdriverjs | ||
| - run: npm run test:export --workspace=packages/webdriverjs | ||
|
|
@@ -94,10 +109,15 @@ jobs: | |
| node-version: ${{ matrix.node }} | ||
| cache: 'npm' | ||
| - run: npm ci | ||
| # HACK: Force a TTY to enable browser-driver-manager to manipulate stdout. | ||
| - shell: 'script -q -e -c "bash {0}"' | ||
| run: npx browser-driver-manager install chrome@145 | ||
| working-directory: packages/webdriverio | ||
| - uses: browser-actions/setup-chrome@v1 | ||
| id: setup-chrome | ||
| with: | ||
| chrome-version: ${{ vars.CHROME_VERSION || 'stable' }} | ||
| install-chromedriver: true | ||
| install-dependencies: true | ||
| - run: | | ||
| echo "CHROME_TEST_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV" | ||
| echo "CHROMEDRIVER_TEST_PATH=${{ steps.setup-chrome.outputs.chromedriver-path }}" >> "$GITHUB_ENV" | ||
| - run: npm run build --workspace=packages/webdriverio | ||
| - run: npm run coverage --workspace=packages/webdriverio | ||
| - run: npm run test:export --workspace=packages/webdriverio | ||
|
|
@@ -149,7 +169,15 @@ jobs: | |
| node-version: ${{ matrix.node }} | ||
| cache: 'npm' | ||
| - run: npm ci | ||
| - run: npx playwright install --with-deps | ||
| - uses: browser-actions/setup-chrome@v1 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Playwright now gets the same setup-chrome treatment instead of |
||
| id: setup-chrome | ||
| with: | ||
| chrome-version: ${{ vars.CHROME_VERSION || 'stable' }} | ||
| install-chromedriver: true | ||
| install-dependencies: true | ||
| - run: | | ||
| echo "CHROME_TEST_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV" | ||
| echo "CHROMEDRIVER_TEST_PATH=${{ steps.setup-chrome.outputs.chromedriver-path }}" >> "$GITHUB_ENV" | ||
| - run: npm run build --workspace=packages/playwright | ||
| - run: npm run coverage --workspace=packages/playwright | ||
| - run: npm run test:export --workspace=packages/playwright | ||
|
|
@@ -166,6 +194,15 @@ jobs: | |
| node-version: ${{ matrix.node }} | ||
| cache: 'npm' | ||
| - run: npm ci | ||
| - uses: browser-actions/setup-chrome@v1 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This job had no Chrome install step before. Now it gets the same env-var contract as the rest. Pair this with the |
||
| id: setup-chrome | ||
| with: | ||
| chrome-version: ${{ vars.CHROME_VERSION || 'stable' }} | ||
| install-chromedriver: true | ||
| install-dependencies: true | ||
| - run: | | ||
| echo "CHROME_TEST_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> "$GITHUB_ENV" | ||
| echo "CHROMEDRIVER_TEST_PATH=${{ steps.setup-chrome.outputs.chromedriver-path }}" >> "$GITHUB_ENV" | ||
| - run: npm run test --workspace=test/wdio | ||
|
|
||
| axe_core_test: | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,8 +52,5 @@ | |
| "*.{json,css,md,html}": [ | ||
| "prettier --write" | ||
| ] | ||
| }, | ||
| "dependencies": { | ||
| "browser-driver-manager": "^2.0.0" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,7 +49,10 @@ describe('@axe-core/playwright', () => { | |
|
|
||
| beforeEach(async () => { | ||
| browser = await chromium.launch({ | ||
| args: ['--disable-dev-shm-usage'] | ||
| args: ['--disable-dev-shm-usage'], | ||
| ...(process.env.CHROME_TEST_PATH && { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Playwright supports launching arbitrary Chromium-compatible binaries via |
||
| executablePath: process.env.CHROME_TEST_PATH | ||
| }) | ||
|
Garbee marked this conversation as resolved.
Outdated
|
||
| }); | ||
| const context = await browser.newContext(); | ||
| page = await context.newPage(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,5 +44,9 @@ export function puppeteerOpts(): LaunchOptions { | |
| options.args.push('--no-sandbox', '--disable-setuid-sandbox'); | ||
| } | ||
|
|
||
| if (process.env.CHROME_TEST_PATH) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same fallback pattern as the playwright and wdio configs: when CI set |
||
| options.executablePath = process.env.CHROME_TEST_PATH; | ||
| } | ||
|
|
||
| return options; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,10 @@ import { fixturesPath } from 'axe-test-fixtures'; | |
| import { spawn } from 'child_process'; | ||
| import { getFreePort, connectToChromeDriver } from './testUtils.js'; | ||
|
|
||
| const { default: { path: chromedriverPath } } = await import('chromedriver'); | ||
| const chromedriverPath = | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the actual fix for PR #1344. Previously this harness used the |
||
| process.env.CHROMEDRIVER_TEST_PATH || | ||
| (await import('chromedriver')).default.path; | ||
| const chromeBinary = process.env.CHROME_TEST_PATH; | ||
|
|
||
| assert(typeof defaultExport === 'function', 'default export is not a function'); | ||
| assert(typeof AxeBuilder === 'function', 'named export is not a function'); | ||
|
|
@@ -35,7 +38,8 @@ async function integrationTest() { | |
| capabilities: { | ||
| browserName: 'chrome', | ||
| 'goog:chromeOptions': { | ||
| args: ['--headless', '--no-sandbox'] | ||
| args: ['--headless', '--no-sandbox'], | ||
| ...(chromeBinary && { binary: chromeBinary }) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spread is conditional so the unset case leaves capabilities untouched and webdriverio's Selenium Manager finds a system Chrome. Setting
Garbee marked this conversation as resolved.
Outdated
|
||
| } | ||
| }, | ||
| logLevel: 'error' | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same setup-chrome block repeats in six jobs intentionally — composite actions aren't worth introducing for a five-line snippet, and YAML anchors don't play nicely with
uses:. To override Chrome version repo-wide: set aCHROME_VERSIONrepository variable (Settings → Variables) to something like120orbeta; unset it to track stable.install-chromedriver: trueguarantees a version-matched driver beside the browser, and we hoist both outputs into$GITHUB_ENVso subsequentnpm runsteps inherit them — that's what fixes the original mismatch where the chromedriver npm pin and the runner-image Chrome had drifted apart.