mirror of
https://github.com/block/buzz.git
synced 2026-10-27 04:30:52 +00:00
Signed-off-by: npub13fn4ahfnvaa2qwylvegdgeajqs0mph6v4qsw4jcqnw4mjh3hzh2quuucm5 <8a675edd33677aa0389f6650d467b2041fb0df4ca820eacb009babb95e3715d4@sprout-oss.stage.blox.sqprod.co> Signed-off-by: Fizz <8a675edd33677aa0389f6650d467b2041fb0df4ca820eacb009babb95e3715d4@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub13fn4ahfnvaa2qwylvegdgeajqs0mph6v4qsw4jcqnw4mjh3hzh2quuucm5 <8a675edd33677aa0389f6650d467b2041fb0df4ca820eacb009babb95e3715d4@sprout-oss.stage.blox.sqprod.co>
74 lines
2.4 KiB
TypeScript
74 lines
2.4 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
import { waitForAnimations } from "../helpers/animations";
|
|
import {
|
|
installMockBridge,
|
|
openNewMessagePage,
|
|
TEST_IDENTITIES,
|
|
} from "../helpers/bridge";
|
|
|
|
const SHOTS = "test-results/dm-new-message";
|
|
|
|
test("captures the new-message loading skeleton", async ({ page }) => {
|
|
await installMockBridge(page, {
|
|
managedAgents: [],
|
|
relayAgents: [],
|
|
userSearchDelayMs: 10_000,
|
|
});
|
|
await page.goto("/");
|
|
await openNewMessagePage(page);
|
|
|
|
const search = page.getByTestId("new-dm-search");
|
|
await search.fill("Alex");
|
|
await expect(search).toHaveValue("Alex");
|
|
await expect(page.getByTestId("new-dm-loading")).toBeVisible();
|
|
await expect(
|
|
page.locator("[data-testid^='new-dm-result-']:visible"),
|
|
).toHaveCount(0);
|
|
|
|
await waitForAnimations(page);
|
|
await page.screenshot({ path: `${SHOTS}/01-search-loading.png` });
|
|
});
|
|
|
|
test("captures selected recipients with the picker open", async ({ page }) => {
|
|
await installMockBridge(page);
|
|
await page.goto("/");
|
|
await openNewMessagePage(page);
|
|
|
|
for (const identity of [TEST_IDENTITIES.charlie, TEST_IDENTITIES.bob]) {
|
|
await page.getByTestId("new-dm-search").fill(identity.username);
|
|
await page.getByTestId(`new-dm-result-${identity.pubkey}`).click();
|
|
}
|
|
|
|
await expect(
|
|
page.locator("button[data-testid^='new-dm-selected-']"),
|
|
).toHaveCount(2);
|
|
const search = page.getByTestId("new-dm-search");
|
|
await search.click();
|
|
await expect(page.getByTestId("new-message-recipient-popover")).toBeVisible();
|
|
|
|
await waitForAnimations(page);
|
|
await expect(page.getByTestId("new-message-recipient-popover")).toBeVisible();
|
|
await page.screenshot({ path: `${SHOTS}/02-selected-recipients.png` });
|
|
});
|
|
|
|
test("captures the enabled first-message composer", async ({ page }) => {
|
|
await installMockBridge(page);
|
|
await page.goto("/");
|
|
await openNewMessagePage(page);
|
|
|
|
await page.getByTestId("new-dm-search").fill("charlie");
|
|
await page
|
|
.getByTestId(`new-dm-result-${TEST_IDENTITIES.charlie.pubkey}`)
|
|
.click();
|
|
await page.getByTestId("new-dm-search").press("Escape");
|
|
await expect(page.getByTestId("new-message-recipient-popover")).toBeHidden();
|
|
await page
|
|
.getByTestId("message-input")
|
|
.fill("Hey Charlie — want to start a new thread?");
|
|
await expect(page.getByTestId("send-message")).toBeEnabled();
|
|
|
|
await waitForAnimations(page);
|
|
await page.screenshot({ path: `${SHOTS}/03-first-message-compose.png` });
|
|
});
|