Files
looper/e2e/test_toggle_record_stop.ts
2026-06-06 17:46:52 +00:00

52 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 nonblocking 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();
}