mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-10-02 17:54:22 +10:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user