Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: add a test for sourceURL in exception stacks (#1880)

Dmitry Gozmana0003354d83b
diff --git a/test/page.spec.js b/test/page.spec.js
index 4b644d9c5e..faddfaf769 100644
--- a/test/page.spec.js
+++ b/test/page.spec.js
@@ -500,12 +500,18 @@ describe('Page.Events.PageError', function() {
expect(error.name).toBe('Error');
expect(error.message).toBe('Fancy error!');
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
- // instead of the Error constructor call.
+ // Note that WebKit reports the stack of the 'throw' statement instead of the Error constructor call.
if (WEBKIT)
stack = stack.replace('14:25', '15:19');
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() {