Skip to content

Commit 97e1812

Browse files
committed
fix publish tests
1 parent 17b65e5 commit 97e1812

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

src/frontend/tests/core/features/publish-flow.spec.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,24 @@ test(
6262
checked: false,
6363
});
6464
await expect(page.getByTestId("rf__wrapper")).toBeVisible();
65+
66+
// The publish-switch toggle is confirmed in the UI above, but the
67+
// un-publish has to reach the backend before the shareable URL stops
68+
// resolving — give it time to propagate.
69+
await page.waitForTimeout(ANIMATIONS.publishTogglePropagation);
70+
6571
await page.goto(newUrl);
66-
try {
67-
await expect(page.getByTestId(TID.mainpageTitle)).toBeVisible({
68-
timeout: TIMEOUTS.medium,
69-
});
70-
} catch (_error) {
71-
await page.reload();
72-
await expect(page.getByTestId(TID.mainpageTitle)).toBeVisible({
73-
timeout: TIMEOUTS.medium,
74-
});
75-
}
72+
73+
// An un-published playground URL redirects to the projects page:
74+
// PlaygroundPage detects access_type !== "PUBLIC" and navigates to
75+
// "/". The redirect is client-side and the subsequent app bootstrap
76+
// can be slow on CI, so wait for the URL to leave /playground/
77+
// before asserting the projects page rendered.
78+
await page.waitForURL((url) => !url.pathname.startsWith("/playground/"), {
79+
timeout: TIMEOUTS.long,
80+
});
81+
await expect(page.getByTestId(TID.mainpageTitle)).toBeVisible({
82+
timeout: TIMEOUTS.long,
83+
});
7684
},
7785
);

0 commit comments

Comments
 (0)