Skip to content

Commit

Permalink
wait for overlay to be opacity-0
Browse files Browse the repository at this point in the history
  • Loading branch information
alextaing committed Oct 25, 2023
1 parent d8a1bef commit 9c9435b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions e2e-tests/tests/infra/StudioPlaywrightPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,14 @@ export default class StudioPlaywrightPage {
*/
async waitForLoadState() {
await this.page.waitForLoadState();
await expect(
this.page.getByRole("button", { name: "Open Add Element Menu" })
).toBeVisible();
const overlayDomEl = this.page.getByTestId("loading-overlay")
await expect.poll(() => overlayDomEl.evaluate((e: HTMLElement) => {
console.log(e.className)
return e.className.includes("opacity-0")
}), {
message: "Waiting for LoadingOverlay to finish.",
timeout: 5000,
}).toBeTruthy()
console.log("TRUTHED!")
}
}
2 changes: 1 addition & 1 deletion packages/studio-ui/src/components/LoadingOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function LoadingOverlay(

return (
<>
<div className={overlayClassname}>{overlay}</div>
<div className={overlayClassname} data-testid="loading-overlay">{overlay}</div>
<div className={childrenWrapperClassname}>{props.children}</div>
</>
);
Expand Down

0 comments on commit 9c9435b

Please sign in to comment.