fix(e2e): pin Web Share off in the desktop export tests (macOS WebKit)
The three "plain desktop browser" export tests (the PNG and GCG downloads plus the legacy-Telegram clipboard copy) assumed navigator.share is absent — true for Chromium and for WebKit on the Linux CI host, but desktop WebKit on macOS exposes a working Web Share API. There shareUrlAsFile / pickGcgDelivery take the share branch, so no download event fires and the "GCG copied to the clipboard" toast never shows, and the tests failed only on macOS WebKit. Pin navigator.share/canShare off in those three tests (a withoutWebShare helper that mirrors the inverse stub the share-sheet test already uses), so the delivery path under test is deterministic and identical across engines and OSes. Test-only; no production change. Full e2e suite: 228 passed on Chromium + WebKit.
This commit is contained in:
@@ -38,7 +38,20 @@ async function openFinishedHistory(page: Page): Promise<void> {
|
|||||||
await expect(page.getByRole('button', { name: 'Export game' })).toBeVisible();
|
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<void> {
|
||||||
|
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 }) => {
|
test('the chooser downloads the PNG through the signed URL on a plain browser', async ({ page }) => {
|
||||||
|
await withoutWebShare(page);
|
||||||
await routeDl(page);
|
await routeDl(page);
|
||||||
await openFinishedHistory(page);
|
await openFinishedHistory(page);
|
||||||
await page.getByRole('button', { name: 'Export game' }).click();
|
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 }) => {
|
test('the chooser downloads the GCG through the same signed-URL route', async ({ page }) => {
|
||||||
|
await withoutWebShare(page);
|
||||||
await routeDl(page);
|
await routeDl(page);
|
||||||
await openFinishedHistory(page);
|
await openFinishedHistory(page);
|
||||||
await page.getByRole('button', { name: 'Export game' }).click();
|
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 }) => {
|
test('a legacy Telegram client (no downloadFile) hides the image and copies the GCG', async ({ page }) => {
|
||||||
|
await withoutWebShare(page);
|
||||||
await page.addInitScript(() => {
|
await page.addInitScript(() => {
|
||||||
// Headless engines deny the real clipboard; a permissive stub keeps the legacy
|
// Headless engines deny the real clipboard; a permissive stub keeps the legacy
|
||||||
// copy path deterministic in both browsers.
|
// copy path deterministic in both browsers.
|
||||||
|
|||||||
Reference in New Issue
Block a user