mirror of
https://github.com/stablyai/orca.git
synced 2026-09-21 16:02:20 +00:00
test: verify imported projects through the virtualized sidebar (#19003)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { expect, type Page } from '@stablyai/playwright-test'
|
||||
|
||||
export async function expectSidebarProjectVisible(page: Page, projectName: string): Promise<void> {
|
||||
const sidebar = page.getByRole('listbox', { name: 'Worktrees', exact: true })
|
||||
const label = sidebar.getByText(projectName, { exact: false }).first()
|
||||
await sidebar.evaluate((element) => {
|
||||
element.scrollTop = 0
|
||||
element.dispatchEvent(new Event('scroll', { bubbles: true }))
|
||||
})
|
||||
await expect
|
||||
.poll(
|
||||
async () => {
|
||||
if (await label.isVisible()) {
|
||||
return true
|
||||
}
|
||||
// Virtualized project headers mount only as their scroll range enters the viewport.
|
||||
await sidebar.evaluate((element) => {
|
||||
element.scrollTop += Math.max(1, Math.floor(element.clientHeight * 0.8))
|
||||
element.dispatchEvent(new Event('scroll', { bubbles: true }))
|
||||
})
|
||||
return false
|
||||
},
|
||||
{ message: `sidebar never rendered project ${projectName}`, intervals: [100] }
|
||||
)
|
||||
.toBe(true)
|
||||
await expect(label).toBeVisible()
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import { expectSidebarProjectVisible } from './helpers/sidebar-project-visibility'
|
||||
import { openSidebarProjectDialog } from './helpers/sidebar-project-dialog'
|
||||
import { rmSync } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
@@ -727,7 +728,7 @@ async function runSelectedRuntimeAddJourney(
|
||||
...fixture.nestedRepoPaths.map((repoPath) => path.basename(repoPath))
|
||||
]) {
|
||||
// Why: duplicate checkout names are disambiguated with a parent path.
|
||||
await expect(client.page.getByText(projectName, { exact: false }).first()).toBeVisible()
|
||||
await expectSidebarProjectVisible(client.page, projectName)
|
||||
}
|
||||
expect(await client.getDirectSshAttemptTargetIds()).toEqual([])
|
||||
// Why: revealing the client must not leak into the HUB's window visibility.
|
||||
|
||||
Reference in New Issue
Block a user