Skip to content

Commit 124398a

Browse files
gernbergOrKoN
authored andcommitted
Add tests
1 parent effbe56 commit 124398a

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/tools/pages.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,21 @@ describe('pages', () => {
297297
assert.ok(response.includePages);
298298
});
299299
});
300+
it('navigates to correct page with initScript', async () => {
301+
await withBrowser(async (response, context) => {
302+
await navigatePage.handler(
303+
{params: {url: 'data:text/html,<div>Hello MCP</div>', initScript: 'window.initScript = "completed"'}},
304+
response,
305+
context,
306+
);
307+
const page = context.getSelectedPage();
308+
309+
// wait for up to 1s for the global variable to set by the initScript to exist
310+
await page.waitForFunction("window.initScript==='completed'", {timeout: 1000});
311+
312+
assert.ok(response.includePages);
313+
});
314+
});
300315
});
301316
describe('resize', () => {
302317
it('resize the page', async () => {

0 commit comments

Comments
 (0)