test: use trace instead of log (#12504)

This commit is contained in:
Alex Rudenko 2024-05-29 18:37:52 +02:00 committed by GitHub
parent b8a566fae7
commit 73529cc64e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 35 deletions

View File

@ -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"],

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title>console.trace test</title>
</head>
<body>
<script>
function foo() {
console.trace('yellow')
}
function bar() {
foo();
}
bar();
</script>
</body>
</html>

View File

@ -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,
},