diff --git a/test/browsercontext-cookies.spec.ts b/test/browsercontext-cookies.spec.ts index 5daf4f49b0..6a9af49348 100644 --- a/test/browsercontext-cookies.spec.ts +++ b/test/browsercontext-cookies.spec.ts @@ -74,7 +74,7 @@ it('should properly report httpOnly cookie', async ({context, page, server}) => }); it('should properly report "Strict" sameSite cookie', (test, parameters) => { - test.fail(options.WEBKIT(parameters) && WIN); + test.fail(options.WEBKIT(parameters) && options.WIN(parameters)); }, async ({context, page, server}) => { server.setRoute('/empty.html', (req, res) => { res.setHeader('Set-Cookie', 'name=value;SameSite=Strict'); @@ -87,7 +87,7 @@ it('should properly report "Strict" sameSite cookie', (test, parameters) => { }); it('should properly report "Lax" sameSite cookie', (test, parameters) => { - test.fail(options.WEBKIT(parameters) && WIN); + test.fail(options.WEBKIT(parameters) && options.WIN(parameters)); }, async ({context, page, server}) => { server.setRoute('/empty.html', (req, res) => { res.setHeader('Set-Cookie', 'name=value;SameSite=Lax'); diff --git a/test/browsercontext-page-event.spec.ts b/test/browsercontext-page-event.spec.ts index edf4fd13e6..0ba24c8a72 100644 --- a/test/browsercontext-page-event.spec.ts +++ b/test/browsercontext-page-event.spec.ts @@ -175,14 +175,14 @@ it('should work with Shift-clicking', (test, parameters) => { it('should work with Ctrl-clicking', (test, parameters) => { test.fixme(options.WEBKIT(parameters), 'Ctrl+Click does not open a new tab.'); test.fixme(options.FIREFOX(parameters), 'Reports an opener in this case.'); -}, async ({browser, server}) => { +}, async ({browser, server, isMac}) => { const context = await browser.newContext(); const page = await context.newPage(); await page.goto(server.EMPTY_PAGE); await page.setContent('yo'); const [popup] = await Promise.all([ context.waitForEvent('page'), - page.click('a', { modifiers: [ MAC ? 'Meta' : 'Control'] }), + page.click('a', { modifiers: [ isMac ? 'Meta' : 'Control'] }), ]); expect(await popup.opener()).toBe(null); await context.close(); diff --git a/test/capabilities.spec.ts b/test/capabilities.spec.ts index c97d1e70af..1271ef5850 100644 --- a/test/capabilities.spec.ts +++ b/test/capabilities.spec.ts @@ -18,7 +18,7 @@ import url from 'url'; import { it, expect, options } from './playwright.fixtures'; it('Web Assembly should work', (test, parameters) => { - test.fail(options.WEBKIT(parameters) && WIN); + test.fail(options.WEBKIT(parameters) && options.WIN(parameters)); }, async function({page, server}) { await page.goto(server.PREFIX + '/wasm/table2.html'); expect(await page.evaluate('loadTable()')).toBe('42, 83'); @@ -51,7 +51,7 @@ it('should respect CSP', async ({page, server}) => { }); it('should play video', (test, parameters) => { - test.fixme(options.WEBKIT(parameters) && (WIN || LINUX)); + test.fixme(options.WEBKIT(parameters) && (options.WIN(parameters) || options.LINUX(parameters))); }, async ({page, asset, isWebKit}) => { // TODO: the test passes on Windows locally but fails on GitHub Action bot, // apparently due to a Media Pack issue in the Windows Server. diff --git a/test/chromium/launcher.spec.ts b/test/chromium/launcher.spec.ts index b8c9455a78..1e55925c34 100644 --- a/test/chromium/launcher.spec.ts +++ b/test/chromium/launcher.spec.ts @@ -39,7 +39,7 @@ it('should not throw with remote-debugging-port argument', (test, parameters) => }); it('should open devtools when "devtools: true" option is given', (test, parameters) => { - test.skip(!options.CHROMIUM(parameters) || options.WIRE || WIN); + test.skip(!options.CHROMIUM(parameters) || options.WIRE || options.WIN(parameters)); }, async ({browserType, defaultBrowserOptions}) => { let devtoolsCallback; const devtoolsPromise = new Promise(f => devtoolsCallback = f); diff --git a/test/defaultbrowsercontext-2.spec.ts b/test/defaultbrowsercontext-2.spec.ts index 6c0cfa0408..8005e1fe37 100644 --- a/test/defaultbrowsercontext-2.spec.ts +++ b/test/defaultbrowsercontext-2.spec.ts @@ -69,7 +69,7 @@ it('should support ignoreHTTPSErrors option', async ({httpsServer, launchPersist }); it('should support extraHTTPHeaders option', (test, parameters) => { - test.flaky(options.FIREFOX(parameters) && !options.HEADLESS && LINUX, 'Intermittent timeout on bots'); + test.flaky(options.FIREFOX(parameters) && !options.HEADLESS && options.LINUX(parameters), 'Intermittent timeout on bots'); }, async ({server, launchPersistent}) => { const {page} = await launchPersistent({extraHTTPHeaders: { foo: 'bar' }}); const [request] = await Promise.all([ diff --git a/test/dialog.spec.ts b/test/dialog.spec.ts index c773cf1fec..7e064e8477 100644 --- a/test/dialog.spec.ts +++ b/test/dialog.spec.ts @@ -63,7 +63,7 @@ it('should dismiss the confirm prompt', async ({page}) => { }); it('should be able to close context with open alert', (test, parameters) => { - test.fixme(options.WEBKIT(parameters) && MAC); + test.fixme(options.WEBKIT(parameters) && options.MAC(parameters)); }, async ({browser}) => { const context = await browser.newContext(); const page = await context.newPage(); diff --git a/test/elementhandle-owner-frame.spec.ts b/test/elementhandle-owner-frame.spec.ts index d7389a2210..f07f3ffd05 100644 --- a/test/elementhandle-owner-frame.spec.ts +++ b/test/elementhandle-owner-frame.spec.ts @@ -35,7 +35,7 @@ it('should work for cross-process iframes', async ({ page, server }) => { }); it('should work for document', (test, parameters) => { - test.flaky(WIN && options.WEBKIT(parameters)); + test.flaky(options.WIN(parameters) && options.WEBKIT(parameters)); }, async ({ page, server }) => { await page.goto(server.EMPTY_PAGE); await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE); diff --git a/test/elementhandle-screenshot.spec.ts b/test/elementhandle-screenshot.spec.ts index 2c44bc2b22..f29324c22a 100644 --- a/test/elementhandle-screenshot.spec.ts +++ b/test/elementhandle-screenshot.spec.ts @@ -363,7 +363,7 @@ describe('element screenshot', (suite, parameters) => { }); it('should wait for element to stop moving', (test, parameters) => { - test.flaky(options.WEBKIT(parameters) && !options.HEADLESS && LINUX); + test.flaky(options.WEBKIT(parameters) && !options.HEADLESS && options.LINUX(parameters)); }, async ({ page, server, golden }) => { await page.setViewportSize({ width: 500, height: 500 }); await page.goto(server.PREFIX + '/grid.html'); diff --git a/test/elementhandle-wait-for-element-state.spec.ts b/test/elementhandle-wait-for-element-state.spec.ts index 1011fdb1ee..d7259e6201 100644 --- a/test/elementhandle-wait-for-element-state.spec.ts +++ b/test/elementhandle-wait-for-element-state.spec.ts @@ -115,7 +115,7 @@ it('should wait for disabled button', async ({page}) => { }); it('should wait for stable position', (test, parameters) => { - test.fixme(options.FIREFOX(parameters) && LINUX); + test.fixme(options.FIREFOX(parameters) && options.LINUX(parameters)); }, async ({page, server}) => { await page.goto(server.PREFIX + '/input/button.html'); const button = await page.$('button'); diff --git a/test/fixtures.spec.ts b/test/fixtures.spec.ts index 745a355825..b61f27e294 100644 --- a/test/fixtures.spec.ts +++ b/test/fixtures.spec.ts @@ -45,20 +45,20 @@ defineTestFixture('stallingConnectedRemoteServer', async ({browserType, stalling await browser.close(); }); -it('should close the browser when the node process closes', (test, parameters) => { +it('should close the browser when the node process closes', test => { test.slow(); -}, async ({connectedRemoteServer}) => { - if (WIN) +}, async ({connectedRemoteServer, isWindows}) => { + if (isWindows) execSync(`taskkill /pid ${connectedRemoteServer.child().pid} /T /F`); else process.kill(connectedRemoteServer.child().pid); - expect(await connectedRemoteServer.childExitCode()).toBe(WIN ? 1 : 0); + expect(await connectedRemoteServer.childExitCode()).toBe(isWindows ? 1 : 0); // We might not get browser exitCode in time when killing the parent node process, // so we don't check it here. }); -describe('fixtures', suite => { - suite.skip(WIN || !options.HEADLESS); +describe('fixtures', (suite, parameters) => { + suite.skip(options.WIN(parameters) || !options.HEADLESS); suite.slow(); }, () => { // Cannot reliably send signals on Windows. diff --git a/test/focus.spec.ts b/test/focus.spec.ts index 8fc24f1998..5d8a232c58 100644 --- a/test/focus.spec.ts +++ b/test/focus.spec.ts @@ -79,7 +79,7 @@ it('should traverse focus in all directions', async function({page}) { }); it('should traverse only form elements', (test, parameters) => { - test.skip(!MAC || !options.WEBKIT(parameters), + test.skip(!options.MAC(parameters) || !options.WEBKIT(parameters), 'Chromium and WebKit both have settings for tab traversing all links, but it is only on by default in WebKit.'); }, async function({page}) { await page.setContent(` diff --git a/test/headful.spec.ts b/test/headful.spec.ts index 89355bdf0a..0180f28c13 100644 --- a/test/headful.spec.ts +++ b/test/headful.spec.ts @@ -27,7 +27,7 @@ it('should have default url when launching browser', async ({browserType, defaul }); it('headless should be able to read cookies written by headful', (test, parameters) => { - test.fail(WIN && options.CHROMIUM(parameters)); + test.fail(options.WIN(parameters) && options.CHROMIUM(parameters)); test.flaky(options.FIREFOX(parameters)); test.slow(); }, async ({browserType, defaultBrowserOptions, server}) => { diff --git a/test/keyboard.spec.ts b/test/keyboard.spec.ts index 25cfc2df78..cd537fa099 100644 --- a/test/keyboard.spec.ts +++ b/test/keyboard.spec.ts @@ -84,7 +84,7 @@ it('insertText should only emit input event', async ({page, server}) => { }); it('should report shiftKey', (test, parameters) => { - test.fail(options.FIREFOX(parameters) && MAC); + test.fail(options.FIREFOX(parameters) && options.MAC(parameters)); }, async ({page, server}) => { await page.goto(server.PREFIX + '/input/keyboard.html'); const keyboard = page.keyboard; @@ -312,11 +312,11 @@ it('should type emoji into an iframe', async ({page, server}) => { expect(await frame.$eval('textarea', textarea => textarea.value)).toBe('👹 Tokyo street Japan 🇯🇵'); }); -it('should handle selectAll', async ({page, server}) => { +it('should handle selectAll', async ({page, server, isMac}) => { await page.goto(server.PREFIX + '/input/textarea.html'); const textarea = await page.$('textarea'); await textarea.type('some text'); - const modifier = MAC ? 'Meta' : 'Control'; + const modifier = isMac ? 'Meta' : 'Control'; await page.keyboard.down(modifier); await page.keyboard.press('a'); await page.keyboard.up(modifier); @@ -324,7 +324,7 @@ it('should handle selectAll', async ({page, server}) => { expect(await page.$eval('textarea', textarea => textarea.value)).toBe(''); }); -it('should be able to prevent selectAll', async ({page, server}) => { +it('should be able to prevent selectAll', async ({page, server, isMac}) => { await page.goto(server.PREFIX + '/input/textarea.html'); const textarea = await page.$('textarea'); await textarea.type('some text'); @@ -334,7 +334,7 @@ it('should be able to prevent selectAll', async ({page, server}) => { event.preventDefault(); }, false); }); - const modifier = MAC ? 'Meta' : 'Control'; + const modifier = isMac ? 'Meta' : 'Control'; await page.keyboard.down(modifier); await page.keyboard.press('a'); await page.keyboard.up(modifier); @@ -343,7 +343,7 @@ it('should be able to prevent selectAll', async ({page, server}) => { }); it('should support MacOS shortcuts', (test, parameters) => { - test.skip(!MAC); + test.skip(!options.MAC(parameters)); }, async ({page, server}) => { await page.goto(server.PREFIX + '/input/textarea.html'); const textarea = await page.$('textarea'); @@ -354,11 +354,11 @@ it('should support MacOS shortcuts', (test, parameters) => { expect(await page.$eval('textarea', textarea => textarea.value)).toBe('some '); }); -it('should press the meta key', async ({page, isFirefox}) => { +it('should press the meta key', async ({page, isFirefox, isMac}) => { const lastEvent = await captureLastKeydown(page); await page.keyboard.press('Meta'); const {key, code, metaKey} = await lastEvent.jsonValue(); - if (isFirefox && !MAC) + if (isFirefox && !isMac) expect(key).toBe('OS'); else expect(key).toBe('Meta'); @@ -368,7 +368,7 @@ it('should press the meta key', async ({page, isFirefox}) => { else expect(code).toBe('MetaLeft'); - if (isFirefox && !MAC) + if (isFirefox && !isMac) expect(metaKey).toBe(false); else expect(metaKey).toBe(true); diff --git a/test/mouse.spec.ts b/test/mouse.spec.ts index 1af09d3b75..a221f58b41 100644 --- a/test/mouse.spec.ts +++ b/test/mouse.spec.ts @@ -28,7 +28,7 @@ function dimensions() { } it('should click the document', (test, parameters) => { - test.flaky(options.FIREFOX(parameters) && WIN, 'Occasionally times out on options.FIREFOX on Windows: https://github.com/microsoft/playwright/pull/1911/checks?check_run_id=607149016'); + test.flaky(options.FIREFOX(parameters) && options.WIN(parameters), 'Occasionally times out on options.FIREFOX on Windows: https://github.com/microsoft/playwright/pull/1911/checks?check_run_id=607149016'); }, async ({page, server}) => { await page.evaluate(() => { window['clickPromise'] = new Promise(resolve => { @@ -123,12 +123,12 @@ it('should trigger hover state with removed window.Node', async ({page, server}) expect(await page.evaluate(() => document.querySelector('button:hover').id)).toBe('button-6'); }); -it('should set modifier keys on click', async ({page, server, isFirefox}) => { +it('should set modifier keys on click', async ({page, server, isFirefox, isMac}) => { await page.goto(server.PREFIX + '/input/scrollable.html'); await page.evaluate(() => document.querySelector('#button-3').addEventListener('mousedown', e => window['lastEvent'] = e, true)); const modifiers = {'Shift': 'shiftKey', 'Control': 'ctrlKey', 'Alt': 'altKey', 'Meta': 'metaKey'}; // In Firefox, the Meta modifier only exists on Mac - if (isFirefox && !MAC) + if (isFirefox && !isMac) delete modifiers['Meta']; for (const modifier in modifiers) { await page.keyboard.down(modifier); diff --git a/test/network-request.spec.ts b/test/network-request.spec.ts index a2f9133ede..0f3068000c 100644 --- a/test/network-request.spec.ts +++ b/test/network-request.spec.ts @@ -56,7 +56,7 @@ it('should return headers', async ({page, server, isChromium, isFirefox, isWebKi }); it('should get the same headers as the server', (test, parameters) => { - test.fail(options.CHROMIUM(parameters) || options.WEBKIT(parameters)); + test.fail(options.CHROMIUM(parameters) || options.WEBKIT(parameters), 'Provisional headers differ from those in network stack'); }, async ({page, server}) => { await page.goto(server.PREFIX + '/empty.html'); let serverRequest; diff --git a/test/page-event-crash.spec.ts b/test/page-event-crash.spec.ts index ebe42aeb3b..bb41b8b297 100644 --- a/test/page-event-crash.spec.ts +++ b/test/page-event-crash.spec.ts @@ -28,7 +28,7 @@ function crash(page, toImpl, browserName) { describe('', (suite, parameters) => { suite.fixme(options.WIRE); - suite.flaky(options.FIREFOX(parameters) && WIN); + suite.flaky(options.FIREFOX(parameters) && options.WIN(parameters)); }, () => { it('should emit crash event when page crashes', async ({page, browserName, toImpl}) => { await page.setContent(`