Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/browser-smoke.yml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -13,7 +13,7 @@ permissions:
contents: read

jobs:
chrome:
chromium:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
Expand All @@ -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 }}
Expand Down
24 changes: 12 additions & 12 deletions tests/browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
coderabbitai[bot] marked this conversation as resolved.
```

`BASE_URL` is required; there is no default site. Each run writes to `.dev/browser/<run-id>/`: `results` keeps a screenshot, trace and error context of each failed test, and `report` the HTML report (`pnpm exec playwright show-report .dev/browser/<run-id>/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/<run-id>/`: `results` keeps a screenshot, trace and error context of each failed test, and `report` the HTML report (`vp exec playwright show-report .dev/browser/<run-id>/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

Expand Down
2 changes: 1 addition & 1 deletion tests/browser/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {},
Expand Down
4 changes: 2 additions & 2 deletions tests/browser/target.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(", ")}.`)

Expand Down
Loading