diff --git a/.github/workflows/browser-smoke.yml b/.github/workflows/browser-smoke.yml index d6da142..1dbbee2 100644 --- a/.github/workflows/browser-smoke.yml +++ b/.github/workflows/browser-smoke.yml @@ -1,4 +1,4 @@ -# The browser smoke in Chrome against a deployment, on request. See +# The browser smoke in Chromium against a deployment, on request. See # tests/browser/README.md. name: Browser smoke @@ -13,7 +13,7 @@ permissions: contents: read jobs: - chrome: + chromium: runs-on: ubuntu-latest timeout-minutes: 15 steps: @@ -26,6 +26,7 @@ jobs: node-version-file: .node-version cache: pnpm - run: pnpm install --frozen-lockfile --ignore-scripts + - run: pnpm exec playwright install --with-deps chromium --only-shell - run: pnpm browser:test env: BASE_URL: ${{ inputs.base_url }} diff --git a/tests/browser/README.md b/tests/browser/README.md index 379e4cf..fe24882 100644 --- a/tests/browser/README.md +++ b/tests/browser/README.md @@ -3,25 +3,25 @@ Playwright Test, one target per run. `smoke.spec.ts` opens the homepage and checks its address, title and heading; it changes nothing. `pnpm a11y` stays the accessibility scan. ```sh -BASE_URL=https://deploy-preview-1--example.netlify.app pnpm browser:test -BASE_URL=https://deploy-preview-1--example.netlify.app BROWSER_TARGET=firefox pnpm browser:test +BASE_URL=https://deploy-preview-1--example.netlify.app vp run browser:test +BASE_URL=https://deploy-preview-1--example.netlify.app BROWSER_TARGET=firefox vp run browser:test ``` -`BASE_URL` is required; there is no default site. Each run writes to `.dev/browser//`: `results` keeps a screenshot, trace and error context of each failed test, and `report` the HTML report (`pnpm exec playwright show-report .dev/browser//report`). Screenshots and traces show what the page shows, so keep them off for signed-in pages. +`BASE_URL` is required; there is no default site. Each run writes to `.dev/browser//`: `results` keeps a screenshot, trace and error context of each failed test, and `report` the HTML report (`vp exec playwright show-report .dev/browser//report`). Screenshots and traces show what the page shows, so keep them off for signed-in pages. ## Targets -This repository requires `chrome`, also in the Browser smoke workflow, which runs on request against a URL. A site or app that needs more targets lists them here. Other targets run when asked. A requested target that is unavailable fails the run; it never counts as passed or skipped. +This repository requires `chromium`, also in the Browser smoke workflow, which runs on request against a URL. A site or app that needs more targets lists them here. Other targets run when asked. A requested target that is unavailable fails the run; it never counts as passed or skipped. -| `BROWSER_TARGET` | Browser | -| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `chrome` (default) | The installed Google Chrome, headless | -| `firefox` | Playwright's Firefox, headless. Install it once with `pnpm exec playwright install firefox`. | -| `webkit` | Playwright's WebKit, headless; close to Safari, but not Safari. Install it once with `pnpm exec playwright install webkit`. | -| `android` | Chrome on a dedicated Android test emulator or device, signed out of the site. Set `ANDROID_SERIAL` to its adb serial, such as `emulator-5554`. Each test stops Chrome there and starts it again with its existing profile, so cookies and storage carry over between tests and runs. | -| `ios` | Mobile Safari on a dedicated iOS test simulator or device, signed out of the site, through its Web Inspector. Before the run, open exactly one Safari tab there at `BASE_URL`. Set `IOS_WEBKIT_ENDPOINT` to `ios_webkit_debug_proxy` for exactly that simulator or device, on loopback, such as `http://127.0.0.1:19422`. | +| `BROWSER_TARGET` | Browser | +| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `chromium` (default) | Playwright's Chromium, headless. Install it once with `vp exec playwright install chromium --only-shell`. | +| `firefox` | Playwright's Firefox, headless. Install it once with `vp exec playwright install firefox`. | +| `webkit` | Playwright's WebKit, headless; close to Safari, but not Safari. Install it once with `vp exec playwright install webkit`. | +| `android` | Chrome on a dedicated Android test emulator or device, signed out of the site. Set `ANDROID_SERIAL` to its adb serial, such as `emulator-5554`. Each test stops Chrome there and starts it again with its existing profile, so cookies and storage carry over between tests and runs. | +| `ios` | Mobile Safari on a dedicated iOS test simulator or device, signed out of the site, through its Web Inspector. Before the run, open exactly one Safari tab there at `BASE_URL`. Set `IOS_WEBKIT_ENDPOINT` to `ios_webkit_debug_proxy` for exactly that simulator or device, on loopback, such as `http://127.0.0.1:19422`. | -`BROWSER_RUN_ID` names the run folder; it defaults to the time and target. `--headed` shows a desktop browser. +`BROWSER_RUN_ID` names the run folder; it defaults to the time and target. `--headed` shows a desktop browser; install the full managed Chromium first with `vp exec playwright install chromium`. ## iOS diff --git a/tests/browser/playwright.config.ts b/tests/browser/playwright.config.ts index 2cc09c7..378cb04 100644 --- a/tests/browser/playwright.config.ts +++ b/tests/browser/playwright.config.ts @@ -15,7 +15,7 @@ const run = fileURLToPath( // Desktop targets use Playwright's own browsers; target.ts connects iOS and // Android. const browsers = { - chrome: { browserName: "chromium", channel: "chrome" }, + chromium: { browserName: "chromium" }, firefox: { browserName: "firefox" }, webkit: { browserName: "webkit" }, ios: {}, diff --git a/tests/browser/target.ts b/tests/browser/target.ts index 13492ed..3796b57 100644 --- a/tests/browser/target.ts +++ b/tests/browser/target.ts @@ -4,9 +4,9 @@ import type { Browser, BrowserContext } from "@playwright/test" // The target of this run and the page each test gets. See // tests/browser/README.md. const env = process.env -const targets = ["chrome", "firefox", "webkit", "ios", "android"] as const +const targets = ["chromium", "firefox", "webkit", "ios", "android"] as const export const target = (env.BROWSER_TARGET || - "chrome") as (typeof targets)[number] + "chromium") as (typeof targets)[number] if (!targets.includes(target)) throw new Error(`BROWSER_TARGET must be one of ${targets.join(", ")}.`)