test: add a test for a service worker with ignoreHTTPSErrors

This commit is contained in:
Alex Rudenko 2024-04-25 20:56:52 +02:00 committed by Alex Rudenko
parent cbf757efce
commit f20669163e

View File

@ -125,4 +125,17 @@ describe('ignoreHTTPSErrors', function () {
expect(await page.frames()[0]!.evaluate('1 + 2')).toBe(3); expect(await page.frames()[0]!.evaluate('1 + 2')).toBe(3);
expect(await page.frames()[1]!.evaluate('2 + 3')).toBe(5); expect(await page.frames()[1]!.evaluate('2 + 3')).toBe(5);
}); });
it('works for service worker', async () => {
const {httpsServer, page} = state;
await page.goto(httpsServer.PREFIX + '/serviceworkers/empty/sw.html');
await page.evaluate(async () => {
return (
globalThis as unknown as {
registrationPromise: Promise<{unregister: () => void}>;
}
).registrationPromise.then((registration: any) => {
return registration.unregister();
});
});
});
}); });