feat: add comprehensive end-to-end test suite
This commit is contained in:
committed by
Loic Coenen (aider)
parent
af7588b832
commit
18eb27e9c8
50
e2e/test_record_on_missing_channel.ts
Normal file
50
e2e/test_record_on_missing_channel.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { setupTest, startEngine, startClientInTmux, wait, tmuxSendKeys, tmuxCapturePane, teardownTest } from './test_utils';
|
||||
|
||||
export async function testRecordOnMissingChannel(): Promise<void> {
|
||||
console.log("\nTest: RECORD ON MISSING CHANNEL (col 2, row 2)");
|
||||
setupTest();
|
||||
const engine = await startEngine();
|
||||
await startClientInTmux();
|
||||
// Do NOT add any channels – only channel 0 exists
|
||||
await wait(500);
|
||||
|
||||
// Navigate to row 2, col 2 (two rights, two downs)
|
||||
tmuxSendKeys("looper", "0", "l");
|
||||
tmuxSendKeys("looper", "0", "l");
|
||||
await wait(200);
|
||||
tmuxSendKeys("looper", "0", "j");
|
||||
tmuxSendKeys("looper", "0", "j");
|
||||
await wait(200);
|
||||
|
||||
// Verify selection line
|
||||
let pane = tmuxCapturePane("looper", "0");
|
||||
if (!pane.includes("Selected: Grid 0, Row 2, Col 2")) {
|
||||
console.log(" FAIL: Could not navigate to Row 2, Col 2");
|
||||
engine.kill(); teardownTest();
|
||||
throw new Error("Navigation to (2,2) failed");
|
||||
}
|
||||
|
||||
// Press 't' to start recording (no extra key – TUI polls itself)
|
||||
tmuxSendKeys("looper", "0", "t");
|
||||
await wait(1500);
|
||||
|
||||
// Check the grid shows 'R' near cell (2,2)
|
||||
pane = tmuxCapturePane("looper", "0");
|
||||
const paneLines = pane.split("\n");
|
||||
let cellLine = -1, recordLine = -1;
|
||||
for (let i = 0; i < paneLines.length; i++) {
|
||||
if (paneLines[i].includes(" 2")) cellLine = i;
|
||||
if (paneLines[i].includes("R")) recordLine = i;
|
||||
}
|
||||
if (cellLine !== -1 && recordLine !== -1 && Math.abs(recordLine - cellLine) <= 2) {
|
||||
console.log(" PASS: Grid shows 'R' indicator near cell 2");
|
||||
} else {
|
||||
console.log(" FAIL: Could not find 'R' near cell 2 in pane");
|
||||
console.log(" Pane excerpt:\n" + pane.slice(0, 1000));
|
||||
engine.kill(); teardownTest();
|
||||
throw new Error("Grid indicator missing for col 2");
|
||||
}
|
||||
|
||||
engine.kill();
|
||||
teardownTest();
|
||||
}
|
||||
Reference in New Issue
Block a user