-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplaywright-live.config.js
More file actions
48 lines (46 loc) · 1.88 KB
/
playwright-live.config.js
File metadata and controls
48 lines (46 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { defineConfig } from '@playwright/test';
// Point tests at the live GitHub Pages deployment.
// The tests call page.goto('/') which resolves to the root of the origin.
// GitHub Pages serves the app at /sv-tutorial/, so we set baseURL to the
// origin and rely on the fact that page.goto('/sv-tutorial/') would be correct.
// However, since we can't change the test files, we set baseURL so that
// page.goto('/') hits the right place.
//
// Playwright URL resolution: new URL(givenURL, baseURL)
// new URL('/', 'https://thomasnormal.github.io/sv-tutorial/') => 'https://thomasnormal.github.io/'
// new URL('', 'https://thomasnormal.github.io/sv-tutorial/') => 'https://thomasnormal.github.io/sv-tutorial/'
//
// The tests use page.goto('/') so we cannot use a subpath baseURL trick.
// Instead, we use the webServer-less mode and set baseURL to the full path,
// then rely on a global beforeEach override via use.extraHTTPHeaders or
// custom storageState — but the cleanest is to just accept that page.goto('/')
// will redirect. Let's check if GitHub Pages redirects / to /sv-tutorial/ for
// this repo. It does not (returns 404).
//
// Therefore: override baseURL to full site URL and patch goto by using
// the 'baseURL' as the full app URL. page.goto('/') must be intercepted.
// We use a custom 'page' fixture that overrides goto.
export default defineConfig({
testDir: './e2e',
timeout: 180_000,
fullyParallel: false,
retries: 0,
workers: 1,
reporter: [['list']],
use: {
channel: 'chromium',
headless: true,
launchOptions: {
args: [
'--use-angle=swiftshader',
'--enable-webgl',
'--enable-unsafe-swiftshader',
'--ignore-gpu-blocklist'
]
},
baseURL: 'https://thomasnormal.github.io/sv-tutorial/',
trace: 'on-first-retry',
screenshot: 'only-on-failure'
}
// No webServer block — using the live deployed site
});