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: support slow marker (#3018)
Pavel Feldmanc45b5797fa02
diff --git a/test/defaultbrowsercontext.jest.js b/test/defaultbrowsercontext.jest.jsindex abe3253296..c8d61f25ff 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.jsindex 3a9d046f35..1612139587 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/717const userDataDir = await makeUserDataDir();// Write a cookie in headful chromediff --git a/test/jest/playwrightEnvironment.js b/test/jest/playwrightEnvironment.jsindex a59e092861..1e65972e60 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.jsindex 0a866fd60b..9e44dd8325 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('<launching>');});- 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();});