mirror of
https://github.com/block/buzz.git
synced 2026-10-27 12:40:30 +00:00
fix(web): ask Safari users for Mac type (#2090)
Signed-off-by: npub1qvn3cujt28pg06ehlstrxyz6ayzp06t4uc7r566vxwwgrv24hglq9zju0n <03271c724b51c287eb37fc1633105ae90417e975e63c3a6b4c339c81b155ba3e@sprout-oss.stage.blox.sqprod.co> Signed-off-by: npub1rf6fvdj6ut0c4kcmjv4p5mmgh89nj58n69uu3fz3cvk3jn500hqs7emz79 <1a7496365ae2df8adb1b932a1a6f68b9cb3950f3d179c8a451c32d194e8f7dc1@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1qvn3cujt28pg06ehlstrxyz6ayzp06t4uc7r566vxwwgrv24hglq9zju0n <03271c724b51c287eb37fc1633105ae90417e975e63c3a6b4c339c81b155ba3e@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1rf6fvdj6ut0c4kcmjv4p5mmgh89nj58n69uu3fz3cvk3jn500hqs7emz79 <1a7496365ae2df8adb1b932a1a6f68b9cb3950f3d179c8a451c32d194e8f7dc1@sprout-oss.stage.blox.sqprod.co>
This commit is contained in:
@@ -117,6 +117,65 @@ test("invite requires age and legal consent before opening Buzz", async ({
|
||||
expect(consentBox?.width).toBe(acceptButtonBox?.width);
|
||||
});
|
||||
|
||||
test("invite asks Safari users to choose their Mac download", async ({
|
||||
browser,
|
||||
}) => {
|
||||
const context = await browser.newContext({
|
||||
userAgent:
|
||||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Version/26.5 Safari/605.1.15",
|
||||
});
|
||||
await context.addInitScript(() => {
|
||||
Object.defineProperties(navigator, {
|
||||
platform: { configurable: true, value: "MacIntel" },
|
||||
maxTouchPoints: { configurable: true, value: 0 },
|
||||
userAgentData: { configurable: true, value: undefined },
|
||||
});
|
||||
});
|
||||
const page = await context.newPage();
|
||||
await page.route("**/api/join-policy", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify({ policy: null }),
|
||||
});
|
||||
});
|
||||
await page.route("https://api.github.com/**", async (route) => {
|
||||
await route.fulfill({ status: 500 });
|
||||
});
|
||||
|
||||
await page.goto("/invite/demo-code");
|
||||
const download = page.getByRole("link", { name: "Download it now" });
|
||||
await expect(download).toHaveAttribute("aria-haspopup", "dialog");
|
||||
await download.click();
|
||||
|
||||
const chooser = page.getByRole("dialog", {
|
||||
name: "Which Mac do you have?",
|
||||
});
|
||||
await expect(chooser).toBeVisible();
|
||||
await expect(chooser.getByRole("link", { name: /Newer Mac/ })).toContainText(
|
||||
"2021 or later, or a late-2020 Mac with an Apple M1 chip",
|
||||
);
|
||||
await expect(chooser.getByRole("link", { name: /Older Mac/ })).toContainText(
|
||||
"2019 or earlier, or a 2020 Mac with an Intel processor",
|
||||
);
|
||||
await expect(chooser.getByText("About This Mac")).toBeVisible();
|
||||
|
||||
const openedPagePromise = context.waitForEvent("page");
|
||||
await chooser.getByRole("link", { name: /Newer Mac/ }).click();
|
||||
const openedPage = await openedPagePromise;
|
||||
await expect(chooser).toBeHidden();
|
||||
await expect(openedPage).toHaveURL("https://github.com/block/buzz/releases");
|
||||
await expect(page).toHaveURL(/\/invite\/demo-code$/);
|
||||
await openedPage.close();
|
||||
|
||||
await download.click();
|
||||
await expect(chooser).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(chooser).toBeHidden();
|
||||
await expect(download).toBeFocused();
|
||||
await context.close();
|
||||
});
|
||||
|
||||
test("invite download falls back for mobile and non-desktop devices", async ({
|
||||
browser,
|
||||
}) => {
|
||||
|
||||
Reference in New Issue
Block a user