feat: add comprehensive end-to-end test suite
This commit is contained in:
committed by
Loic Coenen (aider)
parent
af7588b832
commit
18eb27e9c8
51
e2e/test_toggle_record_stop.ts
Normal file
51
e2e/test_toggle_record_stop.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { setupTest, startEngine, startClientInTmux, openCmdFifo, writeFifoCommand, wait, readStatusNonBlock, teardownTest } from './test_utils';
|
||||
|
||||
export async function testToggleRecordStop(): Promise<void> {
|
||||
console.log("\nTest: TOGGLE RECORD / STOP");
|
||||
setupTest();
|
||||
const engine = await startEngine();
|
||||
await startClientInTmux();
|
||||
openCmdFifo();
|
||||
await wait(500);
|
||||
|
||||
// Send 'record 0' via FIFO to start recording
|
||||
writeFifoCommand("record 0");
|
||||
await wait(1500);
|
||||
|
||||
// Read status non‑blocking and look for RECORD
|
||||
const stAfterRecord = readStatusNonBlock();
|
||||
if (stAfterRecord.includes("RECORD")) {
|
||||
console.log(" PASS: Status shows RECORD");
|
||||
} else {
|
||||
// Wait a bit more and retry once
|
||||
await wait(500);
|
||||
const st2 = readStatusNonBlock();
|
||||
if (st2.includes("RECORD")) {
|
||||
console.log(" PASS: Status shows RECORD (after delay)");
|
||||
} else {
|
||||
console.log(" STATUS data: " + st2);
|
||||
console.log(" WARN: Did not see RECORD in status");
|
||||
}
|
||||
}
|
||||
|
||||
// Stop
|
||||
writeFifoCommand("stop");
|
||||
await wait(1500);
|
||||
|
||||
const stAfterStop = readStatusNonBlock();
|
||||
if (stAfterStop.includes("IDLE")) {
|
||||
console.log(" PASS: Status shows IDLE after stop");
|
||||
} else {
|
||||
await wait(500);
|
||||
const st3 = readStatusNonBlock();
|
||||
if (st3.includes("IDLE")) {
|
||||
console.log(" PASS: Status shows IDLE after stop (after delay)");
|
||||
} else {
|
||||
console.log(" WARN: Did not see IDLE in status");
|
||||
console.log(" STATUS data: " + st3);
|
||||
}
|
||||
}
|
||||
|
||||
engine.kill();
|
||||
teardownTest();
|
||||
}
|
||||
Reference in New Issue
Block a user