From 08cd2d8191c652a460661b2907cadfec0bb1ffe1 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Tue, 13 Apr 2021 11:58:09 -0700 Subject: [PATCH] refactor: add new e2e config --- test/config.ts | 16 ++++++++++++++++ test/jest.e2e.config.ts | 39 --------------------------------------- test/package.json | 2 +- test/yarn.lock | 8 ++++---- 4 files changed, 21 insertions(+), 44 deletions(-) create mode 100644 test/config.ts delete mode 100644 test/jest.e2e.config.ts diff --git a/test/config.ts b/test/config.ts new file mode 100644 index 00000000..60339b41 --- /dev/null +++ b/test/config.ts @@ -0,0 +1,16 @@ +import { ChromiumEnv, FirefoxEnv, WebKitEnv, test, setConfig, PlaywrightOptions } from "@playwright/test" + +setConfig({ + testDir: "e2e", // Search for tests in this directory. + timeout: 30000, // Each test is given 30 seconds. +}) + +const options: PlaywrightOptions = { + headless: true, // Run tests in headless browsers. + video: "retain-on-failure", +} + +// Run tests in three browsers. +test.runWith(new ChromiumEnv(options), { tag: "chromium" }) +test.runWith(new FirefoxEnv(options), { tag: "firefox" }) +test.runWith(new WebKitEnv(options), { tag: "webkit" }) diff --git a/test/jest.e2e.config.ts b/test/jest.e2e.config.ts deleted file mode 100644 index 66653441..00000000 --- a/test/jest.e2e.config.ts +++ /dev/null @@ -1,39 +0,0 @@ -// jest.config.ts -import type { Config } from "@jest/types" - -const config: Config.InitialOptions = { - preset: "jest-playwright-preset", - transform: { - "^.+\\.ts$": "/node_modules/ts-jest", - }, - globalSetup: "/utils/globalSetup.ts", - testEnvironmentOptions: { - "jest-playwright": { - // TODO(@jsjoeio) enable on webkit and firefox - // waiting on next playwright release - // - https://github.com/microsoft/playwright/issues/6009#event-4536210890 - // - https://github.com/microsoft/playwright/issues/6020 - browsers: ["chromium"], - // If there's a page error, we don't exit - // i.e. something logged in the console - exitOnPageError: false, - contextOptions: { - recordVideo: { - dir: "./test/e2e/videos", - }, - }, - }, - }, - testPathIgnorePatterns: ["/node_modules/", "/lib/", "/out/", "test/unit"], - testTimeout: 30000, - modulePathIgnorePatterns: [ - "/../lib/vscode", - "/../release-packages", - "/../release", - "/../release-standalone", - "/../release-npm-package", - "/../release-gcp", - "/../release-images", - ], -} -export default config diff --git a/test/package.json b/test/package.json index e222c1e5..747f72f0 100644 --- a/test/package.json +++ b/test/package.json @@ -2,7 +2,7 @@ "license": "MIT", "#": "We must put jest in a sub-directory otherwise VS Code somehow picks up the types and generates conflicts with mocha.", "devDependencies": { - "@playwright/test": "^0.1101.0", + "@playwright/test": "^0.1101.0-alpha2", "@types/jest": "^26.0.20", "@types/jsdom": "^16.2.6", "@types/node-fetch": "^2.5.8", diff --git a/test/yarn.lock b/test/yarn.lock index 8aae7ad9..ffeda36a 100644 --- a/test/yarn.lock +++ b/test/yarn.lock @@ -1258,10 +1258,10 @@ "@types/yargs" "^15.0.0" chalk "^4.0.0" -"@playwright/test@^0.1101.0": - version "0.1101.0" - resolved "https://registry.yarnpkg.com/@playwright/test/-/test-0.1101.0.tgz#73f1195a9fd0c23b4efeff8cd2cd760f94247789" - integrity sha512-yn/psASZhjKKCOJi9oW/5ImZx9wjlXhKvGVtleOC10XxhV0wshBf3eL+40G9o5VjJ8KwJaujj+mFadBrHjEs5w== +"@playwright/test@^0.1101.0-alpha2": + version "0.1101.0-alpha2" + resolved "https://registry.yarnpkg.com/@playwright/test/-/test-0.1101.0-alpha2.tgz#a1121ac70e6ac986532ea63c6f565f06fae99364" + integrity sha512-DDJQCTn5iLR2J5T/Fl+BhR9V7G++Y6HmSBLgn3blRZ8HWsJRseD6nowuhUij51rhDiLdJJLVmF4/sVJCqtPGMQ== dependencies: folio "=0.3.23-alpha" playwright "=1.10.0"