chore: add test console after navigation (#10110)

This commit is contained in:
Nikolay Vitkov 2023-05-04 11:43:12 +02:00 committed by GitHub
parent 3fb8135f68
commit 4615607b7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View File

@ -425,6 +425,12 @@
"parameters": ["cdp", "firefox"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[page.spec] Page Page.Events.Console should work on script call right after navigation",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.setContent *",
"platforms": ["darwin", "linux", "win32"],

View File

@ -649,6 +649,19 @@ describe('Page', function () {
expect(await message.args()[1]!.jsonValue()).toEqual(5);
expect(await message.args()[2]!.jsonValue()).toEqual({foo: 'bar'});
});
it('should work on script call right after navigation', async () => {
const {page} = getTestState();
const [message] = await Promise.all([
waitEvent<ConsoleMessage>(page, 'console'),
page.goto(
// Firefox prints warn if <!DOCTYPE html> is not present
`data:text/html,<!DOCTYPE html><script>console.log('SOME_LOG_MESSAGE');</script>`
),
]);
expect(message.text()).toEqual('SOME_LOG_MESSAGE');
});
it('should work for different console API calls with logging functions', async () => {
const {page} = getTestState();