Archived
1
0

refactor: add new e2e config

This commit is contained in:
Joe Previte 2021-04-13 11:58:09 -07:00
parent 0a090bf12b
commit 08cd2d8191
No known key found for this signature in database
GPG Key ID: 2C91590C6B742C24
4 changed files with 21 additions and 44 deletions

16
test/config.ts Normal file
View File

@ -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" })

View File

@ -1,39 +0,0 @@
// jest.config.ts
import type { Config } from "@jest/types"
const config: Config.InitialOptions = {
preset: "jest-playwright-preset",
transform: {
"^.+\\.ts$": "<rootDir>/node_modules/ts-jest",
},
globalSetup: "<rootDir>/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: [
"<rootDir>/../lib/vscode",
"<rootDir>/../release-packages",
"<rootDir>/../release",
"<rootDir>/../release-standalone",
"<rootDir>/../release-npm-package",
"<rootDir>/../release-gcp",
"<rootDir>/../release-images",
],
}
export default config

View File

@ -2,7 +2,7 @@
"license": "MIT", "license": "MIT",
"#": "We must put jest in a sub-directory otherwise VS Code somehow picks up the types and generates conflicts with mocha.", "#": "We must put jest in a sub-directory otherwise VS Code somehow picks up the types and generates conflicts with mocha.",
"devDependencies": { "devDependencies": {
"@playwright/test": "^0.1101.0", "@playwright/test": "^0.1101.0-alpha2",
"@types/jest": "^26.0.20", "@types/jest": "^26.0.20",
"@types/jsdom": "^16.2.6", "@types/jsdom": "^16.2.6",
"@types/node-fetch": "^2.5.8", "@types/node-fetch": "^2.5.8",

View File

@ -1258,10 +1258,10 @@
"@types/yargs" "^15.0.0" "@types/yargs" "^15.0.0"
chalk "^4.0.0" chalk "^4.0.0"
"@playwright/test@^0.1101.0": "@playwright/test@^0.1101.0-alpha2":
version "0.1101.0" version "0.1101.0-alpha2"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-0.1101.0.tgz#73f1195a9fd0c23b4efeff8cd2cd760f94247789" resolved "https://registry.yarnpkg.com/@playwright/test/-/test-0.1101.0-alpha2.tgz#a1121ac70e6ac986532ea63c6f565f06fae99364"
integrity sha512-yn/psASZhjKKCOJi9oW/5ImZx9wjlXhKvGVtleOC10XxhV0wshBf3eL+40G9o5VjJ8KwJaujj+mFadBrHjEs5w== integrity sha512-DDJQCTn5iLR2J5T/Fl+BhR9V7G++Y6HmSBLgn3blRZ8HWsJRseD6nowuhUij51rhDiLdJJLVmF4/sVJCqtPGMQ==
dependencies: dependencies:
folio "=0.3.23-alpha" folio "=0.3.23-alpha"
playwright "=1.10.0" playwright "=1.10.0"