Skip to content

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

test: fix page.goto test on Firefox (#21132)

Andrey Lushnikov434fa470e33f
diff --git a/tests/page/page-goto.spec.ts b/tests/page/page-goto.spec.ts
index b8d99787d6..1683c08bcd 100644
--- a/tests/page/page-goto.spec.ts
+++ b/tests/page/page-goto.spec.ts
@@ -409,10 +409,14 @@ it('should fail when replaced by another navigation', async ({ page, server, bro
});
const error = await page.goto(server.PREFIX + '/empty.html').catch(e => e);
await anotherPromise;
- if (browserName === 'chromium')
+ if (browserName === 'chromium') {
expect(error.message).toContain('net::ERR_ABORTED');
- else if (browserName === 'webkit' || browserName === 'firefox')
+ } else if (browserName === 'webkit') {
expect(error.message).toContain('Navigation interrupted by another one');
+ } else if (browserName === 'firefox') {
+ // Firefox might yield either NS_BINDING_ABORTED or 'navigation interrupted by another one'
+ expect(error.message.includes('Navigation interrupted by another one') || error.message.includes('NS_BINDING_ABORTED')).toBe(true);
+ }
});
it('should work when navigating to valid url', async ({ page, server }) => {