Skip to content

Commit 3cac0ee

Browse files
committed
WIP
1 parent 65a0eec commit 3cac0ee

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

site/e2e/pom/WorkspacePage.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,32 @@ import { expect, Locator, Page } from "@playwright/test"
22
import { BasePom } from "./BasePom"
33

44
export class WorkspacePage extends BasePom {
5+
readonly workspaceRunningBadge: Locator
6+
readonly workspaceStoppedBadge: Locator
57
readonly stopWorkspaceButton: Locator
68

79
constructor(baseURL: string | undefined, page: Page) {
810
super(baseURL, `/templates/docker/workspace`, page)
911

12+
this.workspaceRunningBadge = page.getByTestId("badge-workspace-status-running")
13+
this.workspaceStoppedBadge = page.getByTestId("badge-workspace-status-stopped")
1014
this.stopWorkspaceButton = page.getByTestId("button-stop-workspace")
1115
}
1216

1317
async loaded() {
1418
await this.stopWorkspaceButton.waitFor({ state: "visible" })
19+
await expect(this.page).toHaveTitle("admin/my-first-workspace - Coder")
20+
}
1521

16-
await expect(this.page).toHaveTitle("admin/workspace-1 - Coder")
22+
async isRunning() {
23+
await this.workspaceRunningBadge.waitFor({ state: "visible" })
1724
}
1825

1926
async stop() {
2027
await this.stopWorkspaceButton.click()
2128
}
29+
30+
async isStopped() {
31+
await this.workspaceStoppedBadge.waitFor({ state: "visible" })
32+
}
2233
}

site/e2e/tests/basicScenario.spec.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,17 @@ test("Basic scenario", async ({ page, baseURL }) => {
3636
await workspacePage.loaded()
3737
})
3838

39-
// await test.step("Workspace is up and running", async() => {
40-
// await workspacePage.isRunning()
41-
// })
39+
await test.step("Workspace is up and running", async() => {
40+
await workspacePage.isRunning()
41+
})
42+
43+
await test.step("Stop the workspace", async() => {
44+
await workspacePage.stop()
45+
})
46+
47+
await test.step("Workspace is stopped", async() => {
48+
await workspacePage.isStopped()
49+
})
4250

4351
await test.step("Finally", async() => {
4452
await page.waitForTimeout(5 * 60 * 1000) // FIXME

site/src/components/Pill/Pill.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ export interface PillProps {
1010
type?: PaletteIndex
1111
lightBorder?: boolean
1212
title?: string
13+
dataTestId?: string
1314
}
1415

1516
export const Pill: FC<PillProps> = (props) => {
16-
const { className, icon, text = false, title } = props
17+
const { className, icon, text = false, title, dataTestId } = props
1718
const styles = useStyles(props)
1819
return (
1920
<div
2021
className={combineClasses([styles.wrapper, styles.pillColor, className])}
2122
role="status"
2223
title={title}
24+
data-testid={dataTestId}
2325
>
2426
{icon && <div className={styles.iconWrapper}>{icon}</div>}
2527
{text}

site/src/components/WorkspaceActions/Buttons.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export const StopButton: FC<PropsWithChildren<WorkspaceAction>> = ({
6161
startIcon={<CropSquareIcon />}
6262
onClick={handleAction}
6363
className={styles.fixedWidth}
64+
data-testid="button-stop-workspace"
6465
>
6566
{t("actionButton.stop")}
6667
</Button>

site/src/components/WorkspaceStatusBadge/WorkspaceStatusBadge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@ export const WorkspaceStatusBadge: FC<
100100
PropsWithChildren<WorkspaceStatusBadgeProps>
101101
> = ({ build, className }) => {
102102
const { text, icon, type } = getStatus(build.status)
103-
return <Pill className={className} icon={icon} text={text} type={type} data-testid={"workspace-status-" + type }
103+
return <Pill className={className} icon={icon} text={text} type={type} dataTestId={"badge-workspace-status-" + build.status }
104104
/>
105105
}

0 commit comments

Comments
 (0)