mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: worker interception for existing workers (#32494)
Failing test for https://github.com/microsoft/playwright/issues/32355
This commit is contained in:
parent
11441c0fe1
commit
df2bc2d0dc
@ -100,8 +100,7 @@ it('should work with glob', async () => {
|
|||||||
expect(globToRegex('$^+.\\*()|\\?\\{\\}\\[\\]')).toEqual(/^\$\^\+\.\*\(\)\|\?\{\}\[\]$/);
|
expect(globToRegex('$^+.\\*()|\\?\\{\\}\\[\\]')).toEqual(/^\$\^\+\.\*\(\)\|\?\{\}\[\]$/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should intercept network activity from worker', async function({ page, server, isAndroid, browserName, browserMajorVersion }) {
|
it('should intercept network activity from worker', async function({ page, server, isAndroid }) {
|
||||||
it.skip(browserName === 'firefox' && browserMajorVersion < 114, 'https://github.com/microsoft/playwright/issues/21760');
|
|
||||||
it.skip(isAndroid);
|
it.skip(isAndroid);
|
||||||
|
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
@ -122,6 +121,35 @@ it('should intercept network activity from worker', async function({ page, serve
|
|||||||
expect(msg.text()).toBe('intercepted');
|
expect(msg.text()).toBe('intercepted');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should intercept worker requests when enabled after worker creation', {
|
||||||
|
annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/32355' }
|
||||||
|
}, async function({ page, server, isAndroid, browserName }) {
|
||||||
|
it.skip(isAndroid);
|
||||||
|
it.fixme(browserName === 'chromium');
|
||||||
|
|
||||||
|
await page.goto(server.EMPTY_PAGE);
|
||||||
|
server.setRoute('/data_for_worker', (req, res) => res.end('failed to intercept'));
|
||||||
|
const url = server.PREFIX + '/data_for_worker';
|
||||||
|
await page.evaluate(url => {
|
||||||
|
(window as any).w = new Worker(URL.createObjectURL(new Blob([`
|
||||||
|
onmessage = function(e) {
|
||||||
|
fetch("${url}").then(response => response.text()).then(console.log);
|
||||||
|
};
|
||||||
|
`], { type: 'application/javascript' })));
|
||||||
|
}, url);
|
||||||
|
await page.route(url, route => {
|
||||||
|
route.fulfill({
|
||||||
|
status: 200,
|
||||||
|
body: 'intercepted',
|
||||||
|
}).catch(e => null);
|
||||||
|
});
|
||||||
|
const [msg] = await Promise.all([
|
||||||
|
page.waitForEvent('console'),
|
||||||
|
page.evaluate(() => (window as any).w.postMessage(''))
|
||||||
|
]);
|
||||||
|
expect(msg.text()).toBe('intercepted');
|
||||||
|
});
|
||||||
|
|
||||||
it('should intercept network activity from worker 2', async function({ page, server, isAndroid }) {
|
it('should intercept network activity from worker 2', async function({ page, server, isAndroid }) {
|
||||||
it.skip(isAndroid);
|
it.skip(isAndroid);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user