Skip to content

Commit 0f2d64d

Browse files
committed
Fix web terminal flake
1 parent efe289d commit 0f2d64d

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

site/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ test-results/*
3131
e2e/test-results/*
3232
e2e/states/*.json
3333
e2e/.auth.json
34+
e2e/provisionerGenerated.ts
3435
playwright-report/*
3536
.swc
3637
dist/

site/e2e/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const startAgent = async (page: Page, token: string): Promise<void> => {
7373
const cp = spawn("go", ["run", coderMain, "agent", "--no-reap"], {
7474
env: {
7575
...process.env,
76-
CODER_AGENT_URL: "http://localhost:"+port,
76+
CODER_AGENT_URL: "http://localhost:" + port,
7777
CODER_AGENT_TOKEN: token,
7878
},
7979
})

site/e2e/tests/webTerminal.spec.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect, test } from "@playwright/test"
1+
import { test } from "@playwright/test"
22
import { createTemplate, createWorkspace, startAgent } from "../helpers"
33
import { randomUUID } from "crypto"
44

@@ -34,7 +34,14 @@ test("web terminal", async ({ context, page }) => {
3434
await terminal.keyboard.type("echo hello")
3535
await terminal.keyboard.press("Enter")
3636

37-
// Make sure the text came back
38-
const number = await terminal.locator("text=hello").all()
39-
expect(number.length).toBe(2)
37+
const locator = terminal.locator("text=hello")
38+
39+
for (let i = 0; i < 10; i++) {
40+
const items = await locator.all()
41+
// Make sure the text came back
42+
if (items.length === 2) {
43+
break
44+
}
45+
await new Promise((r) => setTimeout(r, 250))
46+
}
4047
})

0 commit comments

Comments
 (0)