Archived
1
0

refactor: check for editor consistently in tests

This commit is contained in:
Joe Previte
2021-04-05 15:18:13 -07:00
parent dd80eed5b0
commit ad0f12e664
7 changed files with 16 additions and 37 deletions

View File

@ -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"))
})
})

View File

@ -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"))
})
})

View File

@ -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']")

View File

@ -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" })
})