Files
buzz/desktop/tests/e2e/invite-link-copy.spec.ts
klopez4212 384c72dee6 Refine community management flows (#2738)
## Summary
- simplify Add community into clear create and join paths
- align community actions and icon editing across the rail, profile
menu, and settings
- consolidate invites around the member list and a reusable link dialog

## Testing
- `pnpm check`
- `pnpm test` (3,483 passed)
- `pnpm run build:e2e`
- focused Playwright coverage (34 passed)

## Snapshots

| Add a community | Join an existing community |
| --- | --- |
| ![Add a
community](https://raw.githubusercontent.com/block/buzz/fae692faa77186df7702fb025ca3082c7cc93a8c/pr-2738--01-add-community.png)
| ![Join an existing
community](https://raw.githubusercontent.com/block/buzz/fae692faa77186df7702fb025ca3082c7cc93a8c/pr-2738--02-join-community.png)
|

| Create a new community | Hosted community icon |
| --- | --- |
| ![Create a new
community](https://raw.githubusercontent.com/block/buzz/fae692faa77186df7702fb025ca3082c7cc93a8c/pr-2738--03-create-community.png)
| ![Hosted community
icon](https://raw.githubusercontent.com/block/buzz/fae692faa77186df7702fb025ca3082c7cc93a8c/pr-2738--04-community-icon.png)
|

| Invites | Invite link |
| --- | --- |
|
![Invites](https://raw.githubusercontent.com/block/buzz/fae692faa77186df7702fb025ca3082c7cc93a8c/pr-2738--05-invites.png)
| ![Invite
link](https://raw.githubusercontent.com/block/buzz/fae692faa77186df7702fb025ca3082c7cc93a8c/pr-2738--06-invite-link.png)
|

---------

Signed-off-by: Wes <wesbillman@users.noreply.github.com>
Co-authored-by: Wes <wesbillman@users.noreply.github.com>
Co-authored-by: Carl <c7ebe626f000404285d3686e1dc74cc07cc60a9754a150041ba132e14bd3e2ec@buzz.block.builderlab.xyz>
2026-07-24 19:30:33 -07:00

56 lines
1.8 KiB
TypeScript

import { expect, test } from "@playwright/test";
import { installMockBridge } from "../helpers/bridge";
import { openSettings } from "../helpers/settings";
test.beforeEach(async ({ page }) => {
await page.context().grantPermissions(["clipboard-read", "clipboard-write"], {
origin: "http://127.0.0.1:4173",
});
await installMockBridge(page, {
relayRequiresMembership: true,
});
await page.route("**/api/invites", async (route) => {
await route.fulfill({
contentType: "application/json",
json: {
code: "qr-download-test",
expires_at: Math.floor(Date.now() / 1000) + 86_400,
url: "buzz://join?relay=wss%3A%2F%2Frelay.example.com&code=qr-download-test",
},
status: 200,
});
});
});
test("copies a freshly minted invite link without showing a URL or QR code", async ({
page,
}) => {
await page.goto("/");
await openSettings(page, "community-members");
await expect(page.getByTestId("settings-community-members")).toBeVisible();
await page.getByTestId("community-invite-dialog-trigger").click();
await expect(page.getByTestId("invite-link-url")).toHaveCount(0);
await expect(page.getByTestId("invite-link-qr-code")).toHaveCount(0);
await page.getByTestId("copy-invite-link").click();
await expect(page.getByTestId("copy-invite-link")).toContainText("Copied");
const payload = await page.evaluate(() => {
const log = (
window as Window & {
__BUZZ_E2E_COMMAND_LOG__?: Array<{
command: string;
payload: Record<string, unknown> | null;
}>;
}
).__BUZZ_E2E_COMMAND_LOG__;
return log?.findLast(({ command }) => command === "copy_text_to_clipboard")
?.payload;
});
expect(payload).toEqual({
text: "buzz://join?relay=wss%3A%2F%2Frelay.example.com&code=qr-download-test",
});
});