[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

ci: wire setup-chrome into webdriverio (#10470)

Co-authored-by: Codex <noreply@openai.com>

authored by

Hiroshi Ogawa
Codex
and committed by
GitHub
(May 28, 2026, 3:15 PM +0200) f0b24cfe 5c66858c

+146 -12
+14 -5
.github/workflows/ci.yml
··· 109 109 with: 110 110 node-version: ${{ matrix.node_version }} 111 111 112 - - uses: browser-actions/setup-chrome@4f8e94349a351df0f048634f25fec36c3c91eded # v2.1.1 112 + - uses: ./.github/actions/setup-webdriverio 113 + id: setup-webdriverio 114 + with: 115 + firefox-version: false 113 116 114 117 - name: Install 115 118 run: pnpm i ··· 176 179 with: 177 180 node-version: ${{ matrix.node_version }} 178 181 179 - - uses: browser-actions/setup-chrome@4f8e94349a351df0f048634f25fec36c3c91eded # v2.1.1 182 + - uses: ./.github/actions/setup-webdriverio 183 + id: setup-webdriverio 184 + with: 185 + firefox-version: false 180 186 181 187 - name: Install 182 188 run: pnpm i ··· 214 220 with: 215 221 node-version: ${{ matrix.node_version }} 216 222 217 - - uses: browser-actions/setup-chrome@4f8e94349a351df0f048634f25fec36c3c91eded # v2.1.1 218 - - uses: browser-actions/setup-firefox@fcf821c621167805dd63a29662bd7cb5676c81a8 # v1.7.1 223 + - uses: ./.github/actions/setup-webdriverio 224 + id: setup-webdriverio 219 225 220 226 - name: Install 221 227 run: pnpm i ··· 249 255 with: 250 256 node-version: 24 251 257 252 - - uses: browser-actions/setup-chrome@4f8e94349a351df0f048634f25fec36c3c91eded # v2.1.1 258 + - uses: ./.github/actions/setup-webdriverio 259 + id: setup-webdriverio 260 + with: 261 + firefox-version: false 253 262 254 263 - name: Install 255 264 run: |
+14 -1
packages/ui/vitest.config.ts
··· 49 49 providerName === 'preview' 50 50 ? preview() 51 51 : providerName === 'webdriverio' 52 - ? webdriverio() 52 + ? webdriverio({ 53 + ...(process.env.CHROMEDRIVER_PATH && process.env.CHROME_BIN 54 + ? { 55 + 'wdio:chromedriverOptions': { 56 + binary: process.env.CHROMEDRIVER_PATH, 57 + }, 58 + 'capabilities': { 59 + 'goog:chromeOptions': { 60 + binary: process.env.CHROME_BIN, 61 + }, 62 + }, 63 + } 64 + : {}), 65 + }) 53 66 : playwright({ 54 67 actionTimeout: 5000, 55 68 }),
+35 -1
test/browser/settings.ts
··· 18 18 } 19 19 : options), 20 20 preview, 21 - webdriverio, 21 + webdriverio: (options?: Parameters<typeof webdriverio>[0]) => { 22 + const capabilities = options?.capabilities || {} 23 + 24 + return webdriverio({ 25 + ...options, 26 + capabilities: { 27 + ...capabilities, 28 + // Explicit browser/driver binaries keep WebDriverIO from auto-downloading mismatched versions. 29 + // https://webdriver.io/docs/driverbinaries 30 + // https://webdriver.io/docs/capabilities#webdriverio-capabilities-to-manage-browser-driver-options 31 + ...(process.env.CHROMEDRIVER_PATH && process.env.CHROME_BIN 32 + ? { 33 + 'wdio:chromedriverOptions': { 34 + ...(capabilities as any)['wdio:chromedriverOptions'], 35 + binary: process.env.CHROMEDRIVER_PATH, 36 + }, 37 + // https://developer.chrome.com/docs/chromedriver/capabilities#chromeoptions-object 38 + 'goog:chromeOptions': { 39 + ...(capabilities as any)['goog:chromeOptions'], 40 + binary: process.env.CHROME_BIN, 41 + }, 42 + } 43 + : {}), 44 + ...(process.env.FIREFOX_BIN 45 + ? { 46 + // https://developer.mozilla.org/en-US/docs/Web/WebDriver/Reference/Capabilities/firefoxOptions 47 + 'moz:firefoxOptions': { 48 + ...(capabilities as any)['moz:firefoxOptions'], 49 + binary: process.env.FIREFOX_BIN, 50 + }, 51 + } 52 + : {}), 53 + }, 54 + }) 55 + }, 22 56 } 23 57 24 58 export const provider = providers[providerName]()
+65
.github/actions/setup-webdriverio/action.yml
··· 1 + name: Setup WebDriverIO Browsers 2 + description: Setup Chrome, ChromeDriver, and optional Firefox for WebDriverIO tests 3 + 4 + inputs: 5 + chrome-version: 6 + description: Chrome for Testing version to install, or false to skip 7 + # Pin to Chrome 148 while Chrome for Testing 149 Linux downloads/install are broken. 8 + default: '148' 9 + firefox-version: 10 + description: Firefox version to install, or false to skip 11 + default: latest 12 + 13 + runs: 14 + using: composite 15 + steps: 16 + - uses: browser-actions/setup-chrome@4f8e94349a351df0f048634f25fec36c3c91eded # v2.1.1 17 + if: inputs.chrome-version != 'false' 18 + id: setup-chrome 19 + with: 20 + chrome-version: ${{ inputs.chrome-version }} 21 + install-chromedriver: true 22 + 23 + - name: Export Chrome binaries 24 + if: inputs.chrome-version != 'false' 25 + shell: bash 26 + env: 27 + CHROME_PATH: ${{ steps.setup-chrome.outputs.chrome-path }} 28 + CHROMEDRIVER_PATH_VALUE: ${{ steps.setup-chrome.outputs.chromedriver-path }} 29 + run: | # zizmor: ignore[github-env] values come from pinned browser-actions/setup-chrome outputs. 30 + echo "CHROME_BIN=$CHROME_PATH" >> "$GITHUB_ENV" 31 + echo "CHROMEDRIVER_PATH=$CHROMEDRIVER_PATH_VALUE" >> "$GITHUB_ENV" 32 + 33 + - name: Allow setup-chrome sandbox 34 + if: inputs.chrome-version != 'false' && runner.os == 'Linux' 35 + shell: bash 36 + env: 37 + CHROME_PATH: ${{ steps.setup-chrome.outputs.chrome-path }} 38 + run: | 39 + # Chrome for Testing is not covered by Ubuntu's AppArmor sandbox policy on CI. 40 + # https://pptr.dev/troubleshooting#issues-with-apparmor-on-ubuntu 41 + # https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md 42 + # https://github.com/browser-actions/setup-chrome/issues/639 43 + cat <<EOF | sudo tee /etc/apparmor.d/chrome-for-testing 44 + abi <abi/4.0>, 45 + include <tunables/global> 46 + 47 + profile chrome-for-testing "$CHROME_PATH" flags=(unconfined) { 48 + userns, 49 + include if exists <local/chrome> 50 + } 51 + EOF 52 + sudo apparmor_parser -r /etc/apparmor.d/chrome-for-testing 53 + 54 + - uses: browser-actions/setup-firefox@fcf821c621167805dd63a29662bd7cb5676c81a8 # v1.7.1 55 + if: inputs.firefox-version != 'false' 56 + id: setup-firefox 57 + with: 58 + firefox-version: ${{ inputs.firefox-version }} 59 + 60 + - name: Export Firefox binary 61 + if: inputs.firefox-version != 'false' 62 + shell: bash 63 + env: 64 + FIREFOX_PATH: ${{ steps.setup-firefox.outputs.firefox-path }} 65 + run: echo "FIREFOX_BIN=$FIREFOX_PATH" >> "$GITHUB_ENV" # zizmor: ignore[github-env] value comes from pinned browser-actions/setup-firefox output.
+4 -4
test/browser/specs/failure-screenshot.test.ts
··· 2 2 import { describe, expect, test } from 'vitest' 3 3 import { runInlineTests } from '../../test-utils' 4 4 import utilsContent from '../fixtures/expect-dom/utils?raw' 5 - import { instances, provider } from '../settings' 6 5 7 6 const testFilename = 'basic.test.ts' 8 7 ··· 12 11 return runInlineTests({ 13 12 ...structure, 14 13 'vitest.config.js': ` 15 - import { ${provider.name} } from '@vitest/browser-${provider.name}' 14 + import { instances, provider } from '../settings.ts' 15 + 16 16 export default { 17 17 test: { 18 18 browser: { 19 19 enabled: true, 20 20 screenshotFailures: true, 21 - provider: ${provider.name}(), 21 + provider, 22 22 ui: false, 23 23 headless: true, 24 - instances: ${JSON.stringify(instances.slice(0, 1) /* logic not bound to browser instance */)}, 24 + instances: instances.slice(0, 1), // logic not bound to browser instance 25 25 }, 26 26 reporters: ['verbose'], 27 27 update: 'new',
+14 -1
test/e2e/test/mocking.test.ts
··· 170 170 return { 171 171 browser: { 172 172 enabled: true, 173 - provider: webdriverio(), 173 + provider: webdriverio({ 174 + ...(process.env.CHROMEDRIVER_PATH && process.env.CHROME_BIN 175 + ? { 176 + 'wdio:chromedriverOptions': { 177 + binary: process.env.CHROMEDRIVER_PATH, 178 + }, 179 + 'capabilities': { 180 + 'goog:chromeOptions': { 181 + binary: process.env.CHROME_BIN, 182 + }, 183 + }, 184 + } 185 + : {}), 186 + }), 174 187 instances: [{ browser: 'chrome' }], 175 188 headless: true, 176 189 },