test(cli): fix flaky InputPrompt snapshot test caused by polling inside waitFor

This commit is contained in:
Spencer
2026-04-10 17:01:49 +00:00
parent e064cfe043
commit 9e3a48a3b6
2 changed files with 37 additions and 25 deletions
@@ -3877,8 +3877,9 @@ describe('InputPrompt', () => {
// 1. Verify initial placeholder // 1. Verify initial placeholder
await waitFor(() => { await waitFor(() => {
expect(stdout.lastFrame()).toMatchSnapshot(); expect(stdout.lastFrame()).toContain('[Pasted Text: 10 lines]');
}); });
expect(stdout.lastFrame()).toMatchSnapshot();
// Simulate double-click to expand // Simulate double-click to expand
await simulateClick(5, 2); await simulateClick(5, 2);
@@ -3886,8 +3887,9 @@ describe('InputPrompt', () => {
// 2. Verify expanded content is visible // 2. Verify expanded content is visible
await waitFor(() => { await waitFor(() => {
expect(stdout.lastFrame()).toMatchSnapshot(); expect(stdout.lastFrame()).toContain('line10');
}); });
expect(stdout.lastFrame()).toMatchSnapshot();
// Simulate double-click to collapse // Simulate double-click to collapse
await simulateClick(5, 2); await simulateClick(5, 2);
@@ -3895,8 +3897,9 @@ describe('InputPrompt', () => {
// 3. Verify placeholder is restored // 3. Verify placeholder is restored
await waitFor(() => { await waitFor(() => {
expect(stdout.lastFrame()).toMatchSnapshot(); expect(stdout.lastFrame()).toContain('[Pasted Text: 10 lines]');
}); });
expect(stdout.lastFrame()).toMatchSnapshot();
unmount(); unmount();
}); });
@@ -156,7 +156,16 @@ exports[`InputPrompt > mouse interaction > should toggle paste expansion on doub
exports[`InputPrompt > mouse interaction > should toggle paste expansion on double-click 2`] = ` exports[`InputPrompt > mouse interaction > should toggle paste expansion on double-click 2`] = `
"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
> [Pasted Text: 10 lines] > line1
line2
line3
line4
line5
line6
line7
line8
line9
line10
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
" "
`; `;