test: make init script test strict again (#5877)

This commit is contained in:
Pavel Feldman 2021-03-19 06:18:25 +08:00 committed by GitHub
parent c4410d3f4d
commit c68bd31053
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,11 +63,12 @@ it('should be callable from-inside addInitScript', async ({context, server}) =>
}); });
await context.addInitScript('window["woof"]("context")'); await context.addInitScript('window["woof"]("context")');
const page = await context.newPage(); const page = await context.newPage();
await page.addInitScript('window["woof"]("page")'); await page.evaluate('undefined');
expect(args).toEqual(['context']);
args = []; args = [];
await page.addInitScript('window["woof"]("page")');
await page.reload(); await page.reload();
expect(args).toContain('context'); expect(args).toEqual(['context', 'page']);
expect(args).toContain('page');
}); });
it('exposeBindingHandle should work', async ({context}) => { it('exposeBindingHandle should work', async ({context}) => {