mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
test: add a test for sourceURL in exception stacks (#1880)
This commit is contained in:
parent
649f37f885
commit
a0003354d8
@ -500,12 +500,18 @@ describe('Page.Events.PageError', function() {
|
|||||||
expect(error.name).toBe('Error');
|
expect(error.name).toBe('Error');
|
||||||
expect(error.message).toBe('Fancy error!');
|
expect(error.message).toBe('Fancy error!');
|
||||||
let stack = await page.evaluate(() => window.e.stack);
|
let stack = await page.evaluate(() => window.e.stack);
|
||||||
// Note that WebKit does not use sourceURL for some reason and reports the stack of the 'throw' statement
|
// Note that WebKit reports the stack of the 'throw' statement instead of the Error constructor call.
|
||||||
// instead of the Error constructor call.
|
|
||||||
if (WEBKIT)
|
if (WEBKIT)
|
||||||
stack = stack.replace('14:25', '15:19');
|
stack = stack.replace('14:25', '15:19');
|
||||||
expect(error.stack).toBe(stack);
|
expect(error.stack).toBe(stack);
|
||||||
});
|
});
|
||||||
|
it.fail(WEBKIT)('should contain sourceURL', async({page, server}) => {
|
||||||
|
const [error] = await Promise.all([
|
||||||
|
page.waitForEvent('pageerror'),
|
||||||
|
page.goto(server.PREFIX + '/error.html'),
|
||||||
|
]);
|
||||||
|
expect(error.stack).toContain('myscript.js');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.setContent', function() {
|
describe('Page.setContent', function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user