mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix: mock safari.pushNotification (#29107)
Fixes https://github.com/microsoft/playwright/issues/29032
This commit is contained in:
parent
db00aa7305
commit
b2de9bc865
@ -786,7 +786,7 @@ export class WKPage implements PageDelegate {
|
||||
scripts.push('delete window.ondevicemotion');
|
||||
scripts.push('delete window.ondeviceorientation');
|
||||
}
|
||||
scripts.push('if (!window.safari) window.safari = {};');
|
||||
scripts.push('if (!window.safari) window.safari = { pushNotification: { toString() { return "[object SafariRemoteNotification]"; } } };');
|
||||
scripts.push('if (!window.GestureEvent) window.GestureEvent = function GestureEvent() {};');
|
||||
|
||||
for (const binding of this._page.allBindings())
|
||||
|
@ -212,10 +212,13 @@ it('serviceWorker should intercept document request', async ({ page, server }) =
|
||||
|
||||
it('webkit should define window.safari', async ({ page, server, browserName }) => {
|
||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/21037' });
|
||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/29032' });
|
||||
it.skip(browserName !== 'webkit');
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
const defined = await page.evaluate(() => !!(window as any).safari);
|
||||
expect(defined).toBeTruthy();
|
||||
expect(await page.evaluate(() => typeof (window as any).safari.pushNotification)).toBe('object');
|
||||
expect(await page.evaluate(() => (window as any).safari.pushNotification.toString())).toBe('[object SafariRemoteNotification]');
|
||||
});
|
||||
|
||||
it('make sure that XMLHttpRequest upload events are emitted correctly', async ({ page, server }) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user