refactor: check for editor consistently in tests
This commit is contained in:
@ -10,17 +10,12 @@ describe("globalSetup", () => {
|
||||
const storageState = JSON.parse(STORAGE) || {}
|
||||
await jestPlaywright.resetContext({
|
||||
storageState,
|
||||
logger: {
|
||||
isEnabled: (name, severity) => name === "browser",
|
||||
log: (name, severity, message, args) => console.log(`${name} ${message}`),
|
||||
},
|
||||
})
|
||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||
})
|
||||
|
||||
it("should keep us logged in using the storageState", async () => {
|
||||
// See the editor
|
||||
const codeServerEditor = await page.isVisible(".monaco-workbench")
|
||||
expect(codeServerEditor).toBeTruthy()
|
||||
// Make sure the editor actually loaded
|
||||
expect(await page.isVisible("div.monaco-workbench"))
|
||||
})
|
||||
})
|
||||
|
@ -3,12 +3,7 @@ import { CODE_SERVER_ADDRESS, PASSWORD } from "../utils/constants"
|
||||
|
||||
describe("login", () => {
|
||||
beforeEach(async () => {
|
||||
await jestPlaywright.resetBrowser({
|
||||
logger: {
|
||||
isEnabled: (name, severity) => name === "browser",
|
||||
log: (name, severity, message, args) => console.log(`${name} ${message}`),
|
||||
},
|
||||
})
|
||||
await jestPlaywright.resetBrowser()
|
||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||
})
|
||||
|
||||
@ -18,8 +13,7 @@ describe("login", () => {
|
||||
// Click the submit button and login
|
||||
await page.click(".submit")
|
||||
await page.waitForLoadState("networkidle")
|
||||
// See the editor
|
||||
const codeServerEditor = await page.isVisible(".monaco-workbench")
|
||||
expect(codeServerEditor).toBeTruthy()
|
||||
// Make sure the editor actually loaded
|
||||
expect(await page.isVisible("div.monaco-workbench"))
|
||||
})
|
||||
})
|
||||
|
@ -3,12 +3,7 @@ import { CODE_SERVER_ADDRESS, PASSWORD } from "../utils/constants"
|
||||
|
||||
describe("logout", () => {
|
||||
beforeEach(async () => {
|
||||
await jestPlaywright.resetBrowser({
|
||||
logger: {
|
||||
isEnabled: (name, severity) => name === "browser",
|
||||
log: (name, severity, message, args) => console.log(`${name} ${message}`),
|
||||
},
|
||||
})
|
||||
await jestPlaywright.resetBrowser()
|
||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||
})
|
||||
|
||||
@ -18,9 +13,8 @@ describe("logout", () => {
|
||||
// Click the submit button and login
|
||||
await page.click(".submit")
|
||||
await page.waitForLoadState("networkidle")
|
||||
// See the editor
|
||||
const codeServerEditor = await page.isVisible(".monaco-workbench")
|
||||
expect(codeServerEditor).toBeTruthy()
|
||||
// Make sure the editor actually loaded
|
||||
expect(await page.isVisible("div.monaco-workbench"))
|
||||
|
||||
// Click the Application menu
|
||||
await page.click("[aria-label='Application Menu']")
|
||||
|
@ -8,10 +8,6 @@ describe("Open Help > About", () => {
|
||||
const storageState = JSON.parse(STORAGE) || {}
|
||||
await jestPlaywright.resetContext({
|
||||
storageState,
|
||||
logger: {
|
||||
isEnabled: (name, severity) => name === "browser",
|
||||
log: (name, severity, message, args) => console.log(`${name} ${message}`),
|
||||
},
|
||||
})
|
||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||
})
|
||||
|
Reference in New Issue
Block a user