Files
buzz/web/tests/e2e/smoke.spec.ts
Tyler 6c2d667575 Apply optional relay join policy across join flows (#1894)
Signed-off-by: npub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757 <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Tyler Longwell <tlongwell@squareup.com>
Co-authored-by: npub12gtutshhh76rx0jx697f32f9tffd4hhp3hx58fp4x6u4uemkm7sqf8f757 <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@sprout-oss.stage.blox.sqprod.co>
Co-authored-by: klopez4212 <klopez4212@gmail.com>
Co-authored-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@sprout-oss.stage.blox.sqprod.co>
2026-07-16 13:59:53 -04:00

76 lines
2.5 KiB
TypeScript

import { expect, test } from "@playwright/test";
test("home page loads with Buzz heading", async ({ page }) => {
await page.goto("/");
await expect(page.locator("header")).toContainText("Buzz");
});
test("home page shows repositories section", async ({ page }) => {
await page.goto("/");
await expect(page.getByText("Repositories")).toBeVisible();
});
test("invite requires age and legal consent before opening Buzz", async ({
page,
}) => {
await page.route("**/api/join-policy", async (route) => {
await route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify({
policy: {
terms_markdown: "# Terms",
privacy_markdown: "# Privacy",
age_attestation_required: true,
version: "policy-v1",
},
}),
});
});
await page.goto("/invite/demo-code");
const ageConfirmation = page.getByLabel("I am 18 years of age or older.");
const agreementConfirmation = page.getByLabel(
"I agree to the Buzz Terms of Service and Privacy Policy.",
);
const acceptInvite = page.getByRole("button", {
name: "Accept invite in Buzz",
});
await expect(ageConfirmation).toBeVisible();
await expect(agreementConfirmation).toBeVisible();
await expect(acceptInvite).toBeDisabled();
const termsLink = page.getByRole("button", { name: "Terms of Service" });
const privacyLink = page.getByRole("button", { name: "Privacy Policy" });
await expect(termsLink).toHaveCSS("text-decoration-line", "none");
await expect(privacyLink).toHaveCSS("text-decoration-line", "none");
await termsLink.hover();
await expect(termsLink).toHaveCSS("text-decoration-line", "underline");
await page.mouse.move(0, 0);
await privacyLink.hover();
await expect(privacyLink).toHaveCSS("text-decoration-line", "underline");
await page
.locator("label")
.filter({ hasText: "I am 18 years of age or older." })
.click();
await expect(ageConfirmation).toBeChecked();
await expect(acceptInvite).toBeDisabled();
await page
.locator("label")
.filter({
hasText: "I agree to the Buzz Terms of Service and Privacy Policy.",
})
.click({ position: { x: 8, y: 8 } });
await expect(agreementConfirmation).toBeChecked();
await expect(acceptInvite).toBeEnabled();
const consentBox = await page
.getByTestId("invite-join-policy-notice")
.boundingBox();
const acceptButtonBox = await acceptInvite.boundingBox();
expect(consentBox?.y).toBeLessThan(acceptButtonBox?.y ?? 0);
expect(consentBox?.width).toBe(acceptButtonBox?.width);
});