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: it.skip skips and it.fail expects to fail now (#1178)
Pavel Feldman5bd6e4970b53
diff --git a/test/accessibility.spec.js b/test/accessibility.spec.jsindex 902e8c06ff..b399b81a33 100644--- a/test/accessibility.spec.js+++ b/test/accessibility.spec.js@@ -85,7 +85,7 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT,};expect(await page.accessibility.snapshot()).toEqual(golden);});- it.skip(WEBKIT && !MAC)('should work with regular text', async({page}) => {+ it.fail(WEBKIT && !MAC)('should work with regular text', async({page}) => {await page.setContent(`<div>Hello World</div>`);const snapshot = await page.accessibility.snapshot();expect(snapshot.children[0]).toEqual({diff --git a/test/capabilities.spec.js b/test/capabilities.spec.jsindex 09bb059613..e4cd4169f4 100644--- a/test/capabilities.spec.js+++ b/test/capabilities.spec.js@@ -26,7 +26,7 @@ module.exports.describe = function({testRunner, expect, WIN, WEBKIT}) {const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;describe('Capabilities', function() {- it.skip(WEBKIT && WIN)('Web Assembly should work', async function({page, server}) {+ it.fail(WEBKIT && WIN)('Web Assembly should work', async function({page, server}) {await page.goto(server.PREFIX + '/wasm/table2.html');expect(await page.evaluate(() => loadTable())).toBe('42, 83');});diff --git a/test/chromium/pdf.spec.js b/test/chromium/pdf.spec.jsindex 64df44a300..6ffde1d5f2 100644--- a/test/chromium/pdf.spec.js+++ b/test/chromium/pdf.spec.js@@ -26,7 +26,7 @@ module.exports.describe = function({testRunner, expect, headless, ASSETS_DIR}) {const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;// Printing to pdf is currently only supported in headless- describe.skip(!headless)('Page.pdf', function() {+ describe.fail(!headless)('Page.pdf', function() {it('should be able to save file', async({page, server}) => {const outputFile = path.join(ASSETS_DIR, 'output.pdf');await page.pdf({path: outputFile});diff --git a/test/click.spec.js b/test/click.spec.jsindex fbdaf3de18..8b249d7beb 100644--- a/test/click.spec.js+++ b/test/click.spec.js@@ -326,7 +326,7 @@ module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMIexpect(await page.evaluate(() => offsetX)).toBe(WEBKIT ? 12 * 2 + 20 : 20);expect(await page.evaluate(() => offsetY)).toBe(WEBKIT ? 12 * 2 + 10 : 10);});- it.skip(FFOX)('should click a very large button with offset', async({page, server}) => {+ it.fail(FFOX)('should click a very large button with offset', async({page, server}) => {await page.goto(server.PREFIX + '/input/button.html');await page.$eval('button', button => button.style.borderWidth = '8px');await page.$eval('button', button => button.style.height = button.style.width = '2000px');@@ -336,7 +336,7 @@ module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMIexpect(await page.evaluate(() => offsetX)).toBe(WEBKIT ? 1900 + 8 : 1900);expect(await page.evaluate(() => offsetY)).toBe(WEBKIT ? 1910 + 8 : 1910);});- it.skip(FFOX)('should click a button in scrolling container with offset', async({page, server}) => {+ it.fail(FFOX)('should click a button in scrolling container with offset', async({page, server}) => {await page.goto(server.PREFIX + '/input/button.html');await page.$eval('button', button => {const container = document.createElement('div');diff --git a/test/cookies.spec.js b/test/cookies.spec.jsindex 2195ee8d5a..1cdccdcb1f 100644--- a/test/cookies.spec.js+++ b/test/cookies.spec.js@@ -54,7 +54,7 @@ module.exports.describe = function({testRunner, expect, playwright, defaultBrowsexpect(cookies.length).toBe(1);expect(cookies[0].httpOnly).toBe(true);});- it.skip(WEBKIT && !MAC)('should properly report "Strict" sameSite cookie', async({context, page, server}) => {+ it.fail(WEBKIT && !MAC)('should properly report "Strict" sameSite cookie', async({context, page, server}) => {server.setRoute('/empty.html', (req, res) => {res.setHeader('Set-Cookie', 'name=value;SameSite=Strict');res.end();@@ -64,7 +64,7 @@ module.exports.describe = function({testRunner, expect, playwright, defaultBrowsexpect(cookies.length).toBe(1);expect(cookies[0].sameSite).toBe('Strict');});- it.skip(WEBKIT && !MAC)('should properly report "Lax" sameSite cookie', async({context, page, server}) => {+ it.fail(WEBKIT && !MAC)('should properly report "Lax" sameSite cookie', async({context, page, server}) => {server.setRoute('/empty.html', (req, res) => {res.setHeader('Set-Cookie', 'name=value;SameSite=Lax');res.end();diff --git a/test/elementhandle.spec.js b/test/elementhandle.spec.jsindex 885fa30398..ad23d0fa79 100644--- a/test/elementhandle.spec.js+++ b/test/elementhandle.spec.js@@ -299,7 +299,7 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT})});describe('ElementHandle.scrollIntoViewIfNeeded', function() {- it.skip(FFOX)('should work', async({page, server}) => {+ it.fail(FFOX)('should work', async({page, server}) => {await page.goto(server.PREFIX + '/offscreenbuttons.html');for (let i = 0; i < 11; ++i) {const button = await page.$('#btn' + i);diff --git a/test/emulation.spec.js b/test/emulation.spec.jsindex 4f49193075..9ed3d6d898 100644--- a/test/emulation.spec.js+++ b/test/emulation.spec.js@@ -89,7 +89,7 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FFexpect(await page.evaluate(() => Modernizr.touchevents)).toBe(true);await context.close();});- it.skip(FFOX)('should support landscape emulation', async({browser, server}) => {+ it.fail(FFOX)('should support landscape emulation', async({browser, server}) => {const context1 = await browser.newContext({ viewport: iPhone.viewport });const page1 = await context1.newPage();await page1.goto(server.PREFIX + '/mobile.html');@@ -100,7 +100,7 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FFawait context1.close();await context2.close();});- it.skip(FFOX || WEBKIT)('should fire orientationchange event', async({browser, server}) => {+ it.fail(FFOX || WEBKIT)('should fire orientationchange event', async({browser, server}) => {const context = await browser.newContext({ viewport: { width: 300, height: 400, isMobile: true } });const page = await context.newPage();await page.goto(server.PREFIX + '/mobile.html');@@ -118,14 +118,14 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FFexpect((await event2).text()).toBe('2');await context.close();});- it.skip(FFOX)('default mobile viewports to 980 width', async({browser, server}) => {+ it.fail(FFOX)('default mobile viewports to 980 width', async({browser, server}) => {const context = await browser.newContext({ viewport: {width: 320, height: 480, isMobile: true} });const page = await context.newPage();await page.goto(server.PREFIX + '/empty.html');expect(await page.evaluate(() => window.innerWidth)).toBe(980);await context.close();});- it.skip(FFOX)('respect meta viewport tag', async({browser, server}) => {+ it.fail(FFOX)('respect meta viewport tag', async({browser, server}) => {const context = await browser.newContext({ viewport: {width: 320, height: 480, isMobile: true} });const page = await context.newPage();await page.goto(server.PREFIX + '/mobile.html');@@ -199,7 +199,7 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FFawait page.emulateMedia({ colorScheme: 'bad' }).catch(e => error = e);expect(error.message).toBe('Unsupported color scheme: bad');});- it.skip(FFOX)('should work during navigation', async({page, server}) => {+ it.fail(FFOX)('should work during navigation', async({page, server}) => {await page.emulateMedia({ colorScheme: 'light' });const navigated = page.goto(server.EMPTY_PAGE);for (let i = 0; i < 9; i++) {@@ -213,7 +213,7 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FF});});- describe.skip(FFOX)('BrowserContext({timezoneId})', function() {+ describe.fail(FFOX)('BrowserContext({timezoneId})', function() {it('should work', async ({ browser }) => {const func = () => new Date(1479579154987).toString();{@@ -253,7 +253,7 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FF});});- describe.skip(FFOX)('BrowserContext({locale})', function() {+ describe.fail(FFOX)('BrowserContext({locale})', function() {it('should affect accept-language header', async({browser, server}) => {const context = await browser.newContext({ locale: 'fr-CH' });const page = await context.newPage();@@ -307,7 +307,7 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FF});describe('focus', function() {- it.skip(!headless)('should think that it is focused by default', async({page}) => {+ it.fail(!headless)('should think that it is focused by default', async({page}) => {expect(await page.evaluate('document.hasFocus()')).toBe(true);});});diff --git a/test/evaluation.spec.js b/test/evaluation.spec.jsindex 22766d14cc..154fcaad1e 100644--- a/test/evaluation.spec.js+++ b/test/evaluation.spec.js@@ -259,7 +259,7 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT})expect(result).toEqual([42]);});// Works in WebKit, but slow- it.skip(FFOX)('should transfer 100Mb of data from page to node.js', async({page, server}) => {+ it.fail(FFOX)('should transfer 100Mb of data from page to node.js', async({page, server}) => {const a = await page.evaluate(() => Array(100 * 1024 * 1024 + 1).join('a'));expect(a.length).toBe(100 * 1024 * 1024);});@@ -425,7 +425,7 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT})const error = await page.evaluate(body => body.innerHTML, bodyHandle).catch(e => e);expect(error.message).toContain('Unable to adopt element handle from a different document');});- it.skip(FFOX)('should return non-empty Node.constructor.name in utility context', async({page,server}) => {+ it.fail(FFOX)('should return non-empty Node.constructor.name in utility context', async({page,server}) => {await page.goto(server.EMPTY_PAGE);await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);const frame = page.frames()[1];diff --git a/test/features/permissions.spec.js b/test/features/permissions.spec.jsindex af38b1c09f..99e20172fe 100644--- a/test/features/permissions.spec.js+++ b/test/features/permissions.spec.js@@ -27,7 +27,7 @@ module.exports.describe = function({testRunner, expect, WEBKIT}) {const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;// Permissions API is not implemented in WebKit (see https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API)- describe.skip(WEBKIT)('Permissions', function() {+ describe.fail(WEBKIT)('Permissions', function() {function getPermission(page, name) {return page.evaluate(name => navigator.permissions.query({name}).then(result => result.state), name);}diff --git a/test/geolocation.spec.js b/test/geolocation.spec.jsindex 4cc0f67ac5..337cc51b94 100644--- a/test/geolocation.spec.js+++ b/test/geolocation.spec.js@@ -23,7 +23,7 @@ module.exports.describe = function ({ testRunner, expect, FFOX, WEBKIT }) {const {it, fit, xit, dit} = testRunner;const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;- describe.skip(FFOX)('Overrides.setGeolocation', function() {+ describe.fail(FFOX)('Overrides.setGeolocation', function() {it('should work', async({page, server, context}) => {await context.setPermissions(server.PREFIX, ['geolocation']);await page.goto(server.EMPTY_PAGE);diff --git a/test/headful.spec.js b/test/headful.spec.jsindex 90b0ac12d9..2a9a607c8a 100644--- a/test/headful.spec.js+++ b/test/headful.spec.js@@ -41,7 +41,7 @@ module.exports.describe = function({testRunner, expect, playwright, defaultBrowsawait removeUserDataDir(userDataDir);});// see https://github.com/microsoft/playwright/issues/717- it.skip((WIN && CHROMIUM) || FFOX)('headless should be able to read cookies written by headful', async({server}) => {+ it.fail((WIN && CHROMIUM) || FFOX)('headless should be able to read cookies written by headful', async({server}) => {const userDataDir = await makeUserDataDir();// Write a cookie in headful chromeconst headfulContext = await playwright.launchPersistent(userDataDir, headfulOptions);@@ -59,7 +59,7 @@ module.exports.describe = function({testRunner, expect, playwright, defaultBrowsawait removeUserDataDir(userDataDir);expect(cookie).toBe('foo=true');});- it.skip(FFOX)('should close browser with beforeunload page', async({server}) => {+ it.fail(FFOX)('should close browser with beforeunload page', async({server}) => {const userDataDir = await makeUserDataDir();const browserContext = await playwright.launchPersistent(userDataDir, headfulOptions);const page = await browserContext.newPage();diff --git a/test/interception.spec.js b/test/interception.spec.jsindex 035f84295d..837e1905dc 100644--- a/test/interception.spec.js+++ b/test/interception.spec.js@@ -524,7 +524,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p});});- describe.skip(FFOX)('Interception.setOfflineMode', function() {+ describe.fail(FFOX)('Interception.setOfflineMode', function() {it('should work', async({page, server}) => {await page.setOfflineMode(true);let error = null;diff --git a/test/keyboard.spec.js b/test/keyboard.spec.jsindex 806c7c89db..9d6ae15221 100644--- a/test/keyboard.spec.js+++ b/test/keyboard.spec.js@@ -78,7 +78,7 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT,await page.keyboard.sendCharacters('a');expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('嗨a');});- it.skip(FFOX)('should report shiftKey', async({page, server}) => {+ it.fail(FFOX)('should report shiftKey', async({page, server}) => {await page.goto(server.PREFIX + '/input/keyboard.html');const keyboard = page.keyboard;const codeForKey = {'Shift': 16, 'Alt': 18, 'Control': 17};@@ -241,7 +241,7 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT,await textarea.type('👹 Tokyo street Japan 🇯🇵');expect(await frame.$eval('textarea', textarea => textarea.value)).toBe('👹 Tokyo street Japan 🇯🇵');});- it.skip(CHROMIUM && MAC)('should handle selectAll', async({page, server}) => {+ it.fail(CHROMIUM && MAC)('should handle selectAll', async({page, server}) => {await page.goto(server.PREFIX + '/input/textarea.html');const textarea = await page.$('textarea');await textarea.type('some text');@@ -252,7 +252,7 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT,await page.keyboard.press('Backspace');expect(await page.$eval('textarea', textarea => textarea.value)).toBe('');});- it.skip(CHROMIUM && MAC)('should be able to prevent selectAll', async({page, server}) => {+ it.fail(CHROMIUM && MAC)('should be able to prevent selectAll', async({page, server}) => {await page.goto(server.PREFIX + '/input/textarea.html');const textarea = await page.$('textarea');await textarea.type('some text');diff --git a/test/launcher.spec.js b/test/launcher.spec.jsindex ac81ad3281..f91c2d2f2f 100644--- a/test/launcher.spec.js+++ b/test/launcher.spec.js@@ -283,7 +283,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p// This might throw. See https://github.com/GoogleChrome/puppeteer/issues/2778await removeUserDataDir(userDataDir);});- it.skip(FFOX)('userDataDir option should restore state', async({server}) => {+ it.fail(FFOX)('userDataDir option should restore state', async({server}) => {const userDataDir = await makeUserDataDir();const browserContext = await playwright.launchPersistent(userDataDir, defaultBrowserOptions);const page = await browserContext.newPage();@@ -309,7 +309,7 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, pawait removeUserDataDir(userDataDir2);});// See https://github.com/microsoft/playwright/issues/717- it.skip(FFOX || (WIN && CHROMIUM))('userDataDir option should restore cookies', async({server}) => {+ it.fail(FFOX || (WIN && CHROMIUM))('userDataDir option should restore cookies', async({server}) => {const userDataDir = await makeUserDataDir();const browserContext = await playwright.launchPersistent(userDataDir, defaultBrowserOptions);const page = await browserContext.newPage();diff --git a/test/network.spec.js b/test/network.spec.jsindex 17a339e2c3..080eac72ce 100644--- a/test/network.spec.js+++ b/test/network.spec.js@@ -231,7 +231,7 @@ module.exports.describe = function({testRunner, expect, MAC, WIN, FFOX, CHROMIUMexpect(responses[0].request()).toBeTruthy();});- it.skip(FFOX)('Page.Events.RequestFailed', async({page, server}) => {+ it.fail(FFOX)('Page.Events.RequestFailed', async({page, server}) => {server.setRoute('/one-style.css', (req, res) => {req.socket.write('deadbeef');req.socket.end();diff --git a/test/page.spec.js b/test/page.spec.jsindex 1e4bce6058..bc359adc23 100644--- a/test/page.spec.js+++ b/test/page.spec.js@@ -667,7 +667,7 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF});// Firefox fires onload for blocked script before it issues the CSP console error.- it.skip(FFOX)('should throw when added with content to the CSP page', async({page, server}) => {+ it.fail(FFOX)('should throw when added with content to the CSP page', async({page, server}) => {await page.goto(server.PREFIX + '/csp.html');let error = null;await page.addScriptTag({ content: 'window.__injected = 35;' }).catch(e => error = e);diff --git a/test/popup.spec.js b/test/popup.spec.jsindex cf58b6fec7..9163e8d5fa 100644--- a/test/popup.spec.js+++ b/test/popup.spec.js@@ -20,7 +20,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WEconst {beforeAll, beforeEach, afterAll, afterEach} = testRunner;describe('window.open', function() {- it.skip(CHROMIUM)('should inherit user agent from browser context', async function({browser, server}) {+ it.fail(CHROMIUM)('should inherit user agent from browser context', async function({browser, server}) {const context = await browser.newContext({userAgent: 'hey'});@@ -36,7 +36,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WEexpect(userAgent).toBe('hey');expect(request.headers['user-agent']).toBe('hey');});- it.skip(CHROMIUM)('should inherit extra headers from browser context', async function({browser, server}) {+ it.fail(CHROMIUM)('should inherit extra headers from browser context', async function({browser, server}) {const context = await browser.newContext({extraHTTPHeaders: { 'foo': 'bar' },});@@ -48,7 +48,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WEawait context.close();expect(request.headers['foo']).toBe('bar');});- it.skip(CHROMIUM)('should inherit touch support from browser context', async function({browser, server}) {+ it.fail(CHROMIUM)('should inherit touch support from browser context', async function({browser, server}) {const context = await browser.newContext({viewport: { width: 400, height: 500, isMobile: true }});@@ -61,7 +61,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WEawait context.close();expect(hasTouch).toBe(true);});- it.skip(CHROMIUM)('should inherit viewport size from browser context', async function({browser, server}) {+ it.fail(CHROMIUM)('should inherit viewport size from browser context', async function({browser, server}) {const context = await browser.newContext({viewport: { width: 400, height: 500 }});@@ -74,7 +74,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WEawait context.close();expect(size).toEqual({width: 400, height: 500});});- it.skip(CHROMIUM)('should apply addInitScript from browser context', async function({browser, server}) {+ it.fail(CHROMIUM)('should apply addInitScript from browser context', async function({browser, server}) {const context = await browser.newContext();await context.addInitScript(() => window.injected = 123);const page = await context.newPage();@@ -100,7 +100,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WEexpect(await popup.evaluate(() => !!window.opener)).toBe(true);await context.close();});- it.skip(CHROMIUM)('should work with empty url', async({browser}) => {+ it.fail(CHROMIUM)('should work with empty url', async({browser}) => {const context = await browser.newContext();const page = await context.newPage();const [popup] = await Promise.all([diff --git a/test/screenshot.spec.js b/test/screenshot.spec.jsindex c14333e9fe..68a11450ea 100644--- a/test/screenshot.spec.js+++ b/test/screenshot.spec.js@@ -117,7 +117,7 @@ module.exports.describe = function({testRunner, expect, product, FFOX, CHROMIUM,expect(screenshots[i]).toBeGolden(`grid-cell-${i}.png`);await Promise.all(pages.map(page => page.close()));});- it.skip(FFOX)('should allow transparency', async({page, server}) => {+ it.fail(FFOX)('should allow transparency', async({page, server}) => {await page.setViewportSize({ width: 50, height: 150 });await page.setContent(`<style>@@ -156,7 +156,7 @@ module.exports.describe = function({testRunner, expect, product, FFOX, CHROMIUM,});expect(Buffer.from(screenshot, 'base64')).toBeGolden('screenshot-sanity.png');});- it.skip(FFOX)('should work with a mobile viewport', async({browser, server}) => {+ it.fail(FFOX)('should work with a mobile viewport', async({browser, server}) => {const context = await browser.newContext({viewport: { width: 320, height: 480, isMobile: true }});const page = await context.newPage();await page.goto(server.PREFIX + '/overflow.html');@@ -176,7 +176,7 @@ module.exports.describe = function({testRunner, expect, product, FFOX, CHROMIUM,const screenshot = await page.screenshot();expect(screenshot).toBeGolden('screenshot-translateZ.png');});- it.skip(FFOX || WEBKIT)('should work for webgl', async({page, server}) => {+ it.fail(FFOX || WEBKIT)('should work for webgl', async({page, server}) => {await page.setViewportSize({width: 640, height: 480});await page.goto(server.PREFIX + '/screenshots/webgl.html');const screenshot = await page.screenshot();diff --git a/test/types.d.ts b/test/types.d.tsindex 248bb9abb4..213c2ccaaa 100644--- a/test/types.d.ts+++ b/test/types.d.ts@@ -22,9 +22,9 @@ interface Expect<T> {not: Expect<T>;}-type DescribeFunction = ((name: string, inner: () => void) => void) & {skip(condition: boolean): DescribeFunction};+type DescribeFunction = ((name: string, inner: () => void) => void) & {fail(condition: boolean): DescribeFunction};-type ItFunction<STATE> = ((name: string, inner: (state: STATE) => Promise<void>) => void) & {skip(condition: boolean): ItFunction<STATE>; repeat(n: number): ItFunction<STATE>};+type ItFunction<STATE> = ((name: string, inner: (state: STATE) => Promise<void>) => void) & {fail(condition: boolean): ItFunction<STATE>; repeat(n: number): ItFunction<STATE>};type TestRunner<STATE> = {describe: DescribeFunction;diff --git a/test/waittask.spec.js b/test/waittask.spec.jsindex 6a6589303f..3592102c2d 100644--- a/test/waittask.spec.js+++ b/test/waittask.spec.js@@ -117,7 +117,7 @@ module.exports.describe = function({testRunner, expect, product, playwright, FFOawait page.evaluate(() => window.__FOO = 'hit');await watchdog;});- it.skip(FFOX)('should work with strict CSP policy', async({page, server}) => {+ it.fail(FFOX)('should work with strict CSP policy', async({page, server}) => {server.setCSP('/empty.html', 'script-src ' + server.PREFIX);await page.goto(server.EMPTY_PAGE);let error = null;diff --git a/test/workers.spec.js b/test/workers.spec.jsindex 4303f2305b..010b98e8dc 100644--- a/test/workers.spec.js+++ b/test/workers.spec.js@@ -131,7 +131,7 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT})expect(response.request()).toBe(request);expect(response.ok()).toBe(true);});- false && it.skip(FFOX)('should report web socket activity', async function({page, server}) {+ false && it.fail(FFOX)('should report web socket activity', async function({page, server}) {const [worker] = await Promise.all([page.waitForEvent('worker'),page.goto(server.PREFIX + '/worker/worker.html'),diff --git a/utils/testrunner/TestRunner.js b/utils/testrunner/TestRunner.jsindex 071b127fa2..02e9df4e61 100644--- a/utils/testrunner/TestRunner.js+++ b/utils/testrunner/TestRunner.js@@ -72,13 +72,13 @@ const TestMode = {Run: 'run',Skip: 'skip',Focus: 'focus',- Fail: 'fail',+ ExpectToFail: 'fail',Flake: 'flake'};const TestResult = {Ok: 'ok',- Skipped: 'skipped', // User skipped the test+ ExpectToFail: 'skipped', // User marked as failedFailed: 'failed', // Exception happened during runningTimedOut: 'timedout', // Timeout Exceeded while runningTerminated: 'terminated', // Execution terminated@@ -138,7 +138,7 @@ class TestPass {for (let suite = test.suite; suite; suite = suite.parentSuite)this._workerDistribution.set(suite, workerId);// Do not shard skipped tests across workers.- if (test.declaredMode !== TestMode.Skip)+ if (test.declaredMode !== TestMode.ExpectToFail)workerId = (workerId + 1) % parallel;}@@ -200,8 +200,8 @@ class TestPass {if (this._termination)return;this._runner._willStartTest(test, workerId);- if (test.declaredMode === TestMode.Skip) {- test.result = TestResult.Skipped;+ if (test.declaredMode === TestMode.ExpectToFail) {+ test.result = TestResult.ExpectToFail;this._runner._didFinishTest(test, workerId);return;}@@ -296,7 +296,7 @@ function specBuilder(action) {};func.fail = condition => {if (condition)- mode = TestMode.Fail;+ mode = TestMode.ExpectToFail;return func;};func.flake = condition => {@@ -344,15 +344,13 @@ class TestRunner extends EventEmitter {this.it = specBuilder((mode, name, callback) => this._addTest(name, callback, mode, this._timeout));this.fit = specBuilder((mode, name, callback) => this._addTest(name, callback, TestMode.Focus, this._timeout));this.xit = specBuilder((mode, name, callback) => this._addTest(name, callback, TestMode.Skip, this._timeout));-- this._debuggerLogBreakpointLines = new Multimap();- this.dit = (name, callback) => {+ this.dit = specBuilder((mode, name, callback) => {const test = this._addTest(name, callback, TestMode.Focus, INFINITE_TIMEOUT);const N = callback.toString().split('\n').length;for (let i = 0; i < N; ++i)this._debuggerLogBreakpointLines.set(test.location.filePath, i + test.location.lineNumber);- };- this.dit.skip = () => this.dit; // no-op;+ });+ this._debuggerLogBreakpointLines = new Multimap();this.beforeAll = this._addHook.bind(this, 'beforeAll');this.beforeEach = this._addHook.bind(this, 'beforeEach');@@ -370,11 +368,15 @@ class TestRunner extends EventEmitter {}_addTest(name, callback, mode, timeout) {+ if (mode === TestMode.Skip)+ return;let suite = this._currentSuite;- let isSkipped = suite.declaredMode === TestMode.Skip;+ let expectToFail = suite.declaredMode === TestMode.ExpectToFail;while ((suite = suite.parentSuite))- isSkipped |= suite.declaredMode === TestMode.Skip;- const test = new Test(this._currentSuite, name, callback, isSkipped ? TestMode.Skip : mode, timeout);+ expectToFail |= suite.declaredMode === TestMode.ExpectToFail;+ if (expectToFail)+ mode = TestMode.ExpectToFail;+ const test = new Test(this._currentSuite, name, callback, mode, timeout);this._currentSuite.children.push(test);this._tests.push(test);this._hasFocusedTestsOrSuites = this._hasFocusedTestsOrSuites || mode === TestMode.Focus;@@ -382,11 +384,13 @@ class TestRunner extends EventEmitter {}_addSuite(mode, name, callback, ...args) {+ if (mode === TestMode.Skip)+ return;const oldSuite = this._currentSuite;const suite = new Suite(this._currentSuite, name, mode);this._currentSuite.children.push(suite);this._currentSuite = suite;- const result = callback(...args);+ callback(...args);this._currentSuite = oldSuite;this._hasFocusedTestsOrSuites = this._hasFocusedTestsOrSuites || mode === TestMode.Focus;}