The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { expect } from "e2e"; |
| 2 | import JSZip from "jszip"; |
| 3 | |
| 4 | import { test, WEB } from "./t3.ts"; |
| 5 | |
| 6 | // A 2 by 2 table stored the compact way ODF allows: one row repeated twice, one cell repeated twice. |
| 7 | async function repeatedTableOdt() { |
| 8 | const cell = |
| 9 | '<table:table-cell table:number-columns-repeated="2"><text:p>Approved</text:p></table:table-cell>'; |
| 10 | return new JSZip() |
| 11 | .file("mimetype", "application/vnd.oasis.opendocument.text", { compression: "STORE" }) |
| 12 | .file( |
| 13 | "content.xml", |
| 14 | `<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" office:version="1.3"><office:body><office:text><table:table table:name="Decisions"><table:table-column table:number-columns-repeated="2"/><table:table-row table:number-rows-repeated="2">${cell}</table:table-row></table:table></office:text></office:body></office:document-content>`, |
| 15 | ) |
| 16 | .generateAsync({ type: "uint8array" }); |
| 17 | } |
| 18 | |
| 19 | test( |
| 20 | "An ODT preview shows every cell of a table stored with repeated rows and cells", |
| 21 | WEB, |
| 22 | async ({ t3, app, screen, browser }) => { |
| 23 | const project = await t3.project("demo", { "decisions.odt": await repeatedTableOdt() }); |
| 24 | const thread = await t3.thread({ project, title: "Review decisions", messages: ["Start"] }); |
| 25 | await t3.open(thread); |
| 26 | await expect(screen.getByText("fixture turn complete", { exact: false })).toBeVisible(); |
| 27 | |
| 28 | await browser.keyboard.press("Control+p"); |
| 29 | await screen.getByPlaceholder("Search files…").fill("decisions.odt"); |
| 30 | await screen.getByRole("option", "decisions.odt", { exact: false }).tap(); |
| 31 | |
| 32 | // The first document preview loads its worker, which a cold Vite cache optimizes on demand. |
| 33 | await expect(screen.getByText("1 page", { exact: false })).toBeVisible({ timeout: 120_000 }); |
| 34 | const document = browser.frameLocator('iframe[title^="decisions.odt"]'); |
| 35 | await expect(document.getByRole("cell", "Approved").first()).toBeVisible(); |
| 36 | await app.screenshot("table"); |
| 37 | await expect(document.getByRole("cell", "Approved")).toHaveCount(4); |
| 38 | }, |
| 39 | ); |