Skip to content

Commit 2f7b5c5

Browse files
committed
Give the voice preflight a speaking microphone
interviewer-voice launched Chromium with its built-in fake beep for a microphone. Under a local sound server the beep is too short for the microphone check that enables Join, so the test failed on a desktop and passed only on a runner without one. It now captures test-voice.wav, like the two other tests that need a working microphone check, through one launch argument they share.
1 parent 493d5de commit 2f7b5c5

4 files changed

Lines changed: 15 additions & 5 deletions

File tree

‎tests/browser/interviewer-voice.test.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
DEFAULT_RUNTIME_CONFIG,
55
launchChromium,
66
read,
7+
FAKE_SPEECH_CAPTURE,
78
startStaticServer,
89
} from "./source.js";
910

@@ -37,6 +38,7 @@ before(async () => {
3738
args: [
3839
"--use-fake-device-for-media-stream",
3940
"--use-fake-ui-for-media-stream",
41+
FAKE_SPEECH_CAPTURE,
4042
"--autoplay-policy=no-user-gesture-required",
4143
],
4244
});

‎tests/browser/preflight-speech.test.js‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
// Browser playback cannot prove physical audibility through system effects.
22
import { after, before, test } from "node:test";
33
import assert from "node:assert/strict";
4-
import { fileURLToPath } from "node:url";
5-
import { DEFAULT_RUNTIME_CONFIG, startStaticServer } from "./source.js";
4+
import {
5+
DEFAULT_RUNTIME_CONFIG,
6+
FAKE_SPEECH_CAPTURE,
7+
startStaticServer,
8+
} from "./source.js";
69

710
let browser;
811
let server;
@@ -14,7 +17,7 @@ before(async () => {
1417
args: [
1518
"--use-fake-device-for-media-stream",
1619
"--use-fake-ui-for-media-stream",
17-
`--use-file-for-fake-audio-capture=${fileURLToPath(new URL("../../web/audio/test-voice.wav", import.meta.url))}`,
20+
FAKE_SPEECH_CAPTURE,
1821
],
1922
});
2023
} catch (error) {

‎tests/browser/run-shortcut.test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
// the interview is on.
44
import { after, before, test } from "node:test";
55
import assert from "node:assert/strict";
6-
import { fileURLToPath } from "node:url";
76

87
import {
98
DEFAULT_RUNTIME_CONFIG,
109
launchChromium,
10+
FAKE_SPEECH_CAPTURE,
1111
startStaticServer,
1212
} from "./source.js";
1313

@@ -263,7 +263,7 @@ async function mediaBrowser(t) {
263263
args: [
264264
"--use-fake-device-for-media-stream",
265265
"--use-fake-ui-for-media-stream",
266-
`--use-file-for-fake-audio-capture=${fileURLToPath(new URL("../../web/audio/test-voice.wav", import.meta.url))}`,
266+
FAKE_SPEECH_CAPTURE,
267267
],
268268
});
269269
t.after(() => media.close());

‎tests/browser/source.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ export function memoryStorage() {
173173
};
174174
}
175175

176+
// Speech as the fake microphone, not Chromium's built-in beep: under a local
177+
// sound server the beep is too short for the microphone check that enables
178+
// Join, so a test passes on a runner without one and fails on a desktop.
179+
export const FAKE_SPEECH_CAPTURE = `--use-file-for-fake-audio-capture=${join(root, "web", "audio", "test-voice.wav")}`;
180+
176181
/// The browser, or null when there is no browser to be had. Shared so that
177182
/// every file launching one agrees on what a missing Playwright or an
178183
/// undownloaded Chromium means. `make check` installs neither, so a null here

0 commit comments

Comments
 (0)