Archived
1
0

refactor: globalSetup to use CodeServer model

This commit is contained in:
Joe Previte
2021-04-21 14:31:15 -07:00
parent cb65590b98
commit b0ecff338f
8 changed files with 128 additions and 59 deletions

View File

@ -1,5 +1,6 @@
import { test, expect } from "@playwright/test"
import { CODE_SERVER_ADDRESS, PASSWORD } from "../utils/constants"
import { CodeServer } from "./models/CodeServer"
test.describe("logout", () => {
// Reset the browser so no cookies are persisted
@ -9,15 +10,24 @@ test.describe("logout", () => {
storageState: {},
},
}
let codeServer: CodeServer
test.beforeEach(async ({ page }) => {
codeServer = new CodeServer(page)
await codeServer.navigate()
})
test("should be able login and logout", options, async ({ page }) => {
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
// Type in password
await page.fill(".password", PASSWORD)
// Click the submit button and login
await page.click(".submit")
await page.waitForLoadState("networkidle")
// We do this because occassionally code-server doesn't load on Firefox
// but loads if you reload once or twice
await codeServer.reloadUntilEditorIsVisible()
// Make sure the editor actually loaded
expect(await page.isVisible("div.monaco-workbench")).toBe(true)
expect(await codeServer.isEditorVisible()).toBe(true)
// Click the Application menu
await page.click("[aria-label='Application Menu']")