-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.js
More file actions
63 lines (60 loc) · 1.92 KB
/
Copy pathplaywright.config.js
File metadata and controls
63 lines (60 loc) · 1.92 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
60
61
62
63
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { defineConfig, devices } from '@playwright/test';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const fixturesDir = path.resolve(__dirname, 'tests/fixtures/audio');
/**
* Chromium flags that replace getUserMedia with a fake mic fed from a WAV
* file — lets tests drive the real pitch/onset pipeline end-to-end.
*/
const fakeMicArgs = (wavFile) => [
'--use-fake-ui-for-media-stream',
'--use-fake-device-for-media-stream',
`--use-file-for-fake-audio-capture=${path.join(fixturesDir, wavFile)}`,
'--autoplay-policy=no-user-gesture-required',
];
export default defineConfig({
testDir: './tests/browser',
globalSetup: './tests/browser/global-setup.mjs',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: 'html',
use: {
baseURL: 'http://localhost:3000',
trace: 'on-first-retry',
},
projects: [
{
name: 'chromium',
testIgnore: /.*-mic\.spec\.js/,
use: { ...devices['Desktop Chrome'] },
},
{
// Specs that need a fake mic producing a sustained 220Hz (A3) tone —
// tuner + vocal monitor pitch flows.
name: 'fake-mic-tone',
testMatch: /(tuner|vocal-monitor)-mic\.spec\.js/,
use: {
...devices['Desktop Chrome'],
launchOptions: { args: fakeMicArgs('tone-a3-220hz.wav') },
},
},
{
// Specs that need a fake mic producing a 120 BPM percussive click
// track — metronome listen-back onset detection.
name: 'fake-mic-clicks',
testMatch: /metronome-mic\.spec\.js/,
use: {
...devices['Desktop Chrome'],
launchOptions: { args: fakeMicArgs('clicks-120bpm.wav') },
},
},
],
webServer: {
command: 'npm run dev',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
},
});