Skip to content

Commit f6f2d58

Browse files
JohnMcLearclaude
andcommitted
fix(test): dismiss deletion-token modal without focus transfer
Clicking the ack button transferred focus out of the pad iframe, which made subsequent keyboard-driven tests (Tab / Enter) silently miss the editor. Swap the click for a page.evaluate() that hides the modal and nulls clientVars.padDeletionToken directly, leaving focus where it was. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3937e52 commit f6f2d58

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/tests/frontend-new/helper/padHelper.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,20 @@ export const goToNewPad = async (page: Page) => {
121121
await page.waitForSelector('iframe[name="ace_outer"]');
122122
await page.waitForSelector('#editorcontainer.initialized');
123123
// Creator sessions see the one-time pad-deletion-token modal on first visit.
124-
// Dismiss it so subsequent clicks in generic tests are not blocked. Tests
125-
// that need to interact with the modal should navigate to a new pad inline
126-
// instead of using this helper.
127-
const tokenModal = page.locator('#deletiontoken-modal');
128-
if (await tokenModal.isVisible().catch(() => false)) {
129-
await page.locator('#deletiontoken-ack').click();
130-
}
124+
// Hide it directly instead of clicking the ack button — clicking the button
125+
// transfers focus out of the pad iframe and breaks subsequent keyboard tests.
126+
// Tests that need to interact with the modal should navigate to a new pad
127+
// inline instead of using this helper.
128+
await page.evaluate(() => {
129+
const modal = document.getElementById('deletiontoken-modal');
130+
if (modal == null || modal.hidden) return;
131+
modal.hidden = true;
132+
modal.classList.remove('popup-show');
133+
const input = document.getElementById('deletiontoken-value') as HTMLInputElement | null;
134+
if (input) input.value = '';
135+
const w = window as unknown as {clientVars?: {padDeletionToken?: string | null}};
136+
if (w.clientVars != null) w.clientVars.padDeletionToken = null;
137+
});
131138
return padId;
132139
}
133140

0 commit comments

Comments
 (0)