mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-06 16:34:36 +00:00
* feat(website): add a thanks page after downloading Desktop and APK download buttons on /download and the homepage now open /download/thanks, which starts the download and points people to Discord, GitHub, Reddit, and sponsoring while it runs. The button carries the asset name rather than the file URL, so the page resolves the URL from the release data itself and cannot be pointed at an arbitrary link. * fix(website): start the exact file the visitor clicked on the thanks page The thanks page looked the file up again from an asset key and channel, so it could start a different release than the button showed (a release published in between, or a beta link without a beta). Download links now carry the release file URL itself; the thanks page accepts only URLs under this repo's GitHub releases, after URL parsing normalizes `..` segments. The e2e test waits for the file request instead of a download event, because WebKit reports no download event for a stubbed response. * test(website): assert the thanks-page download event outside WebKit * test(website): split the thanks-page download check out of the shared test
48 lines
1.6 KiB
TypeScript
48 lines
1.6 KiB
TypeScript
import { expect, test, type Page } from "playwright/test";
|
|
|
|
const APPLE_SILICON_DMG = /\/getpaseo\/paseo\/releases\/download\/v[^/]+\/Paseo-[^/]+-arm64\.dmg$/;
|
|
|
|
async function openDownloadPage(page: Page) {
|
|
// Serve a stand-in file so the test never downloads a real release.
|
|
await page.route(APPLE_SILICON_DMG, (route) =>
|
|
route.fulfill({
|
|
status: 200,
|
|
headers: {
|
|
"content-type": "application/octet-stream",
|
|
"content-disposition": "attachment; filename=Paseo.dmg",
|
|
},
|
|
body: "dmg",
|
|
}),
|
|
);
|
|
await page.goto("/download");
|
|
}
|
|
|
|
async function clickAppleSilicon(page: Page) {
|
|
await page.getByRole("link", { name: "Apple Silicon", exact: true }).click();
|
|
}
|
|
|
|
test("a download button opens the thanks page and requests the file", async ({ page }) => {
|
|
await openDownloadPage(page);
|
|
|
|
const fileRequest = page.waitForRequest(APPLE_SILICON_DMG);
|
|
await clickAppleSilicon(page);
|
|
|
|
await fileRequest;
|
|
await expect(page).toHaveURL(/\/download\/thanks\?file=/);
|
|
await expect(page.getByRole("heading", { name: "Thanks for downloading Paseo" })).toBeVisible();
|
|
await expect(page.getByRole("link", { name: "Try again" })).toHaveAttribute(
|
|
"href",
|
|
APPLE_SILICON_DMG,
|
|
);
|
|
});
|
|
|
|
test("the thanks page starts a browser download", async ({ page, browserName }) => {
|
|
test.skip(browserName === "webkit", "WebKit reports no download event for a stubbed response");
|
|
await openDownloadPage(page);
|
|
|
|
const download = page.waitForEvent("download");
|
|
await clickAppleSilicon(page);
|
|
|
|
expect((await download).url()).toMatch(APPLE_SILICON_DMG);
|
|
});
|