From 73529cc64eef1dcea7853e11d16033b4dd47cc7f Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Wed, 29 May 2024 18:37:52 +0200 Subject: [PATCH] test: use trace instead of log (#12504) --- test/TestExpectations.json | 21 --------------------- test/assets/consoletrace.html | 17 +++++++++++++++++ test/src/page.spec.ts | 23 +++++++++-------------- 3 files changed, 26 insertions(+), 35 deletions(-) create mode 100644 test/assets/consoletrace.html diff --git a/test/TestExpectations.json b/test/TestExpectations.json index dd5d3bd694c..15242ce49fb 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -2967,20 +2967,6 @@ "expectations": ["SKIP"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, - { - "testIdPattern": "[page.spec] Page Page.Events.Console should have location and stack trace for console API calls", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["cdp", "firefox"], - "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, - { - "testIdPattern": "[page.spec] Page Page.Events.Console should have location and stack trace for console API calls", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, { "testIdPattern": "[page.spec] Page Page.Events.Console should have location when fetch fails", "platforms": ["darwin", "linux", "win32"], @@ -3009,13 +2995,6 @@ "expectations": ["FAIL"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, - { - "testIdPattern": "[page.spec] Page Page.Events.Console should work", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["firefox", "webDriverBiDi"], - "expectations": ["FAIL"], - "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" - }, { "testIdPattern": "[page.spec] Page Page.Events.Console should work for different console API calls with logging functions", "platforms": ["darwin", "linux", "win32"], diff --git a/test/assets/consoletrace.html b/test/assets/consoletrace.html new file mode 100644 index 00000000000..82986eb2bf6 --- /dev/null +++ b/test/assets/consoletrace.html @@ -0,0 +1,17 @@ + + + + console.trace test + + + + + diff --git a/test/src/page.spec.ts b/test/src/page.spec.ts index d64a73bcbf5..c0c59d16748 100644 --- a/test/src/page.spec.ts +++ b/test/src/page.spec.ts @@ -408,11 +408,6 @@ describe('Page', function () { expect(message.text()).toEqual('hello 5 JSHandle@object'); expect(message.type()).toEqual('log'); expect(message.args()).toHaveLength(3); - expect(message.location()).toEqual({ - url: expect.any(String), - lineNumber: expect.any(Number), - columnNumber: expect.any(Number), - }); expect(await message.args()[0]!.jsonValue()).toEqual('hello'); expect(await message.args()[1]!.jsonValue()).toEqual(5); @@ -550,33 +545,33 @@ describe('Page', function () { }); }); it('should have location and stack trace for console API calls', async () => { - const {page, server, isChrome} = await getTestState(); + const {page, server} = await getTestState(); await page.goto(server.EMPTY_PAGE); const [message] = await Promise.all([ waitEvent(page, 'console'), - page.goto(server.PREFIX + '/consolelog.html'), + page.goto(server.PREFIX + '/consoletrace.html'), ]); expect(message.text()).toBe('yellow'); - expect(message.type()).toBe('log'); + expect(message.type()).toBe('trace'); expect(message.location()).toEqual({ - url: server.PREFIX + '/consolelog.html', + url: server.PREFIX + '/consoletrace.html', lineNumber: 8, - columnNumber: isChrome ? 16 : 8, // console.|log vs |console.log + columnNumber: 16, }); expect(message.stackTrace()).toEqual([ { - url: server.PREFIX + '/consolelog.html', + url: server.PREFIX + '/consoletrace.html', lineNumber: 8, - columnNumber: isChrome ? 16 : 8, // console.|log vs |console.log + columnNumber: 16, }, { - url: server.PREFIX + '/consolelog.html', + url: server.PREFIX + '/consoletrace.html', lineNumber: 11, columnNumber: 8, }, { - url: server.PREFIX + '/consolelog.html', + url: server.PREFIX + '/consoletrace.html', lineNumber: 13, columnNumber: 6, },