Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: fix browsercontext-basic offline test (#28558)
Andrey Lushnikovdd9028cfe24a
diff --git a/tests/library/browsercontext-basic.spec.ts b/tests/library/browsercontext-basic.spec.tsindex 21ea63f860..0fd1f98390 100644--- a/tests/library/browsercontext-basic.spec.ts+++ b/tests/library/browsercontext-basic.spec.ts@@ -233,11 +233,21 @@ it('setContent should work after disabling javascript', async ({ contextFactoryawait expect(page.locator('h1')).toHaveText('Hello');});-it('should work with offline option', async ({ browser, server }) => {+it('should work with offline option', async ({ browser, server, browserName }) => {const context = await browser.newContext({ offline: true });const page = await context.newPage();let error = null;- await page.goto(server.EMPTY_PAGE).catch(e => error = e);+ if (browserName === 'firefox') {+ // Firefox navigates to an error page, and this navigation might conflict with the+ // next navigation we do in test.+ // So we need to wait for the navigation explicitly.+ await Promise.all([+ page.goto(server.EMPTY_PAGE).catch(e => error = e),+ page.waitForEvent('framenavigated'),+ ]);+ } else {+ await page.goto(server.EMPTY_PAGE).catch(e => error = e);+ }expect(error).toBeTruthy();await context.setOffline(false);const response = await page.goto(server.EMPTY_PAGE);