diff --git a/ui/e2e/export.spec.ts b/ui/e2e/export.spec.ts index 54eb524..01e1d68 100644 --- a/ui/e2e/export.spec.ts +++ b/ui/e2e/export.spec.ts @@ -38,7 +38,20 @@ async function openFinishedHistory(page: Page): Promise { await expect(page.getByRole('button', { name: 'Export game' })).toBeVisible(); } +// Desktop WebKit (Safari's engine) exposes a working Web Share API, unlike Chromium and WebKit on +// Linux (the CI host). The "plain desktop browser" delivery paths tested below are reached only when +// Web Share is ABSENT — shareUrlAsFile / pickGcgDelivery fall through to the anchor download or the +// clipboard copy — so pin that precondition; otherwise macOS WebKit takes the share branch and no +// download or clipboard copy occurs. Mirrors the inverse stub the share-sheet test sets up. +async function withoutWebShare(page: Page): Promise { + await page.addInitScript(() => { + Object.defineProperty(navigator, 'share', { value: undefined, configurable: true }); + Object.defineProperty(navigator, 'canShare', { value: undefined, configurable: true }); + }); +} + test('the chooser downloads the PNG through the signed URL on a plain browser', async ({ page }) => { + await withoutWebShare(page); await routeDl(page); await openFinishedHistory(page); await page.getByRole('button', { name: 'Export game' }).click(); @@ -49,6 +62,7 @@ test('the chooser downloads the PNG through the signed URL on a plain browser', }); test('the chooser downloads the GCG through the same signed-URL route', async ({ page }) => { + await withoutWebShare(page); await routeDl(page); await openFinishedHistory(page); await page.getByRole('button', { name: 'Export game' }).click(); @@ -198,6 +212,7 @@ test('Telegram on iOS keeps the app chooser and opens the OS share sheet', async }); test('a legacy Telegram client (no downloadFile) hides the image and copies the GCG', async ({ page }) => { + await withoutWebShare(page); await page.addInitScript(() => { // Headless engines deny the real clipboard; a permissive stub keeps the legacy // copy path deterministic in both browsers.