* perf(app): bound large diff row mounting Keep the existing vertical and horizontal scroll owners so virtualization does not change gesture or scrolling behavior. Reserve exact offscreen row heights while mounting only the visible window, and retain the full renderer when wrapping or editing reviews requires dynamic geometry. * perf(app): keep large diff reviews responsive Opening an inline editor changed the whole review action object, reconciled large syntax-token trees, and disabled row virtualization. Keep the expensive token subtree stable and preserve deterministic row geometry while the editor is open.\n\nBound server-side highlighting for pathological single lines and remove the unused client highlighter so the actual diff pipeline owns the limit. * test(app): check mounted diff typography Row virtualization can unmount a fixed diff row after scrolling. Assert the configured font size against a currently mounted row so the test continues to verify rendered typography without depending on window position. * test(app): stabilize Mermaid streaming coverage
49 lines
1.7 KiB
TypeScript
49 lines
1.7 KiB
TypeScript
import { expect, type Page } from "@playwright/test";
|
|
import type { MockAgentWorkspace } from "./mock-agent";
|
|
|
|
const DIAGRAM_NAME = "Diagram";
|
|
|
|
function renderedDiagram(page: Page) {
|
|
const diagram = page.getByRole("img", { name: DIAGRAM_NAME }).last();
|
|
const svg = diagram.locator("iframe").contentFrame().locator("#diagram svg");
|
|
return { diagram, svg };
|
|
}
|
|
|
|
export async function requestDiagram(agent: MockAgentWorkspace): Promise<void> {
|
|
await agent.client.sendAgentMessage(agent.agentId, "Render the requested Mermaid diagram.");
|
|
}
|
|
|
|
export async function expectDiagramWithLabels(
|
|
page: Page,
|
|
labels: readonly string[],
|
|
): Promise<void> {
|
|
const { diagram, svg } = renderedDiagram(page);
|
|
await expect(diagram).toBeVisible({ timeout: 30_000 });
|
|
await expect(svg).toBeVisible({ timeout: 30_000 });
|
|
for (const label of labels) {
|
|
await expect(svg).toContainText(label);
|
|
}
|
|
}
|
|
|
|
export async function expectDiagramRemainsRenderedWhileStreaming(page: Page): Promise<void> {
|
|
const { diagram, svg } = renderedDiagram(page);
|
|
const samples = 80;
|
|
for (let sample = 0; sample < samples; sample += 1) {
|
|
await expect(diagram).toBeVisible({ timeout: 100 });
|
|
await expect(svg).toBeVisible({ timeout: 500 });
|
|
await page.waitForTimeout(25);
|
|
}
|
|
}
|
|
|
|
export async function waitForDiagramTurnToComplete(agent: MockAgentWorkspace): Promise<void> {
|
|
await agent.client.waitForFinish(agent.agentId, 30_000);
|
|
}
|
|
|
|
export async function expectCompletedDiagram(page: Page, labels: readonly string[]): Promise<void> {
|
|
await expectDiagramWithLabels(page, labels);
|
|
}
|
|
|
|
export async function reloadConversation(page: Page): Promise<void> {
|
|
await page.reload({ waitUntil: "domcontentloaded" });
|
|
}
|