feat: add comprehensive end-to-end test suite
This commit is contained in:
committed by
Loic Coenen (aider)
parent
af7588b832
commit
18eb27e9c8
62
e2e/test_record_move_record.ts
Normal file
62
e2e/test_record_move_record.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { setupTest, startEngine, startClientInTmux, openCmdFifo, writeFifoCommand, wait, tmuxSendKeys, tmuxCapturePane, teardownTest } from './test_utils';
|
||||
|
||||
export async function testRecordMoveRecord(): Promise<void> {
|
||||
console.log("\nTest: RECORD ON ROW2 COL0, THEN MOVE RIGHT AND RECORD AGAIN");
|
||||
setupTest();
|
||||
const engine = await startEngine();
|
||||
await startClientInTmux();
|
||||
openCmdFifo();
|
||||
await wait(500);
|
||||
|
||||
// Do NOT pre‑add – engine must auto‑create channel 1 on demand
|
||||
|
||||
// Navigate down twice to row2, col0
|
||||
tmuxSendKeys("looper", "0", "j");
|
||||
tmuxSendKeys("looper", "0", "j");
|
||||
await wait(500);
|
||||
|
||||
// Verify selection
|
||||
let pane = tmuxCapturePane("looper", "0");
|
||||
if (!pane.includes("Row 2, Col 0")) {
|
||||
console.log(" FAIL: Could not navigate to Row2, Col0");
|
||||
engine.kill(); teardownTest();
|
||||
throw new Error("Navigation failed");
|
||||
}
|
||||
|
||||
// First trigger: record on cell (row2, col0)
|
||||
tmuxSendKeys("looper", "0", "t");
|
||||
await wait(1000);
|
||||
|
||||
pane = tmuxCapturePane("looper", "0");
|
||||
const gridArea1 = pane.split("Selected:")[0] || pane;
|
||||
const rCount1 = (gridArea1.match(/R/g) || []).length;
|
||||
if (rCount1 !== 1) {
|
||||
console.log(` FAIL: Expected 1 'R' after first trigger, got ${rCount1}`);
|
||||
console.log(" Pane:\n" + pane.slice(0, 1000));
|
||||
engine.kill(); teardownTest();
|
||||
throw new Error("First trigger not reflected");
|
||||
}
|
||||
console.log(" PASS: First trigger produced exactly one 'R'");
|
||||
|
||||
// Move right to col1
|
||||
tmuxSendKeys("looper", "0", "l");
|
||||
await wait(500);
|
||||
|
||||
// Second trigger
|
||||
tmuxSendKeys("looper", "0", "t");
|
||||
await wait(1000);
|
||||
|
||||
pane = tmuxCapturePane("looper", "0");
|
||||
const gridArea2 = pane.split("Selected:")[0] || pane;
|
||||
const rCount2 = (gridArea2.match(/R/g) || []).length;
|
||||
if (rCount2 !== 2) {
|
||||
console.log(` FAIL: Expected 2 'R's after second trigger on col1, got ${rCount2}`);
|
||||
console.log(" Pane:\n" + pane.slice(0, 1000));
|
||||
engine.kill(); teardownTest();
|
||||
throw new Error("Second trigger did not create another recording indicator");
|
||||
}
|
||||
console.log(" PASS: Second trigger produced a second 'R'");
|
||||
|
||||
engine.kill();
|
||||
teardownTest();
|
||||
}
|
||||
Reference in New Issue
Block a user