mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
test: use trace instead of log (#12504)
This commit is contained in:
parent
b8a566fae7
commit
73529cc64e
@ -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"],
|
||||
|
17
test/assets/consoletrace.html
Normal file
17
test/assets/consoletrace.html
Normal 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>
|
@ -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,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user