From 4615607b7d7a8641bb51ba6d5a93057b863d8c90 Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Thu, 4 May 2023 11:43:12 +0200 Subject: [PATCH] chore: add test console after navigation (#10110) --- test/TestExpectations.json | 6 ++++++ test/src/page.spec.ts | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/test/TestExpectations.json b/test/TestExpectations.json index a9034f3f..bb875e53 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -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"], diff --git a/test/src/page.spec.ts b/test/src/page.spec.ts index 6bf28e10..13af6766 100644 --- a/test/src/page.spec.ts +++ b/test/src/page.spec.ts @@ -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(page, 'console'), + page.goto( + // Firefox prints warn if is not present + `data:text/html,` + ), + ]); + + expect(message.text()).toEqual('SOME_LOG_MESSAGE'); + }); it('should work for different console API calls with logging functions', async () => { const {page} = getTestState();