Archived
1
0

refactor: e2e tests based on jest-playwright

This commit is contained in:
Joe Previte
2021-04-01 10:57:44 -07:00
parent 1782f2a239
commit 4b703cbd4d
4 changed files with 18 additions and 66 deletions

View File

@ -1,28 +1,9 @@
import { chromium, Page, Browser, BrowserContext } from "playwright"
/// <reference types="jest-playwright-preset" />
import { CODE_SERVER_ADDRESS, PASSWORD } from "../utils/constants"
describe("logout", () => {
let browser: Browser
let page: Page
let context: BrowserContext
beforeAll(async () => {
browser = await chromium.launch()
context = await browser.newContext()
})
afterAll(async () => {
await browser.close()
})
beforeEach(async () => {
page = await context.newPage()
})
afterEach(async () => {
await page.close()
// Remove password from local storage
await context.clearCookies()
await jestPlaywright.resetContext()
})
it("should be able login and logout", async () => {
@ -31,6 +12,8 @@ describe("logout", () => {
await page.fill(".password", PASSWORD)
// Click the submit button and login
await page.click(".submit")
// Allow time to navigate
await page.waitForTimeout(1000)
// See the editor
const codeServerEditor = await page.isVisible(".monaco-workbench")
expect(codeServerEditor).toBeTruthy()