Archived
1
0
This repository has been archived on 2024-09-09. You can view files and clone it, but cannot push or open issues or pull requests.
code-server/test/login.test.ts

39 lines
963 B
TypeScript
Raw Normal View History

2021-01-28 19:48:57 +01:00
import { chromium, Page, Browser, BrowserContext } from "playwright"
import { CODE_SERVER_ADDRESS, PASSWORD } from "./constants"
2021-01-28 19:48:57 +01:00
describe("login", () => {
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()
})
it("should be able to login", async () => {
await page.goto(CODE_SERVER_ADDRESS)
2021-01-28 19:48:57 +01:00
// Type in password
await page.fill(".password", PASSWORD)
2021-01-28 19:48:57 +01:00
// Click the submit button and login
await page.click(".submit")
// See the editor
const codeServerEditor = await page.isVisible(".monaco-workbench")
expect(codeServerEditor).toBeTruthy()
})
})