Skip to content

Commit e76457b

Browse files
committed
test: add integration test for TIFF image loading pipeline
Adds a Playwright test that loads a minimal DOCX containing a TIFF image and verifies the full pipeline: DocxZipper β†’ convertTiffToPng β†’ rendered PNG.
1 parent eeafd64 commit e76457b

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

3.82 KB
Binary file not shown.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import path from 'node:path';
2+
import { fileURLToPath } from 'node:url';
3+
import { test, expect } from '../../fixtures/superdoc.js';
4+
import { assertDocumentApiReady, getDocumentText } from '../../helpers/document-api.js';
5+
6+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
7+
const DOC_PATH = path.resolve(__dirname, 'fixtures/tiff-image.docx');
8+
9+
test.use({ config: { toolbar: 'full', comments: 'off' } });
10+
11+
test('loads DOCX with TIFF image and renders it as PNG', async ({ superdoc }) => {
12+
await superdoc.loadDocument(DOC_PATH);
13+
await superdoc.waitForStable();
14+
await assertDocumentApiReady(superdoc.page);
15+
16+
// Document text is present
17+
const text = await getDocumentText(superdoc.page);
18+
expect(text).toContain('TIFF test document');
19+
20+
// Editor is functional β€” pages and lines rendered
21+
await expect(superdoc.page.locator('.superdoc-page').first()).toBeVisible();
22+
await expect(superdoc.page.locator('.superdoc-line').first()).toBeVisible();
23+
24+
// The TIFF was converted to PNG β€” the rendered <img> should have a PNG data URI
25+
const imgSrc = await superdoc.page.locator('img').first().getAttribute('src');
26+
expect(imgSrc).toBeTruthy();
27+
expect(imgSrc).toContain('data:image/png');
28+
});

0 commit comments

Comments
Β (0)