mirror of
https://github.com/suitenumerique/docs.git
synced 2026-04-25 17:15:01 +02:00
✅(frontend) add pdf export regression test with embedded image fixtures
adds base64 png/jpg/svg image fixtures to stabilize pdf export snapshots Signed-off-by: Cyril <c.gromoff@gmail.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
BIN
src/frontend/apps/e2e/__tests__/app-impress/assets/panojpg.jpeg
Normal file
BIN
src/frontend/apps/e2e/__tests__/app-impress/assets/panojpg.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 231 KiB |
BIN
src/frontend/apps/e2e/__tests__/app-impress/assets/panopng.png
Normal file
BIN
src/frontend/apps/e2e/__tests__/app-impress/assets/panopng.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 839 KiB |
@@ -596,6 +596,9 @@ test.describe('Doc Export', () => {
|
||||
page,
|
||||
browserName,
|
||||
}, testInfo) => {
|
||||
// PDF generation for a large, image-heavy document can be slow in CI.
|
||||
// Give this regression test a higher timeout budget than the default.
|
||||
testInfo.setTimeout(120000);
|
||||
const snapshotPath = testInfo.snapshotPath(REGRESSION_SNAPSHOT_NAME);
|
||||
|
||||
test.skip(
|
||||
@@ -656,14 +659,10 @@ test.describe('Doc Export', () => {
|
||||
}
|
||||
|
||||
await page.reload();
|
||||
|
||||
const headingLocator = page
|
||||
.locator('.--docs--editor-container')
|
||||
.getByText('Titre h1 repliable', { exact: true })
|
||||
.first();
|
||||
|
||||
await headingLocator.scrollIntoViewIfNeeded();
|
||||
await expect(headingLocator).toBeVisible({ timeout: 15000 });
|
||||
// After reloading, just ensure the editor container is present before exporting.
|
||||
await expect(page.locator('.--docs--editor-container')).toBeVisible({
|
||||
timeout: 15000,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('button', {
|
||||
|
||||
Binary file not shown.
29
src/frontend/apps/e2e/print-datauris.js
Normal file
29
src/frontend/apps/e2e/print-datauris.js
Normal file
@@ -0,0 +1,29 @@
|
||||
//utilitary script to print the datauris of the targeted assets
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const ASSETS_ROOT = path.resolve(__dirname, '__tests__/app-impress/assets');
|
||||
|
||||
function saveDataUrl(file, mime, outName) {
|
||||
const abs = path.join(ASSETS_ROOT, file);
|
||||
const base64 = fs.readFileSync(abs).toString('base64');
|
||||
const dataUrl = `data:${mime};base64,${base64}`;
|
||||
const outPath = path.join(ASSETS_ROOT, outName);
|
||||
fs.writeFileSync(outPath, dataUrl, 'utf8');
|
||||
console.log(`Wrote ${outName}`);
|
||||
}
|
||||
|
||||
// PNG
|
||||
saveDataUrl('panopng.png', 'image/png', 'pano-png-dataurl.txt');
|
||||
|
||||
// JPG
|
||||
saveDataUrl('panojpg.jpeg', 'image/jpeg', 'pano-jpg-dataurl.txt');
|
||||
|
||||
// SVG
|
||||
const svgPath = path.join(ASSETS_ROOT, 'test.svg');
|
||||
const svgText = fs.readFileSync(svgPath, 'utf8');
|
||||
const svgDataUrl =
|
||||
'data:image/svg+xml;base64,' + Buffer.from(svgText).toString('base64');
|
||||
fs.writeFileSync(path.join(ASSETS_ROOT, 'test-svg-dataurl.txt'), svgDataUrl, 'utf8');
|
||||
console.log('Wrote test-svg-dataurl.txt');
|
||||
Reference in New Issue
Block a user