feat: add comprehensive end-to-end test suite

This commit is contained in:
Loic Coenen
2026-06-06 17:46:52 +00:00
committed by Loic Coenen (aider)
parent af7588b832
commit 18eb27e9c8
20 changed files with 1261 additions and 0 deletions

49
e2e/test_vu_meter.ts Normal file
View File

@@ -0,0 +1,49 @@
import { setupTest, startEngine, startClientInTmux, openCmdFifo, wait, ensureGenTone, exec, tmuxCapturePane, teardownTest } from './test_utils';
import * as globals from "./test_globals";
export async function testVUMeter(): Promise<void> {
console.log("\nTest: VU METER RESPONDS TO AUDIO");
setupTest();
const engine = await startEngine();
await startClientInTmux();
openCmdFifo();
await wait(500);
// Capture initial VU line (should be empty/spaces)
let pane = tmuxCapturePane("looper", "0");
const paneLines = pane.split("\n");
// Look for any line containing x or # that is the VU meter line.
const vuLineBefore = paneLines.find(l => /[x#]/.test(l)) || "";
console.log(` Initial VU line: "${vuLineBefore.trim()}"`);
// Generate tone in background (does not block the test)
ensureGenTone();
const toneProc = exec(`${globals.GEN_TONE_BIN} 3.0 "looper:ch0in"`, { timeout: 8000 });
// Wait for audio to start reaching the meter
await wait(1500);
// Capture pane while tone is playing
pane = tmuxCapturePane("looper", "0");
const paneLines2 = pane.split("\n");
// Same detection as above
const vuLineDuring = paneLines2.find(l => /[x#]/.test(l)) || "";
console.log(` VU line during tone: "${vuLineDuring.trim()}"`);
// The VU meter should show non-space characters (at least one 'x' or '#')
const hasSignal = /[x#]/.test(vuLineDuring);
if (hasSignal) {
console.log(" PASS: VU meter shows signal (nonspace characters)");
} else {
console.log(" FAIL: VU meter line does not show any signal characters");
console.log(" Pane excerpt:\n" + pane.slice(0, 2000));
engine.kill(); teardownTest();
throw new Error("VU meter not responsive");
}
// Wait for tone process to finish
try { toneProc.kill(); } catch {}
engine.kill();
teardownTest();
}