From 434fa470e33f0e0ee74c8e8f6e46c0d8672c71a6 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Wed, 22 Feb 2023 19:18:49 -0800 Subject: [PATCH] test: fix page.goto test on Firefox (#21132) Turns out Firefox can yield either of the two errors, depending on the stage of the pending navigation. --- tests/page/page-goto.spec.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 }) => {