9dfa06ffee
Docker image / Build (linux/amd64) (push) Has been cancelled
Docker image / Build (linux/arm64) (push) Has been cancelled
Docker image / Merge release multi-arch manifest (push) Has been cancelled
Docker image / Merge debug multi-arch manifest (push) Has been cancelled
Docker image / Build public push gateway (linux/amd64) (push) Has been cancelled
Docker image / Build public push gateway (linux/arm64) (push) Has been cancelled
Docker image / Publish public push gateway image (push) Has been cancelled
Sprig image / Build (linux/amd64) (push) Has been cancelled
Sprig image / Build (linux/arm64) (push) Has been cancelled
Sprig image / Merge multi-arch manifest (push) Has been cancelled
Harbor Buzz Orchestra / Python tests and lint (push) Has been cancelled
CI / Detect Changed Paths (push) Has been cancelled
CI / Rust Lint (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Desktop Core (push) Has been cancelled
CI / Desktop Smoke E2E (1) (push) Has been cancelled
CI / Desktop Smoke E2E (2) (push) Has been cancelled
CI / Desktop Smoke E2E (3) (push) Has been cancelled
CI / Desktop Smoke E2E (4) (push) Has been cancelled
CI / Desktop (push) Has been cancelled
CI / Desktop E2E Relay (push) Has been cancelled
CI / Desktop E2E Integration (1/2) (push) Has been cancelled
CI / Desktop E2E Integration (2/2) (push) Has been cancelled
CI / Desktop E2E Integration (push) Has been cancelled
CI / Backend Integration (relay e2e) (push) Has been cancelled
CI / Relay E2E (push) Has been cancelled
CI / Web (push) Has been cancelled
CI / Mobile (push) Has been cancelled
CI / Security (push) Has been cancelled
CI / Dead Token Reference Guard (push) Has been cancelled
CI / Server Cross-Compile (aarch64-unknown-linux-musl) (push) Has been cancelled
CI / Server Cross-Compile (x86_64-unknown-linux-musl) (push) Has been cancelled
CI / Windows Rust (x86_64-pc-windows-msvc) (push) Has been cancelled
CI / Desktop Build (macOS) (push) Has been cancelled
helm chart / lint + unittest + render matrix (push) Has been cancelled
helm chart / install on kind (gated) (push) Has been cancelled
helm chart / publish chart to GHCR (push) Has been cancelled
Mesh Lifecycle / Relay-Driven Mesh Lifecycle Smoke (push) Has been cancelled
Sprig / Build (aarch64-unknown-linux-musl) (push) Has been cancelled
Sprig / Build (x86_64-unknown-linux-musl) (push) Has been cancelled
Sprig / Publish rolling release (push) Has been cancelled
Sprig / Publish tagged release (push) Has been cancelled
Signed-off-by: cls_宁波本机 <908705107@qq.com>
117 lines
3.9 KiB
TypeScript
117 lines
3.9 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
import { installMockBridge } from "../helpers/bridge";
|
|
|
|
const SHORTCODE = "buzz";
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
await installMockBridge(page);
|
|
// The mock emoji sets point at example.com placeholder URLs that don't
|
|
// resolve, so the <img> would render broken. Serve a visible square glyph
|
|
// for any example.com emoji image so sizing/alignment can be asserted.
|
|
const SVG = `
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
|
<rect width="32" height="32" rx="7" fill="#22c55e"/>
|
|
<circle cx="16" cy="12" r="5" fill="#fef3c7"/>
|
|
<path d="M8 25c2-7 14-7 16 0" fill="#fef3c7"/>
|
|
</svg>`;
|
|
await page.route("https://example.com/e2e/**", (route) =>
|
|
route.fulfill({ contentType: "image/svg+xml", body: SVG }),
|
|
);
|
|
});
|
|
|
|
test("composer renders a custom emoji inline", async ({ page }) => {
|
|
await page.goto("/");
|
|
await page.getByTestId("channel-general").click();
|
|
await expect(page.getByTestId("chat-title")).toHaveText("general");
|
|
|
|
const input = page.getByTestId("message-input");
|
|
await input.click();
|
|
await input.pressSequentially(`shipping it :${SHORTCODE}:`);
|
|
await expect(input.locator("img[data-custom-emoji]")).toHaveCount(1);
|
|
});
|
|
|
|
test("settings card splits My emoji from read-only Community emoji", async ({
|
|
page,
|
|
}) => {
|
|
await page.goto("/");
|
|
await page.getByTestId("open-settings").click();
|
|
await page.getByTestId("profile-popover-settings").click();
|
|
await expect(page.getByTestId("settings-view")).toBeVisible();
|
|
await page.getByTestId("settings-nav-custom-emoji").click();
|
|
|
|
// The mock identity owns :buzz: (removable); :narf: belongs to another
|
|
// member (read-only, no trash button).
|
|
const card = page.getByTestId("settings-custom-emoji");
|
|
await expect(card.getByTestId("custom-emoji-mine")).toContainText(":buzz:");
|
|
const mine = card.getByTestId("custom-emoji-mine");
|
|
await expect(
|
|
mine.getByRole("button", { name: "Remove :buzz:" }),
|
|
).toBeVisible();
|
|
|
|
const community = card.getByTestId("custom-emoji-community");
|
|
await expect(community).toContainText(":narf:");
|
|
// No remove button for someone else's emoji.
|
|
await expect(
|
|
community.getByRole("button", { name: /^Remove :/ }),
|
|
).toHaveCount(0);
|
|
});
|
|
|
|
test("message list renders inline and emoji-only messages with Slack-style emoji sizing", async ({
|
|
page,
|
|
}) => {
|
|
await page.goto("/");
|
|
await page.getByTestId("channel-general").click();
|
|
await expect(page.getByTestId("chat-title")).toHaveText("general");
|
|
|
|
const input = page.getByTestId("message-input");
|
|
|
|
await input.click();
|
|
await input.pressSequentially(`inline :${SHORTCODE}: message`);
|
|
await page.getByTestId("send-message").click();
|
|
|
|
await input.click();
|
|
await input.pressSequentially(`:${SHORTCODE}: 😀 ❤️`);
|
|
await page.getByTestId("send-message").click();
|
|
|
|
const rows = page.getByTestId("message-row");
|
|
const inlineRow = rows
|
|
.filter({
|
|
has: page.locator(`img[data-custom-emoji][alt=":${SHORTCODE}:"]`),
|
|
hasText: "inline message",
|
|
})
|
|
.last();
|
|
const emojiOnlyRow = rows
|
|
.filter({
|
|
has: page.locator(`img[data-custom-emoji][alt=":${SHORTCODE}:"]`),
|
|
hasText: "😀 ❤️",
|
|
})
|
|
.first();
|
|
|
|
await expect(inlineRow).toBeVisible();
|
|
await expect(emojiOnlyRow).toBeVisible();
|
|
|
|
const inlineEmoji = inlineRow.locator(
|
|
`img[data-custom-emoji][alt=":${SHORTCODE}:"]`,
|
|
);
|
|
const emojiOnlyEmoji = emojiOnlyRow.locator(
|
|
`img[data-custom-emoji][alt=":${SHORTCODE}:"]`,
|
|
);
|
|
|
|
await expect
|
|
.poll(async () => (await inlineEmoji.boundingBox())?.height ?? 0)
|
|
.toBeGreaterThan(10);
|
|
await expect
|
|
.poll(async () => {
|
|
const inlineBox = await inlineEmoji.boundingBox();
|
|
const emojiOnlyBox = await emojiOnlyEmoji.boundingBox();
|
|
|
|
if (!inlineBox || !emojiOnlyBox || inlineBox.height === 0) {
|
|
return 0;
|
|
}
|
|
|
|
return emojiOnlyBox.height / inlineBox.height;
|
|
})
|
|
.toBeGreaterThan(1.8);
|
|
});
|