From 6282bf77db53b6e6334ac9b593d951de63578b8a Mon Sep 17 00:00:00 2001 From: Amruth Pillai Date: Tue, 29 Sep 2026 00:41:54 +0200 Subject: [PATCH] test(e2e): the shared page on phones, and links that aren't shared Adds a phone visit that checks the reflow, tap-to-mail contacts and the pinned Download and Share, and an unknown link's message. The download preference spec expects the page's single Download button, and the root spec the new footer credit. --- .../specs/public-download-preference.spec.ts | 2 +- tests/e2e/specs/root-public-resume.spec.ts | 5 +++- tests/e2e/specs/shared-resume.spec.ts | 26 +++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 tests/e2e/specs/shared-resume.spec.ts diff --git a/tests/e2e/specs/public-download-preference.spec.ts b/tests/e2e/specs/public-download-preference.spec.ts index 1d35e240c..9e671d018 100644 --- a/tests/e2e/specs/public-download-preference.spec.ts +++ b/tests/e2e/specs/public-download-preference.spec.ts @@ -26,7 +26,7 @@ test("persists public download-button visibility", async ({ browser, authPage: p await downloadPreference.click(); await expect(downloadPreference).toBeChecked(); await anonymous.reload(); - await expect(anonymous.getByRole("button", { name: "Download PDF" })).toHaveCount(2); + await expect(anonymous.getByRole("button", { name: "Download PDF" })).toHaveCount(1); } finally { await anonymous.close(); } diff --git a/tests/e2e/specs/root-public-resume.spec.ts b/tests/e2e/specs/root-public-resume.spec.ts index bf556daab..ec7557f1c 100644 --- a/tests/e2e/specs/root-public-resume.spec.ts +++ b/tests/e2e/specs/root-public-resume.spec.ts @@ -124,7 +124,10 @@ test("configured root preserves access, canonical, identity, statistics and app await expect(page).toHaveURL(`${baseURL}/`); await expect(page.getByRole("main")).toHaveCount(1); await expect(page.getByRole("navigation", { name: "Main navigation" })).toHaveCount(0); - await expect(page.getByRole("link", { name: "Build your own resume" })).toHaveAttribute("href", "/dashboard"); + await expect(page.getByRole("link", { name: "Made with Reactive Resume, free and open source" })).toHaveAttribute( + "href", + "/dashboard", + ); await expect(page.locator('link[rel="canonical"]')).toHaveAttribute("href", `${baseURL}/`); await expect(page.locator('script[type="application/ld+json"]')).toHaveCount(0); await expect.poll(readStatistics).toMatchObject({ views: 1, downloads: 0 }); diff --git a/tests/e2e/specs/shared-resume.spec.ts b/tests/e2e/specs/shared-resume.spec.ts new file mode 100644 index 000000000..7f7c74a1e --- /dev/null +++ b/tests/e2e/specs/shared-resume.spec.ts @@ -0,0 +1,26 @@ +import { createSampleResumeFromDashboard, makeResumePublic } from "../fixtures/resume"; +import { expect, test } from "../fixtures/test"; + +test("reflows the shared resume on phones and says nothing about links that aren't shared", async ({ + browser, + authPage: page, +}, testInfo) => { + test.setTimeout(60_000); + await createSampleResumeFromDashboard(page, testInfo); + const publicUrl = await makeResumePublic(page); + + const phone = await browser.newPage({ viewport: { width: 390, height: 844 } }); + try { + await phone.goto(publicUrl); + // Readable text in print order, contact details as tap targets, Download and Share pinned. + await expect(phone.getByRole("heading", { level: 2, name: "Experience" }).first()).toBeVisible(); + await expect(phone.getByRole("link", { name: /@/ }).first()).toHaveAttribute("href", /^mailto:/); + await expect(phone.getByRole("button", { name: "Download PDF" })).toBeInViewport(); + await expect(phone.getByRole("button", { name: "Share" })).toBeInViewport(); + + await phone.goto(`${new URL(publicUrl).origin}/nobody-here/nothing-shared`); + await expect(phone.getByRole("heading", { name: "This resume isn't shared right now." })).toBeVisible(); + } finally { + await phone.close(); + } +});