Files
coder/site/e2e/tests/basicFlow.spec.ts
T
Presley Pizzo 56a69b7eea chore: add e2e tests for basic template and workspace flow (#5637)
* Fix type error in first user setup

* Save auth state

* Add template creation - wip

Remove saved auth state because it wasn't working

* Try adding the rest of the tests

Can't see if they work yet, waiting on a release

* Update playwright

* Update gitignore

* Write tests

* Format

* Update ignores

* Check that start worked

Co-authored-by: Ben Potter <ben@coder.com>

Co-authored-by: Ben Potter <ben@coder.com>
2023-01-10 12:30:44 -05:00

41 lines
1.3 KiB
TypeScript

import { test } from "@playwright/test"
import { email, password } from "../constants"
import { SignInPage } from "../pom"
import { clickButton, buttons, fillInput } from "../helpers"
test("Basic flow", async ({ baseURL, page }) => {
test.slow()
await page.goto(baseURL + "/", { waitUntil: "networkidle" })
// Log-in with the default credentials we set up in the development server
const signInPage = new SignInPage(baseURL, page)
await signInPage.submitBuiltInAuthentication(email, password)
// create Docker template
await page.waitForSelector("text=Templates")
await page.click("text=Templates")
await clickButton(page, buttons.starterTemplates)
await page.click(`text=${buttons.dockerTemplate}`)
await clickButton(page, buttons.useTemplate)
await clickButton(page, buttons.createTemplate)
// create workspace
await clickButton(page, buttons.createWorkspace)
await fillInput(page, "Workspace Name", "my-workspace")
await clickButton(page, buttons.submitCreateWorkspace)
// stop workspace
await page.waitForSelector("text=Started")
await clickButton(page, buttons.stopWorkspace)
// start workspace
await page.waitForSelector("text=Stopped")
await clickButton(page, buttons.startWorkspace)
await page.waitForSelector("text=Started")
})