test: replace fixed UI waits with observable readiness (#20369)

This commit is contained in:
Neil
2026-09-12 01:19:07 -07:00
committed by GitHub
parent 923858e098
commit 7b53b5abd1
3 changed files with 20 additions and 14 deletions
@@ -53,7 +53,6 @@ export async function openChecks(page: Page, worktreeId: string): Promise<void>
// instead of hanging on a locator that stopped matching mid-action.
await checksButton.click({ timeout: 2_000 }).catch(() => undefined)
}
await page.waitForTimeout(250)
return page.evaluate(() => window.__store?.getState().rightSidebarTab)
},
{ timeout: 10_000 }
+10 -4
View File
@@ -138,15 +138,21 @@ test.describe('PR comments sidebar cards view', () => {
await orcaPage.screenshot({ path: testInfo.outputPath('reaction-before.png') })
await threadReactionButton.click()
await expect(orcaPage.getByRole('group', { name: 'Add reaction' })).toBeFocused()
await orcaPage.waitForTimeout(300)
await orcaPage.screenshot({ path: testInfo.outputPath('reaction-picker.png') })
await expect(orcaPage.getByRole('button', { name: 'Add rocket reaction' })).toBeVisible()
await orcaPage.screenshot({
path: testInfo.outputPath('reaction-picker.png'),
animations: 'disabled'
})
await orcaPage.getByRole('button', { name: 'Add rocket reaction' }).click()
await expect(orcaPage.getByRole('group', { name: 'Add reaction' })).toBeHidden()
const selectedRocket = reviewThreadCard.getByRole('button', { name: '1 rocket reaction' })
await expect(selectedRocket).toHaveAttribute('aria-pressed', 'true')
await selectedRocket.focus()
await orcaPage.waitForTimeout(300)
await orcaPage.screenshot({ path: testInfo.outputPath('reaction-after.png') })
await expect(selectedRocket).toBeFocused()
await orcaPage.screenshot({
path: testInfo.outputPath('reaction-after.png'),
animations: 'disabled'
})
await selectedRocket.press('Enter')
await expect(selectedRocket).toHaveCount(0)
await expect(threadReactionButton).toBeFocused()
+10 -9
View File
@@ -42,19 +42,20 @@ test('cmd+p quick open prioritizes the filename and reveals the full path on hov
rowText?.indexOf('packages/orca/src/renderer/src/components/navigation/') ?? -1
)
// Two hovers on purpose: results stream in and remount the row, and Radix only
// opens on a pointermove it actually receives. A single hover can land before
// the remount and leave the cursor sitting still over a row that never saw it.
await row.hover({ position: { x: 20, y: 12 } })
await orcaPage.waitForTimeout(250)
await row.hover({ position: { x: 40, y: 12 } })
const tooltip = orcaPage
.locator('[data-slot="tooltip-content"]')
.filter({ hasText: relativeFilePath })
// Streaming results can remount the row under a stationary pointer.
await expect(async () => {
await row.hover({ position: { x: 20, y: 12 }, timeout: 1_000 })
await row.hover({ position: { x: 40, y: 12 }, timeout: 1_000 })
await expect(tooltip).toBeVisible({ timeout: 1_000 })
}).toPass({ timeout: 10_000, intervals: [100, 250, 500] })
// Exact cursor placement is arithmetic, unit-tested via cursorTooltipOffsets.
// Asserting it here measures the app mid-reflow and is flaky; what E2E is
// uniquely good for is that the tooltip really opens with the whole path.
await expect(
orcaPage.locator('[data-slot="tooltip-content"]').filter({ hasText: relativeFilePath })
).toBeVisible()
await expect(tooltip).toBeVisible()
const proofPath = process.env.ORCA_QUICK_OPEN_PROOF_PATH
if (proofPath) {