Files
dev-desktop/scripts/scenarios/rtf-preview-keeps-named-text-characters.e2e.ts

35 lines
1.4 KiB
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { expect } from "e2e";
import { test, WEB } from "./hanzo.ts";
// Java's RTFEditorKit writing "Account<em space>Name<en space>Jean<nonbreaking hyphen>Luc".
const JDK_RTF = String.raw`{\rtf1\ansi
{\fonttbl\f0\fnil Monospaced;}
Account\emspace Name\enspace Jean\_ Luc\par
}
`;
test(
"An RTF preview keeps the spaces and hyphens written as named control words",
WEB,
async ({ hanzo, app, screen, browser }) => {
const project = await hanzo.project("demo", { "contacts.rtf": JDK_RTF });
const thread = await hanzo.thread({ project, title: "Review contacts", messages: ["Start"] });
await hanzo.open(thread);
await expect(screen.getByText("fixture turn complete", { exact: false })).toBeVisible();
await browser.keyboard.press("Control+p");
await screen.getByPlaceholder("Search files…").fill("contacts.rtf");
await screen.getByRole("option", "contacts.rtf", { exact: false }).tap();
// The first document preview loads its worker, which a cold Vite cache optimizes on demand.
await expect(screen.getByText("1 page", { exact: false })).toBeVisible({ timeout: 120_000 });
const document = browser.frameLocator('iframe[title^="contacts.rtf"]');
const body = document.locator("body");
await expect(body).toContainText("Account");
await app.screenshot("text");
await expect(body).toHaveText("Account Name Jean‑ Luc");
},
);