mirror of
https://github.com/stablyai/orca.git
synced 2026-09-23 00:02:29 +00:00
* fix(e2e): stabilize flaky E2E tests against timing races - Paired terminal: use stable cold activation assertion instead of racy one-shot read; background tabs park eagerly. - Native chat: scope hydration assertions to transcript subtree to avoid false positives from UI chrome (worktree rows, tab titles). - Onboarding: inject verified status snapshot with max sequence to prevent hydration from downgrading host health during skip-to- project-setup. - Paired web: encode host health faults in snapshots with high sequence so real hydrations cannot outbid injected state. - Quick open: clear prior tooltips and increase hover timeouts to handle streaming result remounting. - Terminal attention: pass 'terminal-bell' to unread marker to match production contract (reads marker value, not presence). * fix one last test
67 lines
2.9 KiB
TypeScript
67 lines
2.9 KiB
TypeScript
import { mkdirSync, writeFileSync } from 'node:fs'
|
||
import path from 'node:path'
|
||
import { expect, test } from './helpers/orca-app'
|
||
import { ensureTerminalVisible, waitForActiveWorktree, waitForSessionReady } from './helpers/store'
|
||
|
||
const relativeFilePath =
|
||
'packages/orca/src/renderer/src/components/navigation/worktree/quick-open/long-path-fixtures/very-deeply-nested-folder/QuickOpenTarget.tsx'
|
||
|
||
test('cmd+p quick open prioritizes the filename and reveals the full path on hover', async ({
|
||
electronApp,
|
||
orcaPage,
|
||
testRepoPath
|
||
}) => {
|
||
const filePath = path.join(testRepoPath, ...relativeFilePath.split('/'))
|
||
mkdirSync(path.dirname(filePath), { recursive: true })
|
||
writeFileSync(filePath, 'export const QuickOpenTarget = true\n')
|
||
|
||
await waitForSessionReady(orcaPage)
|
||
await waitForActiveWorktree(orcaPage)
|
||
await ensureTerminalVisible(orcaPage)
|
||
|
||
// Headless Playwright keyboard events bypass Electron’s before-input-event shortcut path.
|
||
await electronApp.evaluate(({ BrowserWindow }) => {
|
||
BrowserWindow.getAllWindows()[0]?.webContents.send('ui:openQuickOpen')
|
||
})
|
||
const dialog = orcaPage.getByRole('dialog', { name: 'Go to file' })
|
||
await expect(dialog).toBeVisible()
|
||
const inputBox = await dialog.locator('[data-cmdk-input-wrapper]').boundingBox()
|
||
expect(inputBox).not.toBeNull()
|
||
expect(inputBox!.height).toBeLessThanOrEqual(45)
|
||
const input = dialog.locator('input[placeholder="Go to file..."]')
|
||
await input.fill('QuickOpenTarget')
|
||
|
||
const row = dialog.getByRole('option').filter({ hasText: 'QuickOpenTarget.tsx' }).first()
|
||
await expect(row).toBeVisible()
|
||
await expect(row).toContainText('packages/orca/src/renderer/src/components/navigation/')
|
||
const rowBox = await row.boundingBox()
|
||
expect(rowBox).not.toBeNull()
|
||
expect(rowBox!.height).toBeLessThanOrEqual(29)
|
||
const rowText = await row.textContent()
|
||
expect(rowText?.indexOf('QuickOpenTarget.tsx')).toBeLessThan(
|
||
rowText?.indexOf('packages/orca/src/renderer/src/components/navigation/') ?? -1
|
||
)
|
||
|
||
const tooltip = orcaPage
|
||
.locator('[data-slot="tooltip-content"]')
|
||
.filter({ hasText: relativeFilePath })
|
||
// Streaming results can remount the row under a stationary pointer, and a
|
||
// tooltip left open from a prior attempt can swallow the next hover.
|
||
await expect(async () => {
|
||
await orcaPage.mouse.move(8, 8)
|
||
await row.hover({ position: { x: 20, y: 12 }, timeout: 2_000 })
|
||
await row.hover({ position: { x: 40, y: 12 }, timeout: 2_000 })
|
||
await expect(tooltip).toBeVisible({ timeout: 2_000 })
|
||
}).toPass({ timeout: 15_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(tooltip).toBeVisible()
|
||
|
||
const proofPath = process.env.ORCA_QUICK_OPEN_PROOF_PATH
|
||
if (proofPath) {
|
||
await orcaPage.screenshot({ path: proofPath })
|
||
}
|
||
})
|