Skip to content

Commit 87b314c

Browse files
committed
Langtour: restructure E2E badge assertions to wait for full execution
1 parent 5dbf354 commit 87b314c

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

language-tour/src/utils/hooks/usePopcornEval.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ export function usePopcornEval() {
1111
async (code: string, editorId: string) => {
1212
const stopLogCapture = startLogCapture();
1313

14-
const timeout = import.meta.env.VITE_PLAYWRIGHT_TEST ? 160_000 : 45_000;
15-
1614
const result = await call(["eval_elixir", editorId, code, editorOrder], {
17-
timeoutMs: timeout
15+
timeoutMs: 40_000
1816
});
1917
const { stderr, stdout } = stopLogCapture();
2018

language-tour/tests/language-tour.spec.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,19 @@ test.describe("Language Tour - All Topics", () => {
3636
const runButtons = page.locator("button").filter({ hasText: "Run Code" });
3737
await runButtons.last().click();
3838

39-
await expect(async () => {
40-
const badges = page.locator("[data-testid='execution-state-badge']");
41-
const count = await badges.count();
42-
for (let i = 0; i < count; i++) {
43-
const state = await badges.nth(i).getAttribute("data-state");
44-
expect(state).not.toBe("running");
45-
expect(state).not.toBe("queued");
46-
}
47-
}).toPass({ timeout: 30_000 });
48-
4939
// TODO: support data-test-expect-failure attribute on code cells
5040
// to allow editors that are expected to fail
5141
const badges = page.locator("[data-testid='execution-state-badge']");
5242
const count = await badges.count();
5343
for (let i = 0; i < count; i++) {
54-
await expect(badges.nth(i)).toHaveAttribute("data-state", "success", {
55-
timeout: 180_000
56-
});
44+
await expect(async () => {
45+
const state = await badges.nth(i).getAttribute("data-state");
46+
expect(state).not.toBe("not_run");
47+
expect(state).not.toBe("running");
48+
expect(state).not.toBe("queued");
49+
}).toPass({ timeout: 41_000 });
50+
51+
await expect(badges.nth(i)).toHaveAttribute("data-state", "success");
5752
}
5853

5954
errorCollector.assertNoErrors();

0 commit comments

Comments
 (0)