Skip to content

Commit 0fef0a2

Browse files
bjohansebasclaude
andcommitted
test(e2e): dismiss the overlay with real clicks
Backdrop click, close (×) button, and click-inside-stays-open now run against real mouse events in the overlay iframe — the backdrop case clicks the frame's top-left corner away from the centered card, and the close-button pass rides the catch-up sync that re-shows the overlay after a reload. The jsdom dismiss describe is removed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent a525f05 commit 0fef0a2

2 files changed

Lines changed: 29 additions & 22 deletions

File tree

test/e2e/overlay.test.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,35 @@ describe("error overlay (browser)", () => {
106106
expect(await page.$(`#${OVERLAY_ID}`)).toBeNull();
107107
});
108108

109+
it("dismisses on backdrop and close-button clicks, but not inside the card", async () => {
110+
hotApp = await createHotApp({ code: app("v1") });
111+
({ page, browser } = await runBrowser());
112+
113+
await page.goto(hotApp.url);
114+
115+
hotApp.edit("broken for clicks {{{");
116+
let frame = await waitForOverlay(page);
117+
118+
// Clicking inside the card keeps the overlay open…
119+
await frame.click(`#${OVERLAY_ID}-card`);
120+
expect(await page.$(`#${OVERLAY_ID}`)).not.toBeNull();
121+
122+
// …clicking the backdrop (top-left corner, away from the centered card)
123+
// dismisses it.
124+
const body = await frame.$("body");
125+
await body.click({ offset: { x: 5, y: 5 } });
126+
await waitForNoOverlay(page);
127+
128+
// A reload brings the overlay back through the catch-up sync — dismiss
129+
// it again through the close (×) button.
130+
await page.reload();
131+
frame = await waitForOverlay(page);
132+
await frame.click('[aria-label="Close"]');
133+
await waitForNoOverlay(page);
134+
135+
expect(await page.$(`#${OVERLAY_ID}`)).toBeNull();
136+
});
137+
109138
it("catches runtime errors and renders their message as text, not markup", async () => {
110139
hotApp = await createHotApp({
111140
// The error must be thrown from the page's own script — errors raised

test/overlay.test.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -132,28 +132,6 @@ describe("overlay", () => {
132132
});
133133
});
134134

135-
describe("dismiss", () => {
136-
it("closes when clicking the backdrop", () => {
137-
showProblems("errors", ["boom"]);
138-
getOverlay().contentDocument.body.click();
139-
expect(getOverlay()).toBeNull();
140-
});
141-
142-
it("stays open when clicking inside the card", () => {
143-
showProblems("errors", ["boom"]);
144-
getCard().click();
145-
expect(getOverlay()).not.toBeNull();
146-
});
147-
148-
it("closes when clicking the close button", () => {
149-
showProblems("errors", ["boom"]);
150-
const closeButton = getCard().querySelector("button");
151-
expect(closeButton).not.toBeNull();
152-
closeButton.click();
153-
expect(getOverlay()).toBeNull();
154-
});
155-
});
156-
157135
describe("runtime errors", () => {
158136
it("shows uncaught errors in the overlay and accumulates them", () => {
159137
configureOverlay({ catchRuntimeError: true });

0 commit comments

Comments
 (0)