fix: v0.17.0 — sim-control POST retries + permission-aware notifications e2e
CI / build + unit + e2e (pull_request) Successful in 6m52s
CI / build + unit + e2e (pull_request) Successful in 6m52s
This commit is contained in:
+15
-7
@@ -58,11 +58,19 @@ test('failed actions toast bottom-right (inline error stays) and the Time sectio
|
||||
return;
|
||||
}
|
||||
|
||||
// Fresh context → permission starts as 'default' (the opt-in prompt)…
|
||||
await expect(btn, 'fresh context shows the opt-in prompt').toHaveText('Enable notifications', { timeout: 10_000 });
|
||||
|
||||
// …and clicking requests it. Headless CI may deny — keep the assertion soft: accept either
|
||||
// outcome, but the label must reflect the RESULT of the request.
|
||||
await btn.click();
|
||||
await expect(btn).toHaveText(/Notifications (enabled|blocked)/i, { timeout: 10_000 });
|
||||
// Branch on the ACTUAL permission state — headless CI reports 'denied' (not 'default'), so a
|
||||
// fresh context is not guaranteed to show the opt-in prompt (CI run #47).
|
||||
const permission = await page.evaluate(() => Notification.permission);
|
||||
if (permission === 'denied') {
|
||||
// LeftPane renders the blocked-state label without any click.
|
||||
await expect(btn, 'denied context shows the blocked-state label').toHaveText('Notifications blocked', { timeout: 10_000 });
|
||||
} else if (permission === 'granted') {
|
||||
await expect(btn, 'pre-granted context shows the enabled label').toHaveText('Notifications enabled', { timeout: 10_000 });
|
||||
} else {
|
||||
// 'default' — the opt-in prompt. Clicking requests it; headless may deny, so accept either
|
||||
// outcome, but the label must CHANGE from the prompt to reflect the result.
|
||||
await expect(btn, 'non-denied context shows the opt-in prompt').toHaveText('Enable notifications', { timeout: 10_000 });
|
||||
await btn.click();
|
||||
await expect(btn).not.toHaveText('Enable notifications', { timeout: 10_000 });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user