forked from microbit-foundation/cctd-ml-machine
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
59 lines (57 loc) · 1.61 KB
/
Copy pathplaywright.config.ts
File metadata and controls
59 lines (57 loc) · 1.61 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
/**
* (c) 2024, Micro:bit Educational Foundation and contributors
*
* SPDX-License-Identifier: MIT
*/
import { defineConfig, devices } from "@playwright/test";
// Sandboxed environments (Claude's cage): Chromium honours HTTP_PROXY but
// drops the credential in it, so pass it explicitly; localhost bypasses the
// proxy to reach the same-namespace dev server. No-op when HTTP_PROXY is
// unset.
const proxyUrl = process.env.HTTP_PROXY
? new URL(process.env.HTTP_PROXY)
: undefined;
const proxy = proxyUrl && {
server: `${proxyUrl.protocol}//${proxyUrl.host}`,
username: decodeURIComponent(proxyUrl.username),
password: decodeURIComponent(proxyUrl.password),
bypass: "localhost",
};
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: "./src/e2e",
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: "html",
use: {
trace: "on-first-retry",
screenshot: "only-on-failure",
ignoreHTTPSErrors: true,
proxy,
},
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
/* Run local dev server before starting the tests. */
webServer: {
...(process.env.CI
? {
command: `npx vite preview --port 5173 --base ${process.env.BASE_URL}`,
url: `http://localhost:5173${process.env.BASE_URL}`,
}
: {
command: "npx vite dev",
url: "http://localhost:5173/",
}),
reuseExistingServer: !process.env.CI,
stdout: "pipe",
ignoreHTTPSErrors: true,
},
});