Repository navigation
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
59 lines (54 loc) · 1.54 KB
/
Copy pathplaywright.config.ts
File metadata and controls
59 lines (54 loc) · 1.54 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 { defineConfig, devices } from "@playwright/test";
function hashString(input: string): number {
let hash = 0;
for (let i = 0; i < input.length; i++) {
hash = (hash * 31 + input.charCodeAt(i)) >>> 0;
}
return hash;
}
function resolveE2EPort(): number {
const fromEnv = Number(process.env.E2E_PORT);
if (Number.isInteger(fromEnv) && fromEnv > 0 && fromEnv <= 65535) {
return fromEnv;
}
return 40_000 + (hashString(process.cwd()) % 20_000);
}
const PORT = resolveE2EPort();
const BASE_URL = `http://127.0.0.1:${PORT}`;
export default defineConfig({
testDir: "tests/e2e",
testMatch: "**/*.e2e.ts",
timeout: 30_000,
expect: {
timeout: 5_000,
},
use: {
baseURL: BASE_URL,
},
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},
{
name: "webkit",
use: { ...devices["Desktop Safari"] },
grep: /suggest endpoint|Firefox locks|opensearch endpoint|suggestions include custom|homepage bang finder|compact address-bar setup|default provider labels|settings persist suggest provider none|settings persist custom bang creation|settings reject invalid|warm redirect|service workers are unavailable|private hash redirect/,
},
],
webServer: {
command: "bun run start",
env: {
...process.env,
ALLOW_UNSAFE_CUSTOM_SUGGEST_URLS: "true",
PORT: String(PORT),
},
url: `${BASE_URL}/health`,
reuseExistingServer: true,
timeout: 120_000,
},
});