Skip to content

Commit 3040187

Browse files
committed
Add template creation - wip
Remove saved auth state because it wasn't working
1 parent 5975f1b commit 3040187

File tree

5 files changed

+47
-18
lines changed

5 files changed

+47
-18
lines changed

site/e2e/globalSetup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as constants from "./constants"
44

55
const globalSetup = async (): Promise<void> => {
66
axios.defaults.baseURL = `http://localhost:${constants.basePort}`
7+
// Create a user
78
await createFirstUser({
89
email: constants.email,
910
username: constants.username,

site/e2e/helpers.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Page } from "@playwright/test"
2+
3+
export const urls = {
4+
templates: "/templates",
5+
starterTemplates: "/starter-templates",
6+
dockerTemplate: "/starter-templates/docker",
7+
createDockerTemplate: "/templates/new?exampleId=docker"
8+
}
9+
10+
export const buttons = {
11+
starterTemplates: "Starter templates",
12+
dockerTemplate: "Develop in Docker",
13+
useTemplate: "Use template",
14+
createTemplate: "Create template"
15+
}
16+
17+
export const clickButtonByText = async (page: Page, text: string): Promise<void> => {
18+
await page.click(`button:has-text("${text}")`)
19+
}

site/e2e/playwright.config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ const config: PlaywrightTestConfig = {
1515
use: {
1616
baseURL: `http://localhost:${basePort}`,
1717
video: "retain-on-failure",
18-
// use stored login after first test
19-
storageState: "e2e/storageState.json"
2018
},
2119

2220
// `webServer` tells Playwright to launch a test server - more details here:

site/e2e/tests/basicFlow.spec.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { test } from "@playwright/test"
2+
import { email, password } from "../constants"
3+
import { SignInPage } from "../pom"
4+
import { clickButtonByText, buttons, urls } from "../helpers";
5+
6+
test("Basic flow", async ({ baseURL, page }) => {
7+
await page.goto(baseURL + "/", { waitUntil: "networkidle" })
8+
9+
// Log-in with the default credentials we set up in the development server
10+
const signInPage = new SignInPage(baseURL, page)
11+
await signInPage.submitBuiltInAuthentication(email, password)
12+
13+
await page.waitForSelector("text=Workspaces")
14+
15+
// create Docker template
16+
await page.goto(urls.templates);
17+
await clickButtonByText(page, buttons.starterTemplates)
18+
19+
await page.goto(urls.starterTemplates);
20+
await clickButtonByText(page, buttons.dockerTemplate)
21+
22+
await page.goto(urls.dockerTemplate);
23+
await clickButtonByText(page, buttons.useTemplate)
24+
25+
await page.goto(urls.createDockerTemplate);
26+
await clickButtonByText(page, buttons.createTemplate)
27+
})

site/e2e/tests/login.spec.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)