-
Notifications
You must be signed in to change notification settings - Fork 187
Expand file tree
/
Copy pathplaywright.pinned.config.ts
More file actions
59 lines (55 loc) · 2.01 KB
/
Copy pathplaywright.pinned.config.ts
File metadata and controls
59 lines (55 loc) · 2.01 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
49
50
51
52
53
54
55
56
57
58
59
import path from 'path'
import { defineConfig, devices } from '@playwright/test'
import { config as baseConfig } from './playwright.base.config'
// Local equivalent of the BrowserStack matrix in browsers.conf.js (Firefox 119 + WebKit 17.4)
// without BrowserStack. The pipeline:
// 1) `playwright run-server` on port 5401 from Playwright 1.40.1 (bundles FF 119, WK 17.4).
// 2) A small translation proxy on port 5400 (test/e2e/scripts/pinned-proxy.mjs) that
// spoofs the User-Agent the 1.40 server's version check expects, and patches
// __create__ messages so the 1.58 client's strict initializer validators accept
// messages produced by the 1.40 server.
// 3) The current @playwright/test (1.58) client connects to the proxy via wsEndpoint.
//
// Initial install of the 1.40 browser binaries:
// yarn test:e2e:pinned:init
const PINNED_WS_ENDPOINT = 'ws://127.0.0.1:5400/'
const proxyDir = path.join(__dirname, 'scripts')
const pinnedWebServers = [
{
name: 'pinned playwright run-server',
stdout: 'pipe' as const,
cwd: proxyDir,
command: 'yarn dlx -p playwright@1.40.1 playwright run-server --port 5401',
wait: { stdout: /Listening on/ },
},
{
name: 'pinned proxy',
stdout: 'pipe' as const,
cwd: proxyDir,
command: 'node pinned-proxy.mjs --listen 5400 --upstream 127.0.0.1:5401',
wait: { stdout: /pinned-proxy] listening/ },
},
]
// eslint-disable-next-line import/no-default-export
export default defineConfig({
...baseConfig,
webServer: [...((baseConfig.webServer as object[]) ?? []), ...pinnedWebServers] as never,
projects: [
{
name: 'firefox',
metadata: { sessionName: 'Firefox 119', name: 'firefox' },
use: {
...devices['Desktop Firefox'],
connectOptions: { wsEndpoint: PINNED_WS_ENDPOINT },
},
},
{
name: 'webkit',
metadata: { sessionName: 'WebKit 17.4', name: 'webkit' },
use: {
...devices['Desktop Safari'],
connectOptions: { wsEndpoint: PINNED_WS_ENDPOINT },
},
},
],
})