refactor: test-e2e.sh script
This commit is contained in:
@ -2,12 +2,16 @@ import { test, expect } from "@playwright/test"
|
||||
import { CODE_SERVER_ADDRESS } from "../utils/constants"
|
||||
|
||||
test.describe("login page", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// TODO@jsjoeio reset context somehow
|
||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||
})
|
||||
// Reset the browser so no cookies are persisted
|
||||
// by emptying the storageState
|
||||
const options = {
|
||||
contextOptions: {
|
||||
storageState: {},
|
||||
},
|
||||
}
|
||||
|
||||
test("should see the login page", async ({ page }) => {
|
||||
test("should see the login page", options, async ({ page }) => {
|
||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||
// It should send us to the login page
|
||||
expect(await page.title()).toBe("code-server login")
|
||||
})
|
||||
|
@ -2,12 +2,15 @@ import { test, expect } from "@playwright/test"
|
||||
import { CODE_SERVER_ADDRESS, PASSWORD } from "../utils/constants"
|
||||
|
||||
test.describe("logout", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// TODO@jsjoeio reset context
|
||||
// Reset the browser so no cookies are persisted
|
||||
// by emptying the storageState
|
||||
const options = {
|
||||
contextOptions: {
|
||||
storageState: {},
|
||||
},
|
||||
}
|
||||
test("should be able login and logout", options, async ({ page }) => {
|
||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||
})
|
||||
|
||||
test("should be able login and logout", async ({ page }) => {
|
||||
// Type in password
|
||||
await page.fill(".password", PASSWORD)
|
||||
// Click the submit button and login
|
||||
|
Reference in New Issue
Block a user