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.
This commit is contained in:
Amruth Pillai
2026-09-29 00:41:54 +02:00
parent cc28f78537
commit 6282bf77db
3 changed files with 31 additions and 2 deletions
@@ -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();
}
+4 -1
View File
@@ -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 });
+26
View File
@@ -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();
}
});