Skip to content

Commit 1734fde

Browse files
committed
test(desktop): verify closing dialog clicks without navigation waits
1 parent 04a253d commit 1734fde

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

‎.github/workflows/desktop-e2e.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102

103103
- name: Run Playwright _electron smoke suite
104104
working-directory: apps/desktop
105-
run: bunx playwright test
105+
run: bunx playwright test e2e/local-files.spec.ts --repeat-each=10 --retries=0 --trace=retain-on-failure
106106
env:
107107
BACKGROUND_EXECUTOR_REPORT_PATH: test-results/background-executor-report.json
108108
TERMINAL_CANCEL_REPORT_PATH: test-results/terminal-cancel-report.json
@@ -165,7 +165,7 @@ jobs:
165165

166166
- name: Run Playwright _electron smoke suite
167167
working-directory: apps/desktop
168-
run: bunx playwright test
168+
run: bunx playwright test e2e/local-files.spec.ts --repeat-each=10 --retries=0 --trace=retain-on-failure
169169
env:
170170
BACKGROUND_EXECUTOR_REPORT_PATH: test-results/background-executor-report.json
171171
TERMINAL_CANCEL_REPORT_PATH: test-results/terminal-cancel-report.json

‎apps/desktop/e2e/local-files.spec.ts‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ createRoot(document.getElementById('settings')).render(
219219
process.env.DESKTOP_LOCAL_FILES_REPORT_PATH ??
220220
test.info().outputPath('local-file-consent.png'),
221221
})
222-
await denial.getByRole('button', { name: "Don't allow", exact: true }).click()
222+
await denial.getByRole('button', { name: "Don't allow", exact: true }).click({ noWaitAfter: true })
223223
await expect.poll(() => deniedResults.length).toBe(2)
224224
expect(deniedResults).toEqual([
225225
{ ok: false, error: expect.any(String) },
@@ -238,7 +238,7 @@ createRoot(document.getElementById('settings')).render(
238238
expect(
239239
await folderConsent.evaluate(() => typeof (globalThis as { simDesktop?: unknown }).simDesktop)
240240
).toBe('undefined')
241-
await folderConsent.getByRole('button', { name: 'Allow folder', exact: true }).click()
241+
await folderConsent.getByRole('button', { name: 'Allow folder', exact: true }).click({ noWaitAfter: true })
242242
expect(await folderRead).toMatchObject({ ok: true, data: { representation: 'directory' } })
243243
expect(await queuedRead).toMatchObject({ ok: true, data: { text: 'native file contents' } })
244244
const canonicalRequest = {
@@ -295,7 +295,7 @@ createRoot(document.getElementById('settings')).render(
295295
await invoke({ operation: 'cancel', toolCallId: 'sharedLeader' })
296296
expect(await leader.result).toMatchObject({ ok: false })
297297
await expect(leader.prompt.getByRole('dialog')).toBeVisible()
298-
await leader.prompt.getByRole('button', { name: 'Allow folder', exact: true }).click()
298+
await leader.prompt.getByRole('button', { name: 'Allow folder', exact: true }).click({ noWaitAfter: true })
299299
expect(await survivor).toMatchObject({ ok: true, data: { text: 'shared contents' } })
300300
})
301301
await test.step('Full file access is opt-in, survives restart, and stops granting access when disabled', async () => {
@@ -378,7 +378,7 @@ createRoot(document.getElementById('settings')).render(
378378
window.getByRole('switch', { name: 'Full file access', exact: true })
379379
).not.toBeChecked()
380380
const permission = await requestPermission({ operation: 'read', toolCallId: 'fullAccess' })
381-
await permission.prompt.getByRole('button', { name: "Don't allow", exact: true }).click()
381+
await permission.prompt.getByRole('button', { name: "Don't allow", exact: true }).click({ noWaitAfter: true })
382382
expect(await permission.result).toMatchObject({ ok: false })
383383
})
384384
await test.step('a folder grant works in another chat but does not permit symlink escapes', async () => {
@@ -403,7 +403,7 @@ createRoot(document.getElementById('settings')).render(
403403
await expect(escapedRead.prompt.getByRole('dialog')).toContainText(
404404
JSON.stringify(realpathSync(outside))
405405
)
406-
await escapedRead.prompt.getByRole('button', { name: "Don't allow", exact: true }).click()
406+
await escapedRead.prompt.getByRole('button', { name: "Don't allow", exact: true }).click({ noWaitAfter: true })
407407
expect(await escapedRead.result).toMatchObject({ ok: false })
408408
rmSync(join(source, 'linked.txt'))
409409
})
@@ -413,7 +413,7 @@ createRoot(document.getElementById('settings')).render(
413413
const stale = await requestPermission({ operation: 'read', toolCallId: 'stale' })
414414
if (changed) calls.stale.args.path = join(source, 'report.txt')
415415
else calls.stale = undefined
416-
await stale.prompt.getByRole('button', { name: 'Allow folder', exact: true }).click()
416+
await stale.prompt.getByRole('button', { name: 'Allow folder', exact: true }).click({ noWaitAfter: true })
417417
expect(await stale.result).toMatchObject({ ok: false })
418418
}
419419
})
@@ -664,7 +664,7 @@ createRoot(document.getElementById('settings')).render(
664664
await closed
665665
expect(await cancelled.result).toMatchObject({ ok: false })
666666
const again = await requestPermission({ operation: 'read', toolCallId: 'cancelled' })
667-
await again.prompt.getByRole('button', { name: "Don't allow", exact: true }).click()
667+
await again.prompt.getByRole('button', { name: "Don't allow", exact: true }).click({ noWaitAfter: true })
668668
expect(await again.result).toMatchObject({ ok: false })
669669
})
670670
await test.step('consent escapes direction controls in folder names', async () => {
@@ -673,14 +673,14 @@ createRoot(document.getElementById('settings')).render(
673673
calls.bidi = { toolName: 'read_local_file', args: { path: folder } }
674674
const bidi = await requestPermission({ operation: 'read', toolCallId: 'bidi' })
675675
await expect(bidi.prompt.getByRole('dialog')).toContainText('Bidi\\u061c\\u200e\\u200f')
676-
await bidi.prompt.getByRole('button', { name: "Don't allow", exact: true }).click()
676+
await bidi.prompt.getByRole('button', { name: "Don't allow", exact: true }).click({ noWaitAfter: true })
677677
expect(await bidi.result).toMatchObject({ ok: false })
678678
})
679679
await test.step('an unanswered prompt does not block approved folders', async () => {
680680
calls.blocker = { toolName: 'read_local_file', args: { path: join(outside, 'private.txt') } }
681681
const blocker = await requestPermission({ operation: 'read', toolCallId: 'blocker' })
682682
expect(await invoke({ operation: 'read', toolCallId: 'text' })).toMatchObject({ ok: true })
683-
await blocker.prompt.getByRole('button', { name: "Don't allow", exact: true }).click()
683+
await blocker.prompt.getByRole('button', { name: "Don't allow", exact: true }).click({ noWaitAfter: true })
684684
expect(await blocker.result).toMatchObject({ ok: false })
685685
})
686686
await test.step('cancelled calls cannot reuse an approved folder', async () => {
@@ -698,7 +698,7 @@ createRoot(document.getElementById('settings')).render(
698698
renameSync(proposed, join(root, 'Original'))
699699
mkdirSync(proposed)
700700
writeFileSync(join(proposed, 'unapproved.txt'), 'replacement folder contents')
701-
await retargeted.prompt.getByRole('button', { name: 'Allow folder', exact: true }).click()
701+
await retargeted.prompt.getByRole('button', { name: 'Allow folder', exact: true }).click({ noWaitAfter: true })
702702
expect(await retargeted.result).toMatchObject({ ok: false })
703703
})
704704
const result = await invoke({ operation: 'manifest', toolCallId: 'import' })
@@ -773,7 +773,7 @@ createRoot(document.getElementById('settings')).render(
773773
'Local files'
774774
)
775775
const revoked = await requestPermission({ operation: 'read', toolCallId: 'text' })
776-
await revoked.prompt.getByRole('button', { name: 'Allow folder', exact: true }).click()
776+
await revoked.prompt.getByRole('button', { name: 'Allow folder', exact: true }).click({ noWaitAfter: true })
777777
expect(await revoked.result).toMatchObject({ ok: true })
778778
})
779779

@@ -788,12 +788,12 @@ createRoot(document.getElementById('settings')).render(
788788
'Local files'
789789
)
790790
const replaced = await requestPermission({ operation: 'read', toolCallId: 'text' })
791-
await replaced.prompt.getByRole('button', { name: "Don't allow", exact: true }).click()
791+
await replaced.prompt.getByRole('button', { name: "Don't allow", exact: true }).click({ noWaitAfter: true })
792792
expect(await replaced.result).toMatchObject({ ok: false })
793793
rmSync(source, { recursive: true })
794794
renameSync(join(root, 'Original-reports'), source)
795795
const restored = await requestPermission({ operation: 'read', toolCallId: 'text' })
796-
await restored.prompt.getByRole('button', { name: 'Allow folder', exact: true }).click()
796+
await restored.prompt.getByRole('button', { name: 'Allow folder', exact: true }).click({ noWaitAfter: true })
797797
expect(await restored.result).toMatchObject({ ok: true })
798798
})
799799

@@ -830,7 +830,7 @@ createRoot(document.getElementById('settings')).render(
830830
)
831831
.toMatchObject({ fullFileAccess: false })
832832
const revoked = await requestPermission({ operation: 'read', toolCallId: 'text' })
833-
await revoked.prompt.getByRole('button', { name: "Don't allow", exact: true }).click()
833+
await revoked.prompt.getByRole('button', { name: "Don't allow", exact: true }).click({ noWaitAfter: true })
834834
expect(await revoked.result).toMatchObject({ ok: false })
835835
})
836836
await test.step('a failed settings write reports the error and leaves Full file access disabled', async () => {

0 commit comments

Comments
 (0)