Archived
1
0

chore: upgrade to Playwright 1.12 with its new test-runner

This commit is contained in:
Max Schmitt
2021-06-10 15:09:38 +02:00
parent 9fc9c041ad
commit dbb34ad710
17 changed files with 482 additions and 1043 deletions

View File

@ -6,20 +6,21 @@ import { hash } from "../../src/node/util"
import { PASSWORD } from "./constants"
import * as wtfnode from "./wtfnode"
const cookieToStore = {
sameSite: "Lax" as const,
name: "key",
value: hash(PASSWORD),
domain: "localhost",
path: "/",
expires: -1,
httpOnly: false,
secure: false,
}
export default async function () {
console.log("\n🚨 Running Global Setup for Playwright End-to-End Tests")
console.log(" Please hang tight...")
const cookieToStore = {
sameSite: "Lax" as const,
name: "key",
value: await hash(PASSWORD),
domain: "localhost",
path: "/",
expires: -1,
httpOnly: false,
secure: false,
}
module.exports = async () => {
console.log("\n🚨 Running Global Setup for Jest End-to-End Tests")
console.log(" Please hang tight...")
const browser = await chromium.launch()
const page = await browser.newPage()
const storage = await page.context().storageState()
@ -31,10 +32,9 @@ module.exports = async () => {
storage.cookies = [cookieToStore]
// Save storage state and store as an env variable
// More info: https://playwright.dev/docs/auth?_highlight=authe#reuse-authentication-state
// More info: https://playwright.dev/docs/auth/#reuse-authentication-state
process.env.STORAGE = JSON.stringify(storage)
await page.close()
await browser.close()
console.log("✅ Global Setup for Jest End-to-End Tests is now complete.")
console.log("✅ Global Setup for Playwright End-to-End Tests is now complete.")
}