Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

test: tighten public message page focus and URL checks

Amruth Pillai09adcdb07717
diff --git a/tests/e2e/specs/public-message-pages.spec.ts b/tests/e2e/specs/public-message-pages.spec.ts
index fb3710272..767ee153a 100644
--- a/tests/e2e/specs/public-message-pages.spec.ts
+++ b/tests/e2e/specs/public-message-pages.spec.ts
@@ -48,7 +48,7 @@ for (const width of [1440, 390])
await expect(
await owner.request.put(`${api}/password`, { data: { password: "fictional-message-password" } }),
).toBeOK();
- const origin = process.env.APP_URL ?? "http://localhost:3000";
+ const origin = new URL(process.env.APP_URL ?? "http://localhost:3000").origin;
const url = `${origin}/${account.username}/fictional-message-page`;
const visitor = await browser.newPage({ viewport: { width, height: 900 }, colorScheme: theme });
const desk = theme === "dark" ? "rgb(16, 15, 12)" : "rgb(248, 247, 243)";
@@ -61,6 +61,10 @@ for (const width of [1440, 390])
expect((await appearance(visitor.locator("main > p"))).text).toBeGreaterThanOrEqual(4.5);
const input = await appearance(password);
expect(input.border).toBeGreaterThanOrEqual(3);
+ await expect(password).toHaveCSS("border-top-style", "solid");
+ await expect(password).toHaveCSS("border-top-width", "1px");
+ await expect(password).toHaveCSS("outline-style", "solid");
+ await expect(password).toHaveCSS("outline-width", "2px");
expect(input.focus).toBeGreaterThanOrEqual(3);
expect(input.radius).toBe("4px");
const unlock = visitor.getByRole("button", { name: "Unlock", exact: true });
@@ -75,6 +79,8 @@ for (const width of [1440, 390])
await visitor.keyboard.press("Tab");
await expect(unlock).toBeFocused();
expect((await appearance(unlock)).focus).toBeGreaterThanOrEqual(3);
+ await expect(unlock).toHaveCSS("outline-style", "solid");
+ await expect(unlock).toHaveCSS("outline-width", "2px");
await visitor.screenshot({ path: info.outputPath("password-error.png") });
await password.fill("fictional-message-password");
await unlock.click();
@@ -88,6 +94,8 @@ for (const width of [1440, 390])
await expect(home).toHaveAttribute("href", `${origin}/`);
await home.focus();
expect((await appearance(home)).focus).toBeGreaterThanOrEqual(3);
+ await expect(home).toHaveCSS("outline-style", "solid");
+ await expect(home).toHaveCSS("outline-width", "2px");
expect((await appearance(home)).text).toBeGreaterThanOrEqual(4.5);
const unavailable = await visitor.locator("main").innerText();
expect(unavailable).not.toContain("PRIVATE fictional message fixture");
diff --git a/tests/e2e/specs/public-sharing.spec.ts b/tests/e2e/specs/public-sharing.spec.ts
index bdcaff21b..7fdbc5dc4 100644
--- a/tests/e2e/specs/public-sharing.spec.ts
+++ b/tests/e2e/specs/public-sharing.spec.ts
@@ -246,6 +246,9 @@ test("a primary in Trash keeps the short link closed until Primary is switched o
authPage: page,
account,
}, testInfo) => {
+ const flags = await page.request.get("/api/openapi/flags");
+ await expect(flags).toBeOK();
+ const { customDomains } = (await flags.json()) as { customDomains: boolean };
const primaryName = await createSampleResumeFromDashboard(page, testInfo);
await openSidebarSection(page, "Sharing");
await page.getByRole("button", { name: "Publish", exact: true }).click();
@@ -273,7 +276,11 @@ test("a primary in Trash keeps the short link closed until Primary is switched o
await page.reload();
await openSidebarSection(page, "Sharing");
- await expect(addresses).toContainText(/Publish this resume to open it at your short link(?: and custom domain)?\./);
+ await expect(addresses).toContainText(
+ customDomains
+ ? "Publish this resume to open it at your short link and custom domain."
+ : "Publish this resume to open it at your short link.",
+ );
await expect(addresses).toContainText("If another resume holds Primary, turn it on for this one instead.");
await expect(copy).toBeDisabled();
expect((await page.request.get(`/${account.username}`)).status()).toBe(404);