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

View File

@@ -0,0 +1,56 @@
import { setupTest, startEngine, startClientInTmux, openCmdFifo, writeFifoCommand, wait, tmuxSendKeys, tmuxCapturePane, waitForPaneText, teardownTest } from './test_utils';
export async function testRecordOnHighRow(): Promise<void> {
console.log("\nTest: RECORD ON HIGH ROW (row 5, col 0) verifies engine & TUI");
setupTest();
const engine = await startEngine();
await startClientInTmux();
openCmdFifo();
await wait(500);
// Add a few channels so column 0 is usable
for (let i = 1; i <= 3; i++) {
writeFifoCommand("add");
await wait(100);
}
// Navigate to row 5, col 0
tmuxSendKeys("looper", "0", "j");
tmuxSendKeys("looper", "0", "j");
tmuxSendKeys("looper", "0", "j");
tmuxSendKeys("looper", "0", "j");
tmuxSendKeys("looper", "0", "j");
await wait(500);
// Verify selection shows row 5
let pane = tmuxCapturePane("looper", "0");
if (!pane.includes("Selected: Grid 0, Row 5, Col 0")) {
console.log(" FAIL: Could not navigate to Row 5, Col 0");
engine.kill(); teardownTest();
throw new Error("Navigation to row 5 failed");
}
console.log(" PASS: Navigated to Row 5, Col 0");
// Press 't' to start recording
tmuxSendKeys("looper", "0", "t");
// Check the TUI pane wait until it shows 'R' near row 5
const paneWithR = await waitForPaneText("R", 5000);
const paneLines = paneWithR.split("\n");
let cell5Line = -1, recordLine = -1;
for (let i = 0; i < paneLines.length; i++) {
if (paneLines[i].includes(" 5")) cell5Line = i;
if (paneLines[i].includes("R")) recordLine = i;
}
if (cell5Line !== -1 && recordLine !== -1 && Math.abs(recordLine - cell5Line) <= 2) {
console.log(" PASS: TUI grid shows 'R' near row 5");
} else {
console.log(" FAIL: TUI grid does not show 'R' near row 5");
console.log(" Pane:\n" + paneWithR.slice(0, 1000));
engine.kill(); teardownTest();
throw new Error("TUI indicator missing for row 5");
}
engine.kill();
teardownTest();
}