mirror of
https://github.com/stablyai/orca.git
synced 2026-10-01 00:02:10 +00:00
Validate headful coverage with pending deflake fixes
This commit is contained in:
@@ -35,7 +35,7 @@ test('refreshes the visible tree after external Windows file changes', async ({
|
||||
const row = (name: string) =>
|
||||
orcaPage
|
||||
.locator('[data-file-explorer-row]')
|
||||
.filter({ hasText: new RegExp(`^${name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}$`) })
|
||||
.filter({ has: orcaPage.getByText(name, { exact: true }) })
|
||||
|
||||
rmSync(originalPath, { force: true })
|
||||
rmSync(renamedPath, { force: true })
|
||||
|
||||
@@ -73,11 +73,19 @@ export async function closeSettingsPage(page: Page): Promise<void> {
|
||||
|
||||
export async function closeOpenDialogs(page: Page): Promise<void> {
|
||||
for (let attempt = 0; attempt < 5; attempt += 1) {
|
||||
// Nested dialogs can finish their exit animations in different frames.
|
||||
await expect(page.locator('[role="dialog"][data-state="closed"]')).toHaveCount(0, {
|
||||
timeout: 3_000
|
||||
})
|
||||
const dialogCount = await page.getByRole('dialog').count()
|
||||
if (dialogCount === 0) {
|
||||
return
|
||||
}
|
||||
const dialog = page.getByRole('dialog').last()
|
||||
const dialogId = await page.getByRole('dialog').last().getAttribute('id')
|
||||
if (!dialogId) {
|
||||
throw new Error('Open dialog is missing its Radix identity')
|
||||
}
|
||||
const dialog = page.locator(`[role="dialog"][id=${JSON.stringify(dialogId)}]`)
|
||||
const cancelOrBack = dialog.getByRole('button', { name: /^(Cancel|Back)$/ })
|
||||
await ((await cancelOrBack
|
||||
.first()
|
||||
@@ -85,11 +93,10 @@ export async function closeOpenDialogs(page: Page): Promise<void> {
|
||||
.catch(() => false))
|
||||
? cancelOrBack.first().click()
|
||||
: page.keyboard.press('Escape'))
|
||||
await expect
|
||||
.poll(async () => page.getByRole('dialog').count(), { timeout: 3_000 })
|
||||
.toBeLessThan(dialogCount)
|
||||
.catch(() => undefined)
|
||||
// Back can replace the picker with its parent without reducing the dialog count.
|
||||
await expect(dialog).toBeHidden({ timeout: 3_000 })
|
||||
}
|
||||
await expect(page.getByRole('dialog')).toHaveCount(0, { timeout: 3_000 })
|
||||
}
|
||||
|
||||
/** Leave settings / overlays so the main shell (Add Project) is reachable. */
|
||||
|
||||
@@ -157,7 +157,6 @@ test.describe('Tabs', () => {
|
||||
await orcaPage.getByRole('button', { name: 'New tab' }).click({ force: true })
|
||||
const newMarkdownMenuItem = orcaPage.getByRole('menuitem', { name: /New Markdown/i }).first()
|
||||
await newMarkdownMenuItem.click()
|
||||
await expect(newMarkdownMenuItem).toBeHidden({ timeout: 3_000 })
|
||||
|
||||
// Why: require an id that did not exist before the click, so an already-open
|
||||
// Markdown file can't satisfy the assertions (or be deleted by cleanup), and
|
||||
@@ -179,6 +178,7 @@ test.describe('Tabs', () => {
|
||||
|
||||
const editor = orcaPage.locator('.rich-markdown-editor')
|
||||
await expect(editor).toBeVisible({ timeout: 25_000 })
|
||||
await expect(newMarkdownMenuItem).toBeHidden({ timeout: 3_000 })
|
||||
|
||||
await expect
|
||||
.poll(() => editor.evaluate((element) => document.activeElement === element), {
|
||||
|
||||
Reference in New Issue
Block a user