From 847f42d56a23d8aafd30b37762740732d9686d28 Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Wed, 22 Jul 2026 15:10:18 -0700 Subject: [PATCH] test(e2e): fix GitHub-issue-start prefill test flakiness - Reorder mock API handlers to ensure `/labels` and `/assignees` paths match before the specific issue endpoint - Replace regex heading matcher with exact string for more reliable assertions - Refactor terminal content polling to capture text once and reuse in subsequent assertions --- ...github-created-issue-start-prefill.spec.ts | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/tests/e2e/github-created-issue-start-prefill.spec.ts b/tests/e2e/github-created-issue-start-prefill.spec.ts index dadb6120ddf..c3e6d40820a 100644 --- a/tests/e2e/github-created-issue-start-prefill.spec.ts +++ b/tests/e2e/github-created-issue-start-prefill.spec.ts @@ -41,16 +41,16 @@ if (args[0] === 'api' && args.includes('-X') && args.includes('POST') && joined. console.log(JSON.stringify(issue)) process.exit(0) } -if (args[0] === 'api' && joined.includes('repos/acme/repo/issues/${ISSUE_NUMBER}')) { - console.log(JSON.stringify(issue)) - process.exit(0) -} if (args[0] === 'api' && joined.includes('/labels')) { process.exit(0) } if (args[0] === 'api' && joined.includes('/assignees')) { process.exit(0) } +if (args[0] === 'api' && joined.includes('repos/acme/repo/issues/${ISSUE_NUMBER}')) { + console.log(JSON.stringify(issue)) + process.exit(0) +} if (args[0] === 'api' && joined.includes('search/issues')) { console.log(JSON.stringify({ total_count: 0, incomplete_results: false, items: [] })) process.exit(0) @@ -161,19 +161,25 @@ test('starting a just-created GitHub issue launches Claude with its URL prefille await createDialog.getByRole('button', { name: 'Create issue' }).click() await expect(createDialog).toBeHidden({ timeout: 10_000 }) - await expect(orcaPage.getByRole('heading', { name: new RegExp(ISSUE_TITLE) })).toBeVisible({ + await expect(orcaPage.getByRole('heading', { name: ISSUE_TITLE })).toBeVisible({ timeout: 10_000 }) await orcaPage.getByRole('button', { name: 'Start workspace from issue' }).click() + let terminalText = '' await expect - .poll(() => getTerminalContent(orcaPage, 12_000), { - timeout: 30_000, - message: 'Claude prefill command did not reach the active terminal buffer' - }) + .poll( + async () => { + terminalText = await getTerminalContent(orcaPage, 12_000) + return terminalText + }, + { + timeout: 30_000, + message: 'Claude prefill command did not reach the active terminal buffer' + } + ) .toContain('--prefill') - const terminalText = await getTerminalContent(orcaPage, 12_000) expect(terminalText).toContain('--dangerously-skip-permissions') expect(terminalText).toContain('--prefill') expect(terminalText).toContain(ISSUE_URL)