Files
orca/tests/e2e/helpers/electron-main-evaluate-retry.unit.test.ts
mirror 34fa2cd5ca
Skill update round trip / roundtrip (false, macos-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, macos-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, symlink, latest) (push) Canceled after 0s
Skill update round trip / roundtrip (false, windows-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, windows-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, macos-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, macos-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, ubuntu-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, ubuntu-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, windows-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, windows-latest, symlink, 1.5.17) (push) Canceled after 0s
source snapshot 2026-09-02
2026-09-02 02:03:16 +08:00

55 lines
1.6 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { retryTransientMainEvaluate } from './electron-main-evaluate-retry'
const transient = (): Error =>
new Error('Execution context was destroyed, most likely because of a navigation.')
describe('retryTransientMainEvaluate', () => {
it('returns the first successful read without retrying', async () => {
let calls = 0
await expect(
retryTransientMainEvaluate(async () => {
calls += 1
return '/isolated/home'
})
).resolves.toBe('/isolated/home')
expect(calls).toBe(1)
})
it('rides out the startup window that made the paired-client launch flaky', async () => {
let calls = 0
await expect(
retryTransientMainEvaluate(async () => {
calls += 1
if (calls < 3) {
throw transient()
}
return '/isolated/home'
})
).resolves.toBe('/isolated/home')
expect(calls).toBe(3)
})
it('rethrows a real failure immediately instead of masking it behind retries', async () => {
let calls = 0
await expect(
retryTransientMainEvaluate(async () => {
calls += 1
throw new Error('Electron E2E HOME escaped the disposable profile boundary')
})
).rejects.toThrow(/escaped the disposable profile/)
expect(calls).toBe(1)
})
it('gives up rather than looping forever when the app never becomes evaluable', async () => {
let calls = 0
await expect(
retryTransientMainEvaluate(async () => {
calls += 1
throw transient()
})
).rejects.toThrow(/Execution context was destroyed/)
expect(calls).toBe(5)
})
})