From 581a0727de10ee01ed120f402b4dc86a574dc9e9 Mon Sep 17 00:00:00 2001 From: csd113 Date: Thu, 1 Oct 2026 07:23:04 -0700 Subject: [PATCH] Stabilize native quote navigation release checks --- tests/e2e/public-reading-polish.spec.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/e2e/public-reading-polish.spec.ts b/tests/e2e/public-reading-polish.spec.ts index 4e879df6..438031a8 100644 --- a/tests/e2e/public-reading-polish.spec.ts +++ b/tests/e2e/public-reading-polish.spec.ts @@ -375,6 +375,23 @@ test('search post numbers and quotes open their thread context', async ({ page, await page.goBack(); await expect(page.locator('#board-search-input')).toHaveValue('unique-search-needle'); if (['chromium', 'webkit', 'firefox'].includes(testInfo.project.name)) { + // Check each modifier independently so the foreground gesture's Shift + // cannot hide a broken Control/Command passthrough guard. + const intercepted = await page.locator(`#p${reply} a.quotelink`).evaluate(link => { + return ['ctrlKey', 'metaKey'].map(modifier => { + let preventedByApp: boolean | undefined; + document.addEventListener('click', event => { + preventedByApp = event.defaultPrevented; + // Inspect application handling, then cancel synthetic navigation. + event.preventDefault(); + }, { once: true }); + link.dispatchEvent(new MouseEvent('click', { + bubbles: true, cancelable: true, [modifier]: true, + })); + return preventedByApp; + }); + }); + expect(intercepted).toEqual([false, false]); await page.evaluate(() => { document.addEventListener('click', event => { if (!(event.target instanceof Element) || !event.target.closest('a.quotelink')) return; @@ -386,7 +403,9 @@ test('search post numbers and quotes open their thread context', async ({ page, }); const [opened] = await Promise.all([ page.context().waitForEvent('page'), - page.locator(`#p${reply} a.quotelink`).click({ modifiers: ['ControlOrMeta'] }), + // Open the tab in the foreground: Chromium can leave a traced background + // tab uninitialized even after its document response has arrived. + page.locator(`#p${reply} a.quotelink`).click({ modifiers: ['ControlOrMeta', 'Shift'] }), ]).finally(async () => { noteEvent('modified-quote-click', JSON.stringify(await page.evaluate(() => (window as Window & { auditQuoteClick?: unknown }).auditQuoteClick))); });