diff --git a/test/defaultbrowsercontext.jest.js b/test/defaultbrowsercontext.jest.js index abe3253296157..c8d61f25ff461 100644 --- a/test/defaultbrowsercontext.jest.js +++ b/test/defaultbrowsercontext.jest.js @@ -290,7 +290,7 @@ describe('launchPersistentContext()', function() { await removeUserDataDir(userDataDir); await removeUserDataDir(userDataDir2); }); - it.slow().fail(CHROMIUM && (WIN || MAC))('should restore cookies from userDataDir', async({browserType, defaultBrowserOptions, server, launchPersistent}) => { + it.fail(CHROMIUM && (WIN || MAC)).slow()('should restore cookies from userDataDir', async({browserType, defaultBrowserOptions, server, launchPersistent}) => { const userDataDir = await makeUserDataDir(); const browserContext = await browserType.launchPersistentContext(userDataDir, defaultBrowserOptions); const page = await browserContext.newPage(); diff --git a/test/headful.jest.js b/test/headful.jest.js index 3a9d046f35d10..1612139587a3a 100644 --- a/test/headful.jest.js +++ b/test/headful.jest.js @@ -27,7 +27,7 @@ describe('Headful', function() { await browserContext.close(); await removeUserDataDir(userDataDir); }); - it.slow().fail(WIN && CHROMIUM)('headless should be able to read cookies written by headful', async({browserType, defaultBrowserOptions, server}) => { + it.fail(WIN && CHROMIUM).slow()('headless should be able to read cookies written by headful', async({browserType, defaultBrowserOptions, server}) => { // see https://github.com/microsoft/playwright/issues/717 const userDataDir = await makeUserDataDir(); // Write a cookie in headful chrome diff --git a/test/jest/playwrightEnvironment.js b/test/jest/playwrightEnvironment.js index a59e092861bd6..1e65972e6036f 100644 --- a/test/jest/playwrightEnvironment.js +++ b/test/jest/playwrightEnvironment.js @@ -64,14 +64,21 @@ class PlaywrightEnvironment extends NodeEnvironment { return super.runScript(script); } + patchToEnableFixtures(object, name) { + const original = object[name]; + object[name] = fn => { + return original(async () => { + return await this.fixturePool.resolveParametersAndRun(fn); + }); + } + } + async handleTestEvent(event, state) { if (event.name === 'setup') { - const beforeEach = this.global.beforeEach; - this.global.beforeEach = fn => { - return beforeEach(async () => { - return await this.fixturePool.resolveParametersAndRun(fn); - }); - } + + this.patchToEnableFixtures(this.global, 'beforeEach'); + this.patchToEnableFixtures(this.global, 'afterEach'); + const describeSkip = this.global.describe.skip; this.global.describe.skip = (...args) => { if (args.length = 1) @@ -88,7 +95,11 @@ class PlaywrightEnvironment extends NodeEnvironment { return itSkip(...args); }; this.global.it.fail = this.global.it.skip; - this.global.it.slow = () => this.global.it; + this.global.it.slow = () => { + return (name, fn) => { + return this.global.it(name, fn, 90000); + } + } const testOptions = this.global.testOptions; function toBeGolden(received, goldenName) { diff --git a/test/launcher.jest.js b/test/launcher.jest.js index 0a866fd60b224..9e44dd8325e3a 100644 --- a/test/launcher.jest.js +++ b/test/launcher.jest.js @@ -76,7 +76,7 @@ describe('Playwright', function() { const error = await browserType.launch(options).catch(e => e); expect(error.message).toContain(''); }); - it.slow().skip(CHANNEL)('should accept objects as options', async({browserType, defaultBrowserOptions}) => { + it.skip(CHANNEL).slow()('should accept objects as options', async({browserType, defaultBrowserOptions}) => { const browser = await browserType.launch({ ...defaultBrowserOptions, process }); await browser.close(); });