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
chore(test): introduce isBidi fixture (#38564)
Yury Semikhatskyc3711937fd50
diff --git a/tests/config/browserTest.ts b/tests/config/browserTest.tsindex 2925b037d6..5278da0b43 100644--- a/tests/config/browserTest.ts+++ b/tests/config/browserTest.ts@@ -20,7 +20,7 @@ import * as path from 'path';import { baseTest } from './baseTest';import { RunServer, RemoteServer } from './remoteServer';import { removeFolders } from '../../packages/playwright-core/lib/server/utils/fileUtils';-import { parseHar } from '../config/utils';+import { isBidiChannel, parseHar } from '../config/utils';import { createSkipTestPredicate } from '../bidi/expectationUtil';import type { PageTestFixtures, PageWorkerFixtures } from '../page/pageTestApi';@@ -39,6 +39,7 @@ export type BrowserTestWorkerFixtures = PageWorkerFixtures & {isElectron: boolean;isHeadlessShell: boolean;nodeVersion: { major: number, minor: number, patch: number };+ isBidi: boolean;bidiTestSkipPredicate: (info: TestInfo) => boolean;};@@ -73,8 +74,8 @@ const test = baseTest.extend<BrowserTestTestFixtures, BrowserTestWorkerFixtures>await run(false);}, { scope: 'worker' }],- defaultSameSiteCookieValue: [async ({ browserName, platform, channel }, run) => {- if (browserName === 'chromium' || channel?.startsWith('moz-firefox'))+ defaultSameSiteCookieValue: [async ({ browserName, platform, channel, isBidi }, run) => {+ if (browserName === 'chromium' || isBidi)await run('Lax');else if (browserName === 'webkit' && (platform === 'linux' || channel === 'webkit-wsl'))await run('Lax');@@ -95,6 +96,10 @@ const test = baseTest.extend<BrowserTestTestFixtures, BrowserTestWorkerFixtures>await use({ major: +major, minor: +minor, patch: +patch });}, { scope: 'worker' }],+ isBidi: [async ({ channel }, use) => {+ await use(isBidiChannel(channel));+ }, { scope: 'worker' }],+isAndroid: [false, { scope: 'worker' }],isElectron: [false, { scope: 'worker' }],electronMajorVersion: [0, { scope: 'worker' }],diff --git a/tests/config/utils.ts b/tests/config/utils.tsindex 3d62248411..bba8dc3596 100644--- a/tests/config/utils.ts+++ b/tests/config/utils.ts@@ -63,11 +63,15 @@ export function expectedSSLError(browserName: string, platform: string, channel:elsereturn /Unacceptable TLS certificate|Operation was cancelled/;}- if (channel?.startsWith('moz-firefox'))+ if (browserName === 'firefox' && isBidiChannel(channel))return /MOZILLA_PKIX_ERROR_SELF_SIGNED_CERT/;return /SSL_ERROR_UNKNOWN/;}+export function isBidiChannel(channel: string | undefined): boolean {+ return channel?.startsWith('bidi-chrom') || channel?.startsWith('moz-firefox') || false;+}+export function chromiumVersionLessThan(a: string, b: string) {const left: number[] = a.split('.').map(e => Number(e));const right: number[] = b.split('.').map(e => Number(e));diff --git a/tests/library/browsercontext-basic.spec.ts b/tests/library/browsercontext-basic.spec.tsindex c5e15b31be..795e8d1932 100644--- a/tests/library/browsercontext-basic.spec.ts+++ b/tests/library/browsercontext-basic.spec.ts@@ -255,8 +255,8 @@ it('should be able to navigate after disabling javascript', async ({ browser, seawait context.close();});-it('should not hang on promises after disabling javascript', async ({ browserName, contextFactory, channel }) => {- it.fixme(browserName === 'firefox' && !channel?.startsWith('moz-firefox'));+it('should not hang on promises after disabling javascript', async ({ browserName, contextFactory, isBidi }) => {+ it.fixme(browserName === 'firefox' && !isBidi);const context = await contextFactory({ javaScriptEnabled: false });const page = await context.newPage();expect(await page.evaluate(() => 1)).toBe(1);diff --git a/tests/library/browsercontext-device.spec.ts b/tests/library/browsercontext-device.spec.tsindex 11602d0caa..c36acda6fe 100644--- a/tests/library/browsercontext-device.spec.ts+++ b/tests/library/browsercontext-device.spec.ts@@ -18,7 +18,7 @@import { browserTest as it, expect } from '../config/browserTest';it.describe('device', () => {- it.skip(({ browserName, channel }) => browserName === 'firefox' && !channel?.startsWith('moz-firefox'));+ it.skip(({ browserName, isBidi }) => browserName === 'firefox' && !isBidi);it('should work @smoke', async ({ playwright, browser, server }) => {const iPhone = playwright.devices['iPhone 6'];diff --git a/tests/library/browsercontext-events.spec.ts b/tests/library/browsercontext-events.spec.tsindex e1cb543b70..16dbd6ffd2 100644--- a/tests/library/browsercontext-events.spec.ts+++ b/tests/library/browsercontext-events.spec.ts@@ -52,8 +52,8 @@ test('console event should work in popup', async ({ page }) => {expect(message.page()).toBe(popup);});-test('console event should work in popup 2', async ({ page, browserName, channel }) => {- test.fixme(browserName === 'firefox' && !channel?.startsWith('moz-firefox'), 'console message from javascript: url is not reported at all');+test('console event should work in popup 2', async ({ page, browserName, isBidi }) => {+ test.fixme(browserName === 'firefox' && !isBidi, 'console message from javascript: url is not reported at all');const [, message, popup] = await Promise.all([page.evaluate(async () => {@@ -69,8 +69,8 @@ test('console event should work in popup 2', async ({ page, browserName, channelexpect(message.page()).toBe(popup);});-test('console event should work in immediately closed popup', async ({ page, browserName, channel }) => {- test.fixme(browserName === 'firefox' && !channel?.startsWith('moz-firefox'), 'console message is not reported at all');+test('console event should work in immediately closed popup', async ({ page, browserName, isBidi }) => {+ test.fixme(browserName === 'firefox' && !isBidi, 'console message is not reported at all');const [, message, popup] = await Promise.all([page.evaluate(async () => {diff --git a/tests/library/browsercontext-page-event.spec.ts b/tests/library/browsercontext-page-event.spec.tsindex 83e01ff0cb..27e7404e31 100644--- a/tests/library/browsercontext-page-event.spec.ts+++ b/tests/library/browsercontext-page-event.spec.ts@@ -170,7 +170,7 @@ it('should work with Shift-clicking', async ({ browser, server, browserName }) =await context.close();});-it('should work with Ctrl-clicking', async ({ browser, server, browserName, channel }) => {+it('should work with Ctrl-clicking', async ({ browser, server, browserName, isBidi }) => {const context = await browser.newContext();const page = await context.newPage();await page.goto(server.EMPTY_PAGE);@@ -179,6 +179,6 @@ it('should work with Ctrl-clicking', async ({ browser, server, browserName, chancontext.waitForEvent('page'),page.click('a', { modifiers: ['ControlOrMeta'] }),]);- expect(await popup.opener()).toBe(browserName === 'firefox' && !channel?.startsWith('moz-firefox') ? page : null);+ expect(await popup.opener()).toBe(browserName === 'firefox' && !isBidi ? page : null);await context.close();});diff --git a/tests/library/browsercontext-pages.spec.ts b/tests/library/browsercontext-pages.spec.tsindex bef78bf412..15323f9370 100644--- a/tests/library/browsercontext-pages.spec.ts+++ b/tests/library/browsercontext-pages.spec.ts@@ -79,8 +79,8 @@ it('should click the button with deviceScaleFactor set', async ({ browser, serveawait context.close();});-it('should click the button with offset with page scale', async ({ browser, server, browserName, channel }) => {- it.skip(browserName === 'firefox' && !channel?.startsWith('moz-firefox'));+it('should click the button with offset with page scale', async ({ browser, server, browserName, isBidi }) => {+ it.skip(browserName === 'firefox' && !isBidi);const context = await browser.newContext({ viewport: { width: 400, height: 400 }, isMobile: true });const page = await context.newPage();@@ -102,8 +102,8 @@ it('should click the button with offset with page scale', async ({ browser, servawait context.close();});-it('should return bounding box with page scale', async ({ browser, server, browserName, channel }) => {- it.skip(browserName === 'firefox' && !channel?.startsWith('moz-firefox'));+it('should return bounding box with page scale', async ({ browser, server, browserName, isBidi }) => {+ it.skip(browserName === 'firefox' && !isBidi);const context = await browser.newContext({ viewport: { width: 400, height: 400 }, isMobile: true });const page = await context.newPage();diff --git a/tests/library/browsercontext-proxy.spec.ts b/tests/library/browsercontext-proxy.spec.tsindex 1e69fdddec..609f32b6c2 100644--- a/tests/library/browsercontext-proxy.spec.ts+++ b/tests/library/browsercontext-proxy.spec.ts@@ -172,8 +172,8 @@ it.describe('should proxy local network requests', () => {});-it('should use ipv6 proxy', async ({ contextFactory, server, proxyServer, browserName, channel }) => {- it.fail(browserName === 'firefox' && !channel?.startsWith('moz-firefox'), 'page.goto: NS_ERROR_UNKNOWN_HOST');+it('should use ipv6 proxy', async ({ contextFactory, server, proxyServer, browserName, channel, isBidi }) => {+ it.fail(browserName === 'firefox' && !isBidi, 'page.goto: NS_ERROR_UNKNOWN_HOST');it.fail(channel === 'webkit-wsl', 'WebKit on WSL does not support IPv6: https://github.com/microsoft/WSL/issues/10803');proxyServer.forwardTo(server.PORT);const context = await contextFactory({diff --git a/tests/library/browsercontext-timezone-id.spec.ts b/tests/library/browsercontext-timezone-id.spec.tsindex 4ce69ffcba..53ab47f3bc 100644--- a/tests/library/browsercontext-timezone-id.spec.ts+++ b/tests/library/browsercontext-timezone-id.spec.ts@@ -45,13 +45,13 @@ it('should work @smoke', async ({ browser, browserName }) => {}});-it('should throw for invalid timezone IDs when creating pages', async ({ browser, channel }) => {+it('should throw for invalid timezone IDs when creating pages', async ({ browser, channel, browserName, isBidi }) => {for (const timezoneId of ['Foo/Bar', 'Baz/Qux']) {- if (channel?.startsWith('bidi-chrom') || channel?.startsWith('moz-firefox')) {+ if (isBidi) {const error = await browser.newContext({ timezoneId }).catch(e => e);- if (channel?.startsWith('bidi-chrom'))+ if (browserName === 'chromium')expect(error.message).toContain(`Invalid timezone "${timezoneId}"`);- else if (channel?.startsWith('moz-firefox'))+ else if (browserName === 'firefox')expect(error.message).toContain(`Expected "timezone" to be a valid timezone ID (e.g., "Europe/Berlin") or a valid timezone offset (e.g., "+01:00"), got ${timezoneId}`);} else {let error = null;diff --git a/tests/library/browsercontext-viewport-mobile.spec.ts b/tests/library/browsercontext-viewport-mobile.spec.tsindex a4b8c242c3..e567db21bd 100644--- a/tests/library/browsercontext-viewport-mobile.spec.ts+++ b/tests/library/browsercontext-viewport-mobile.spec.ts@@ -18,7 +18,7 @@import { browserTest as it, expect } from '../config/browserTest';it.describe('mobile viewport', () => {- it.skip(({ browserName, channel }) => browserName === 'firefox' && !channel?.startsWith('moz-firefox'));+ it.skip(({ browserName, isBidi }) => browserName === 'firefox' && !isBidi);it('should support mobile emulation', async ({ playwright, browser, server }) => {const iPhone = playwright.devices['iPhone 6'];diff --git a/tests/library/browsercontext-viewport.spec.ts b/tests/library/browsercontext-viewport.spec.tsindex 6a1246c411..4d70520968 100644--- a/tests/library/browsercontext-viewport.spec.ts+++ b/tests/library/browsercontext-viewport.spec.ts@@ -128,8 +128,8 @@ browserTest('should support touch with null viewport', async ({ browser, serverawait context.close();});-it('should set both screen and viewport options', async ({ contextFactory, browserName, channel }) => {- it.fail(browserName === 'firefox' && !channel?.startsWith('moz-firefox'), 'Screen size is reset to viewport');+it('should set both screen and viewport options', async ({ contextFactory, browserName, isBidi }) => {+ it.fail(browserName === 'firefox' && !isBidi, 'Screen size is reset to viewport');const context = await contextFactory({screen: { 'width': 1280, 'height': 720 },viewport: { 'width': 1000, 'height': 600 },@@ -186,9 +186,9 @@ browserTest('should be able to get correct orientation angle on non-mobile devicawait context.close();});-it('should set window.screen.orientation.type for mobile devices', async ({ contextFactory, browserName, server, channel }) => {+it('should set window.screen.orientation.type for mobile devices', async ({ contextFactory, browserName, server, isBidi }) => {it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/31151' });- it.skip(browserName === 'firefox' && !channel?.startsWith('moz-firefox'), 'Firefox does not support mobile emulation');+ it.skip(browserName === 'firefox' && !isBidi, 'Firefox does not support mobile emulation');const context = await contextFactory(devices['iPhone 14']);const page = await context.newPage();await page.goto(server.PREFIX + '/index.html');diff --git a/tests/library/browsertype-launch.spec.ts b/tests/library/browsertype-launch.spec.tsindex 36cfa9c532..a66ccf1222 100644--- a/tests/library/browsertype-launch.spec.ts+++ b/tests/library/browsertype-launch.spec.ts@@ -53,8 +53,8 @@ it('should throw if port option is passed for persistent context', async ({ browexpect(error!.message).toContain('Cannot specify a port without launching as a server.');});-it('should throw if page argument is passed', async ({ browserType, browserName, channel }) => {- it.skip(browserName === 'firefox' && !channel?.startsWith('moz-firefox'));+it('should throw if page argument is passed', async ({ browserType, browserName, isBidi }) => {+ it.skip(browserName === 'firefox' && !isBidi);let waitError: Error | undefined;await browserType.launch({ args: ['http://example.com'] }).catch(e => waitError = e);diff --git a/tests/library/defaultbrowsercontext-2.spec.ts b/tests/library/defaultbrowsercontext-2.spec.tsindex 32ed2129b8..9b95c4f91d 100644--- a/tests/library/defaultbrowsercontext-2.spec.ts+++ b/tests/library/defaultbrowsercontext-2.spec.ts@@ -150,8 +150,8 @@ it('should have default URL when launching browser', async ({ launchPersistent }expect(urls).toEqual(['about:blank']);});-it('should throw if page argument is passed', async ({ browserType, server, createUserDataDir, browserName, channel }) => {- it.skip(browserName === 'firefox' && !channel?.startsWith('moz-firefox'));+it('should throw if page argument is passed', async ({ browserType, server, createUserDataDir, browserName, isBidi }) => {+ it.skip(browserName === 'firefox' && !isBidi);const options = { args: [server.EMPTY_PAGE] };const error = await browserType.launchPersistentContext(await createUserDataDir(), options).catch(e => e);diff --git a/tests/library/emulation-focus.spec.ts b/tests/library/emulation-focus.spec.tsindex a7e71a6195..2e0e90348c 100644--- a/tests/library/emulation-focus.spec.ts+++ b/tests/library/emulation-focus.spec.ts@@ -198,10 +198,10 @@ browserTest('should not fire blur events when interacting with more than one pagexpect(await page2.evaluate(() => !!window['gotBlur'])).toBe(false);});-browserTest('should trigger hover state concurrently', async ({ browserType, browserName, headless, channel }) => {+browserTest('should trigger hover state concurrently', async ({ browserType, browserName, headless, isBidi }) => {browserTest.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/27969' });browserTest.skip(!headless, 'headed messes up with hover');- browserTest.fixme(browserName === 'firefox' && !channel?.startsWith('moz-firefox'));+ browserTest.fixme(browserName === 'firefox' && !isBidi);const browser1 = await browserType.launch();const context1 = await browser1.newContext();diff --git a/tests/library/har.spec.ts b/tests/library/har.spec.tsindex f51d290ce8..c67027fa7b 100644--- a/tests/library/har.spec.ts+++ b/tests/library/har.spec.ts@@ -859,7 +859,7 @@ it('should include redirects from API request', async ({ contextFactory, serverexpect(json.timings).toBeDefined();});-it('should not hang on resources served from cache', async ({ contextFactory, server, browserName, channel }, testInfo) => {+it('should not hang on resources served from cache', async ({ contextFactory, server, browserName, isBidi }, testInfo) => {it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/11435' });server.setRoute('/one-style.css', (req, res) => {res.writeHead(200, {@@ -874,7 +874,7 @@ it('should not hang on resources served from cache', async ({ contextFactory, seconst log = await getLog();const entries = log.entries.filter(e => e.request.url.endsWith('one-style.css'));// In firefox no request events are fired for cached resources.- if (browserName === 'firefox' && !channel?.startsWith('moz-firefox'))+ if (browserName === 'firefox' && !isBidi)expect(entries.length).toBe(1);elseexpect(entries.length).toBe(2);diff --git a/tests/library/headful.spec.ts b/tests/library/headful.spec.tsindex 742334a774..38923a4131 100644--- a/tests/library/headful.spec.ts+++ b/tests/library/headful.spec.ts@@ -288,9 +288,9 @@ it('should click bottom row w/ infobar in OOPIF', async ({ browserName, launchPeexpect(await page.frames()[1].evaluate('window._clicked')).toBe(true);});-it('headless and headful should use same default fonts', async ({ page, browserName, browserType, channel }) => {+it('headless and headful should use same default fonts', async ({ page, browserName, browserType, isBidi }) => {it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/11177' });- it.skip(browserName === 'firefox' && !channel?.startsWith('moz-firefox'), 'Text is misaligned in headed vs headless');+ it.skip(browserName === 'firefox' && !isBidi, 'Text is misaligned in headed vs headless');const genericFontFamilies = ['standard',diff --git a/tests/library/resource-timing.spec.ts b/tests/library/resource-timing.spec.tsindex 229958cbe1..b100a102fb 100644--- a/tests/library/resource-timing.spec.ts+++ b/tests/library/resource-timing.spec.ts@@ -100,9 +100,9 @@ it('should work for redirect', async ({ contextFactory, browserName, server }) =await context.close();});-it('should work when serving from memory cache', async ({ contextFactory, server, browserName, channel }) => {+it('should work when serving from memory cache', async ({ contextFactory, server, browserName, isBidi }) => {it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright-java/issues/1080' });- it.fixme(browserName === 'firefox' && !channel?.startsWith('moz-firefox'), 'Response event is not fired in Firefox');+ it.fixme(browserName === 'firefox' && !isBidi, 'Response event is not fired in Firefox');server.setRoute('/one-style.css', (req, res) => {res.writeHead(200, {'Content-Type': 'text/css',diff --git a/tests/library/screenshot.spec.ts b/tests/library/screenshot.spec.tsindex cbf2f8dea8..9d525f2f62 100644--- a/tests/library/screenshot.spec.ts+++ b/tests/library/screenshot.spec.ts@@ -108,7 +108,7 @@ browserTest.describe('page screenshot', () => {await context.close();});- browserTest('should throw if screenshot size is too large with device scale factor', async ({ browser, browserName, isMac, channel }) => {+ browserTest('should throw if screenshot size is too large with device scale factor', async ({ browser, browserName, isMac, isBidi }) => {browserTest.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/16727' });const context = await browser.newContext({ viewport: { width: 500, height: 500 }, deviceScaleFactor: 2 });const page = await context.newPage();@@ -120,7 +120,7 @@ browserTest.describe('page screenshot', () => {{await page.setContent(`<style>body {margin: 0; padding: 0;}</style><div style='min-height: 16384px; background: red;'></div>`);const exception = await page.screenshot({ fullPage: true }).catch(e => e);- if ((browserName === 'firefox' && !channel?.startsWith('moz-firefox')) || (browserName === 'webkit' && !isMac))+ if ((browserName === 'firefox' && !isBidi) || (browserName === 'webkit' && !isMac))expect(exception.message).toContain('Cannot take screenshot larger than 32767');const image = await page.screenshot({ fullPage: true, scale: 'css' });@@ -204,8 +204,8 @@ browserTest.describe('page screenshot', () => {browserTest.describe('element screenshot', () => {browserTest.skip(({ browserName, headless }) => browserName === 'firefox' && !headless);- browserTest('element screenshot should work with a mobile viewport', async ({ browser, server, browserName, channel }) => {- browserTest.skip(browserName === 'firefox' && !channel?.startsWith('moz-firefox'));+ browserTest('element screenshot should work with a mobile viewport', async ({ browser, server, browserName, isBidi }) => {+ browserTest.skip(browserName === 'firefox' && !isBidi);const context = await browser.newContext({ viewport: { width: 320, height: 480 }, isMobile: true });const page = await context.newPage();@@ -217,8 +217,8 @@ browserTest.describe('element screenshot', () => {await context.close();});- browserTest('element screenshot should work with device scale factor', async ({ browser, server, browserName, channel }) => {- browserTest.skip(browserName === 'firefox' && !channel?.startsWith('moz-firefox'));+ browserTest('element screenshot should work with device scale factor', async ({ browser, server, browserName, isBidi }) => {+ browserTest.skip(browserName === 'firefox' && !isBidi);const context = await browser.newContext({ viewport: { width: 320, height: 480 }, deviceScaleFactor: 2 });const page = await context.newPage();diff --git a/tests/library/trace-viewer.spec.ts b/tests/library/trace-viewer.spec.tsindex f52ea66d30..6f2b113167 100644--- a/tests/library/trace-viewer.spec.ts+++ b/tests/library/trace-viewer.spec.ts@@ -1761,8 +1761,8 @@ test('canvas clipping in iframe', async ({ runAndTrace, page, server }) => {await expect(canvas).toHaveAttribute('title', 'Canvas contents are displayed on a best-effort basis based on viewport screenshots taken during test execution.');});-test('should show only one pointer with multilevel iframes', async ({ page, runAndTrace, server, browserName, channel }) => {- test.fixme(browserName === 'firefox' && !channel?.startsWith('moz-firefox'), 'Elements in iframe are not marked');+test('should show only one pointer with multilevel iframes', async ({ page, runAndTrace, server, browserName, isBidi }) => {+ test.fixme(browserName === 'firefox' && !isBidi, 'Elements in iframe are not marked');server.setRoute('/level-0.html', (req, res) => {res.writeHead(200, { 'Content-Type': 'text/html' });diff --git a/tests/page/frame-goto.spec.ts b/tests/page/frame-goto.spec.tsindex e63cd363b4..0b737d1491 100644--- a/tests/page/frame-goto.spec.ts+++ b/tests/page/frame-goto.spec.ts@@ -43,9 +43,9 @@ it('should reject when frame detaches', async ({ page, server, browserName }) =>expect(error.message.toLowerCase()).toContain('frame was detached');});-it('should continue after client redirect', async ({ page, server, isAndroid, browserName, channel }) => {+it('should continue after client redirect', async ({ page, server, isAndroid, browserName, isBidi }) => {it.fixme(isAndroid);- it.fixme(browserName === 'firefox' && !channel?.startsWith('moz-firefox'), 'script.js is requested before navigationCommitted arrives');+ it.fixme(browserName === 'firefox' && !isBidi, 'script.js is requested before navigationCommitted arrives');server.setRoute('/frames/script.js', () => {});const url = server.PREFIX + '/frames/child-redirect.html';diff --git a/tests/page/frame-hierarchy.spec.ts b/tests/page/frame-hierarchy.spec.tsindex ab1b6af33f..1b072f491a 100644--- a/tests/page/frame-hierarchy.spec.ts+++ b/tests/page/frame-hierarchy.spec.ts@@ -35,10 +35,9 @@ function dumpFrames(frame: Frame, indentation: string = ''): string[] {return result;}-it('should handle nested frames @smoke', async ({ page, server, isAndroid, browserName, channel }) => {+it('should handle nested frames @smoke', async ({ page, server, isAndroid, isBidi }) => {it.skip(isAndroid, 'No cross-process on Android');- it.skip(browserName === 'firefox' && channel?.startsWith('moz-firefox'), 'frame.name() is racy with BiDi');- it.skip(channel?.startsWith('bidi-chrom'), 'frame.name() is racy with BiDi');+ it.skip(isBidi, 'frame.name() is racy with BiDi');await page.goto(server.PREFIX + '/frames/nested-frames.html');expect(dumpFrames(page.mainFrame())).toEqual([@@ -156,9 +155,8 @@ it('should report frame from-inside shadow DOM', async ({ page, server }) => {expect(page.frames()[1].url()).toBe(server.EMPTY_PAGE);});-it('should report frame.name()', async ({ page, server, browserName, channel }) => {- it.skip(browserName === 'firefox' && channel?.startsWith('moz-firefox'), 'frame.name() is racy with BiDi');- it.skip(channel?.startsWith('bidi-chrom'), 'frame.name() is racy with BiDi');+it('should report frame.name()', async ({ page, server, isBidi }) => {+ it.skip(isBidi, 'frame.name() is racy with BiDi');await attachFrame(page, 'theFrameId', server.EMPTY_PAGE);await page.evaluate(url => {diff --git a/tests/page/page-add-init-script.spec.ts b/tests/page/page-add-init-script.spec.tsindex 0ef4294c40..be4469e6ed 100644--- a/tests/page/page-add-init-script.spec.ts+++ b/tests/page/page-add-init-script.spec.ts@@ -84,7 +84,7 @@ it('should work after a cross origin navigation', async ({ page, server }) => {expect(await page.evaluate(() => window['result'])).toBe(123);});-it('init script should run only once in iframe', async ({ page, server, browserName, channel }) => {+it('init script should run only once in iframe', async ({ page, server, browserName, isBidi }) => {it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/26992' });const messages = [];page.on('console', event => {@@ -95,6 +95,6 @@ it('init script should run only once in iframe', async ({ page, server, browserNawait page.goto(server.PREFIX + '/frames/one-frame.html');expect(messages).toEqual(['init script: /frames/one-frame.html',- 'init script: ' + (browserName === 'firefox' && !channel?.startsWith('moz-firefox') ? 'no url yet' : '/frames/frame.html'),+ 'init script: ' + (browserName === 'firefox' && !isBidi ? 'no url yet' : '/frames/frame.html'),]);});diff --git a/tests/page/page-basic.spec.ts b/tests/page/page-basic.spec.tsindex f191ed3bce..e8d9bc5a8e 100644--- a/tests/page/page-basic.spec.ts+++ b/tests/page/page-basic.spec.ts@@ -94,9 +94,8 @@ it('page.close should work with window.close', async function({ page }) {await closedPromise;});-it('page.frame should respect name', async function({ page, browserName, channel }) {- it.skip(browserName === 'firefox' && channel?.startsWith('moz-firefox'), 'page.frame({ name }) is racy with BiDi');- it.skip(channel?.startsWith('bidi-chrom'), 'page.frame({ name }) is racy with BiDi');+it('page.frame should respect name', async function({ page, isBidi }) {+ it.skip(isBidi, 'page.frame({ name }) is racy with BiDi');await page.setContent(`<iframe name=target></iframe>`);expect(page.frame({ name: 'bogus' })).toBe(null);@@ -111,7 +110,7 @@ it('page.frame should respect url', async function({ page, server }) {expect(page.frame({ url: /empty/ }).url()).toBe(server.EMPTY_PAGE);});-it('should have sane user agent', async ({ page, browserName, isElectron, isAndroid, channel }) => {+it('should have sane user agent', async ({ page, browserName, isElectron, isAndroid }) => {it.skip(isAndroid);it.skip(isElectron);diff --git a/tests/page/page-event-console.spec.ts b/tests/page/page-event-console.spec.tsindex 0165017a9f..9b12ab0b34 100644--- a/tests/page/page-event-console.spec.ts+++ b/tests/page/page-event-console.spec.ts@@ -191,13 +191,13 @@ it('should use object previews for arrays and objects', async ({ page, browserNaexpect(text).toEqual('Array JSHandle@object JSHandle@object');});-it('should use object previews for errors', async ({ page, browserName, channel }) => {+it('should use object previews for errors', async ({ page, browserName, isBidi }) => {let text: string;page.on('console', message => {text = message.text();});await page.evaluate(() => console.log(new Error('Exception')));- if (channel?.startsWith('bidi-chrom') || browserName === 'firefox')+ if (isBidi || browserName === 'firefox')expect(text).toEqual('Error');else if (browserName === 'chromium')expect(text).toContain('.evaluate');diff --git a/tests/page/page-event-load.spec.ts b/tests/page/page-event-load.spec.tsindex 6bb0902dfc..2483274d50 100644--- a/tests/page/page-event-load.spec.ts+++ b/tests/page/page-event-load.spec.ts@@ -17,9 +17,9 @@import { test as it, expect } from './pageTest';-it('should fire once', async ({ page, server, browserName, channel }) => {+it('should fire once', async ({ page, server, browserName, isBidi }) => {it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/15086' });- it.fixme(browserName === 'firefox' && !channel?.startsWith('moz-firefox'), 'Firefox sometimes double fires.');+ it.fixme(browserName === 'firefox' && !isBidi, 'Firefox sometimes double fires.');let count = 0;page.on('load', () => count++);@@ -28,9 +28,9 @@ it('should fire once', async ({ page, server, browserName, channel }) => {expect(count).toBe(1);});-it('should fire once with iframe navigation', async ({ page, server, browserName, channel }) => {+it('should fire once with iframe navigation', async ({ page, server, browserName, isBidi }) => {it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/15086' });- it.fixme(browserName === 'firefox' && !channel?.startsWith('moz-firefox'), 'Firefox sometimes double fires.');+ it.fixme(browserName === 'firefox' && !isBidi, 'Firefox sometimes double fires.');let requestCount = 0;server.setRoute('/tracker', (_, res) => {diff --git a/tests/page/page-event-pageerror.spec.ts b/tests/page/page-event-pageerror.spec.tsindex 0a7a6a8888..2f31f554c3 100644--- a/tests/page/page-event-pageerror.spec.ts+++ b/tests/page/page-event-pageerror.spec.ts@@ -17,7 +17,7 @@import { test as it, expect } from './pageTest';-it('should fire', async ({ page, server, browserName, channel }) => {+it('should fire', async ({ page, server, browserName, isBidi }) => {const url = server.PREFIX + '/error.html';const [error] = await Promise.all([page.waitForEvent('pageerror'),@@ -25,7 +25,7 @@ it('should fire', async ({ page, server, browserName, channel }) => {]);expect(error.name).toBe('Error');expect(error.message).toBe('Fancy error!');- if (browserName === 'chromium' || channel?.startsWith('moz-firefox')) {+ if (browserName === 'chromium' || (browserName === 'firefox' && isBidi)) {expect(error.stack).toBe(`Error: Fancy error!at c (myscript.js:14:11)at b (myscript.js:10:5)@@ -46,7 +46,7 @@ it('should fire', async ({ page, server, browserName, channel }) => {}});-it('should not receive console message for pageError', async ({ page, server, browserName }) => {+it('should not receive console message for pageError', async ({ page, server }) => {const messages = [];page.on('console', e => messages.push(e));await Promise.all([diff --git a/tests/page/page-fill.spec.ts b/tests/page/page-fill.spec.tsindex 24208962d8..cb37f3e6e1 100644--- a/tests/page/page-fill.spec.ts+++ b/tests/page/page-fill.spec.ts@@ -201,8 +201,8 @@ it('should fill contenteditable', async ({ page, server }) => {expect(await page.$eval('div[contenteditable]', div => div.textContent)).toBe('some value');});-it('should fill contenteditable with new lines', async ({ page, server, browserName, channel }) => {- it.fixme(browserName === 'firefox' && !channel?.startsWith('moz-firefox'), 'Firefox does not handle new lines in contenteditable');+it('should fill contenteditable with new lines', async ({ page, server, browserName, isBidi }) => {+ it.fixme(browserName === 'firefox' && !isBidi, 'Firefox does not handle new lines in contenteditable');await page.goto(server.EMPTY_PAGE);await page.setContent(`<div contenteditable="true"></div>`);diff --git a/tests/page/page-focus.spec.ts b/tests/page/page-focus.spec.tsindex e67fffab90..b7212539e1 100644--- a/tests/page/page-focus.spec.ts+++ b/tests/page/page-focus.spec.ts@@ -16,8 +16,8 @@import { test as it, expect } from './pageTest';-it('should work @smoke', async function({ page, browserName, channel }) {- it.skip(browserName === 'firefox' && !channel?.startsWith('moz-firefox'));+it('should work @smoke', async function({ page, browserName, isBidi }) {+ it.skip(browserName === 'firefox' && !isBidi);await page.setContent(`<div id=d1 tabIndex=0></div>`);expect(await page.evaluate(() => document.activeElement.nodeName)).toBe('BODY');diff --git a/tests/page/page-goto.spec.ts b/tests/page/page-goto.spec.tsindex ae7376385e..3e7dffaa1c 100644--- a/tests/page/page-goto.spec.ts+++ b/tests/page/page-goto.spec.ts@@ -307,12 +307,12 @@ it('should work when page calls history API in beforeunload', async ({ page, serexpect(response.status()).toBe(200);});-it('should fail when navigating to bad url', async ({ page, browserName, channel }) => {+it('should fail when navigating to bad url', async ({ page, browserName, isBidi }) => {let error = null;await page.goto('asdfasdf').catch(e => error = e);- if (channel?.startsWith('bidi-chrom'))+ if (browserName === 'chromium' && isBidi)expect(error.message).toContain('Invalid URL');- else if (channel?.startsWith('moz-firefox'))+ else if (browserName === 'firefox' && isBidi)expect(error.message).toContain('NS_ERROR_MALFORMED_URI');else if (browserName === 'chromium' || browserName === 'webkit')expect(error.message).toContain('Cannot navigate to invalid URL');@@ -468,7 +468,7 @@ it('should disable timeout when its set to 0', async ({ page, server }) => {expect(loaded).toBe(true);});-it('should fail when replaced by another navigation', async ({ page, server, browserName, channel }) => {+it('should fail when replaced by another navigation', async ({ page, server, browserName, isBidi }) => {let anotherPromise;server.setRoute('/empty.html', (req, res) => {anotherPromise = page.goto(server.PREFIX + '/one-style.html');@@ -481,7 +481,7 @@ it('should fail when replaced by another navigation', async ({ page, server, bro} else if (browserName === 'webkit') {expect(error.message).toContain(`page.goto: Navigation to "${server.PREFIX + '/empty.html'}" is interrupted by another navigation to "${server.PREFIX + '/one-style.html'}"`);} else if (browserName === 'firefox') {- if (channel?.startsWith('moz-firefox'))+ if (isBidi)expect(error.message).toContain('page.goto: Protocol error (browsingContext.navigate): unknown error');else// Firefox might yield either NS_BINDING_ABORTED or 'navigation interrupted by another one'@@ -812,8 +812,8 @@ it('should properly wait for load', async ({ page, server, browserName }) => {]);});-it('should not resolve goto upon window.stop()', async ({ browserName, page, server, channel }) => {- it.fixme(browserName === 'firefox' && !channel?.startsWith('moz-firefox'), 'load/domcontentloaded events are flaky');+it('should not resolve goto upon window.stop()', async ({ browserName, page, server, isBidi }) => {+ it.fixme(browserName === 'firefox' && !isBidi, 'load/domcontentloaded events are flaky');it.skip(process.env.PW_CLOCK === 'frozen');let response;diff --git a/tests/page/page-network-request.spec.ts b/tests/page/page-network-request.spec.tsindex 480a60afe2..b6c4d1d054 100644--- a/tests/page/page-network-request.spec.ts+++ b/tests/page/page-network-request.spec.ts@@ -498,10 +498,10 @@ it('should not allow to access frame on popup main request', async ({ page, servawait clicked;});-it('page.reload return 304 status code', async ({ page, server, browserName, channel }) => {+it('page.reload return 304 status code', async ({ page, server, browserName, isBidi }) => {it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/28779' });it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/29441' });- it.fixme(browserName === 'firefox' && !channel?.startsWith('moz-firefox'), 'Does not send second request');+ it.fixme(browserName === 'firefox' && !isBidi, 'Does not send second request');let requestNumber = 0;server.setRoute('/test.html', (req, res) => {++requestNumber;diff --git a/tests/page/page-route.spec.ts b/tests/page/page-route.spec.tsindex db0b494904..b601fc95fd 100644--- a/tests/page/page-route.spec.ts+++ b/tests/page/page-route.spec.ts@@ -344,14 +344,14 @@ it('should send referer', async ({ page, server }) => {expect(request.headers['referer']).toBe('http://google.com/');});-it('should fail navigation when aborting main resource', async ({ page, server, browserName, isMac, macVersion, channel }) => {+it('should fail navigation when aborting main resource', async ({ page, server, browserName, isMac, macVersion, isBidi }) => {await page.route('**/*', route => route.abort());let error = null;await page.goto(server.EMPTY_PAGE).catch(e => error = e);expect(error).toBeTruthy();if (browserName === 'webkit')expect(error.message).toContain(isMac && macVersion < 11 ? 'Request intercepted' : 'Blocked by Web Inspector');- else if (channel?.startsWith('moz-firefox'))+ else if (browserName === 'firefox' && isBidi)expect(error.message).toContain('NS_ERROR_ABORT');else if (browserName === 'firefox')expect(error.message).toContain('NS_ERROR_FAILURE');diff --git a/tests/page/page-screenshot.spec.ts b/tests/page/page-screenshot.spec.tsindex ff3092aabf..d7f010f9a6 100644--- a/tests/page/page-screenshot.spec.ts+++ b/tests/page/page-screenshot.spec.ts@@ -240,8 +240,8 @@ it.describe('page screenshot', () => {await verifyViewport(page, 500, 500);});- it('should allow transparency', async ({ page, browserName, channel }) => {- it.fail(browserName === 'firefox' || channel?.startsWith('bidi-chrom'));+ it('should allow transparency', async ({ page, browserName, isBidi }) => {+ it.fail(browserName === 'firefox' || isBidi);await page.setViewportSize({ width: 300, height: 300 });await page.setContent(`diff --git a/tests/page/page-wait-for-response.spec.ts b/tests/page/page-wait-for-response.spec.tsindex 162f4e5292..c6e0bd3296 100644--- a/tests/page/page-wait-for-response.spec.ts+++ b/tests/page/page-wait-for-response.spec.ts@@ -117,9 +117,9 @@ it('should work with no timeout', async ({ page, server }) => {expect(response.url()).toBe(server.PREFIX + '/digits/2.png');});-it('should work with re-rendered cached IMG elements', async ({ page, server, browserName, channel }) => {+it('should work with re-rendered cached IMG elements', async ({ page, server, browserName, isBidi }) => {it.fixme(browserName === 'webkit');- it.fixme(browserName === 'firefox' && !channel?.startsWith('moz-firefox'));+ it.fixme(browserName === 'firefox' && !isBidi);await page.goto(server.EMPTY_PAGE);await page.setContent(`<img src="pptr.png">`);await page.$eval('img', img => img.remove());diff --git a/tests/page/pageTestApi.ts b/tests/page/pageTestApi.tsindex de9ee1b23b..367778f364 100644--- a/tests/page/pageTestApi.ts+++ b/tests/page/pageTestApi.ts@@ -33,6 +33,7 @@ export type PageWorkerFixtures = {browserVersion: string;browserMajorVersion: number;electronMajorVersion: number;+ isBidi: boolean;isAndroid: boolean;isElectron: boolean;isHeadlessShell: boolean;