fix: remeasure composer after hidden Core becomes visible

This commit is contained in:
Codex
2026-09-13 01:39:19 +02:00
parent 8c81996896
commit 803e9e9201
4 changed files with 88 additions and 4 deletions
+44
View File
@@ -90,6 +90,50 @@ async function inspect(page: Page) {
});
}
for (const route of ["/", "/?thoth_route=administration%2Fdatabase"]) {
test(`Core prompt remains readable after loading ${route}`, async ({ page }, testInfo) => {
const writes = await fixtures(page);
await page.goto(route);
if (route !== "/") {
await navigation(page);
await page.getByRole("button", { name: "Return to session", exact: true }).click();
}
const prompt = page.getByRole("textbox", { name: "New question", exact: true });
await expect(prompt).toBeVisible();
await prompt.focus();
const readable = async () => {
await expect.poll(() => prompt.evaluate(el => {
const style = getComputedStyle(el);
return el.clientHeight >= parseFloat(style.lineHeight) + parseFloat(style.paddingTop) + parseFloat(style.paddingBottom);
})).toBe(true);
};
await readable();
await expect(prompt).toHaveCSS("outline-style", "none");
await page.screenshot({ path: testInfo.outputPath("Prompt-focused.png") });
await prompt.fill("First line");
await prompt.press("Shift+Enter");
await prompt.press("a");
await expect(prompt).toHaveValue("First line\na");
await expect.poll(() => prompt.evaluate(el => el.clientHeight)).toBeGreaterThan(40);
const question = "Compare eligible patients across the available cohorts. ".repeat(30);
await prompt.fill(question);
await page.setViewportSize({ width: 390, height: 900 });
await readable();
await expect.poll(() => prompt.evaluate(el => el.clientHeight)).toBe(160);
expect(await prompt.evaluate(el => el.scrollHeight > el.clientHeight)).toBe(true);
await admin(page, "Database");
await navigation(page);
await page.getByRole("button", { name: "Return to session", exact: true }).click();
await expect(prompt).toHaveValue(question);
await readable();
await page.screenshot({ path: testInfo.outputPath("Prompt-multiline-mobile.png") });
await prompt.fill("");
await readable();
await expect.poll(() => prompt.evaluate(el => el.clientHeight)).toBeLessThanOrEqual(40);
expect(writes).toEqual([]);
});
}
for (const width of [390, 649, 768, 1280, 1600]) {
test(`all surfaces retain shared typography at ${width}px`, async ({ page }, testInfo) => {
await page.setViewportSize({ width, height: 1000 });