refactor: add constants.ts with PASSWORD, etc

This commit is contained in:
Joe Previte
2021-02-12 12:08:34 -07:00
parent 5857b25079
commit b0fd55463b
6 changed files with 16 additions and 11 deletions

View File

@ -2,6 +2,7 @@
// so that it authenticates us into code-server
// ensuring that we're logged in before we run any tests
import { chromium } from "playwright"
import { CODE_SERVER_ADDRESS, PASSWORD } from "./constants"
module.exports = async () => {
console.log("🚨 Running Global Setup for Jest Tests")
@ -10,9 +11,9 @@ module.exports = async () => {
const context = await browser.newContext()
const page = await context.newPage()
await page.goto(process.env.CODE_SERVER_ADDRESS || "http://localhost:8080", { waitUntil: "domcontentloaded" })
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "domcontentloaded" })
// Type in password
await page.fill(".password", process.env.PASSWORD || "password")
await page.fill(".password", PASSWORD)
// Click the submit button and login
await page.click(".submit")