Archived
1
0

feat: add CodeServer page object for e2e tests

This commit is contained in:
Joe Previte
2021-04-19 15:25:57 -07:00
parent 5ad8e686bc
commit 2665a4f61b
3 changed files with 167 additions and 0 deletions

View File

@ -0,0 +1,46 @@
import { test, expect } from "@playwright/test"
import { STORAGE } from "../utils/constants"
import { CodeServer } from "./models/CodeServer"
test.describe("CodeServer", () => {
// Create a new context with the saved storage state
// so we don't have to logged in
const options: any = {}
let codeServer: CodeServer
// TODO@jsjoeio
// Fix this once https://github.com/microsoft/playwright-test/issues/240
// is fixed
if (STORAGE) {
const storageState = JSON.parse(STORAGE) || {}
options.contextOptions = {
storageState,
}
}
test.beforeEach(async ({ page }) => {
codeServer = new CodeServer(page)
await codeServer.navigate()
})
test("should open the default folder if not open", options, async ({ page }) => {
await codeServer.openFolder()
// find workspaceStorage in the Explorer menu, which would be open in the User folder
// which is the default folder that opens
expect(await page.isVisible("text=workspaceStorage")).toBe(true)
})
test("should show the Integrated Terminal", options, async ({ page }) => {
await codeServer.viewTerminal()
expect(await page.isVisible("#terminal")).toBe(true)
})
test("should open a file with quickOpen", options, async ({ page }) => {
await codeServer.openFolder()
await codeServer.quickOpen("extensions.json")
// If the file is open, we will see an empty array
// assuming no extensions are installed
expect(await page.isVisible("text=[]"))
})
})