fix(test): align package E2E with web progress titles and cancel race

Match web progress restore to the current crawl title, and tolerate the
cancel dialog closing after the file index job already finished.
This commit is contained in:
hy committed 2026-09-20 19:07:34 +08:00
1 parent ad27aa092d
commit 91eb0ea6a3
2 files changed
+11 -3

No files matched your search

@@ -56,10 +56,18 @@ describe('settings workspace e2e', () => {
await waitForFileIndexJobIdle(page, workspaceId, SETTINGS_REAL_WORKSPACE_E2E_TIMEOUT_MS)
const dialogVisibleAfterIdle = await dialog.isVisible().catch(() => false)
if (dialogVisibleAfterIdle) {
await getSettingsLocator(
const confirmButton = getSettingsLocator(
page,
importSelectors.workspaceIndexCancelConfirmButton
).click()
)
// Job may reach a terminal state and close the dialog before click; stop is then a no-op.
if (await confirmButton.isVisible().catch(() => false)) {
try {
await confirmButton.click({ timeout: 5_000 })
} catch {
// Dialog closed while clicking; keep going and assert final indexed state.
}
}
}
const idle = await waitForFileIndexJobIdle(
page,
@@ -83,7 +83,7 @@ describe('settings workspace web e2e', () => {
})
await page
.getByTestId(importSelectors.webSourceIndexJobProgress)
.getByText('步骤 1/2 抓取网页', { exact: true })
.getByText('抓取网页', { exact: true })
.waitFor({ state: 'visible' })
}
})