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.
This commit is contained in:
Andrey Lushnikov 2023-02-22 19:18:49 -08:00 committed by GitHub
parent c8f63c04cc
commit 434fa470e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 }) => {