Skip to content

Commit

Permalink
✅ Update PDF generation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
foosel committed Aug 30, 2024
1 parent c80b4d1 commit 3eced9d
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 3 deletions.
Binary file modified tests/files/test-pdf.foldable.border.pdf
Binary file not shown.
Binary file modified tests/files/test-pdf.foldable.horizontal.pdf
Binary file not shown.
Binary file modified tests/files/test-pdf.foldable.mini-cover.pdf
Binary file not shown.
Binary file modified tests/files/test-pdf.foldable.mini-fit.pdf
Binary file not shown.
Binary file modified tests/files/test-pdf.foldable.mini-stretch.pdf
Binary file not shown.
Binary file modified tests/files/test-pdf.foldable.no-rows.pdf
Binary file not shown.
Binary file modified tests/files/test-pdf.foldable.pdf
Binary file not shown.
Binary file modified tests/files/test-pdf.foldable.vertical.pdf
Binary file not shown.
24 changes: 21 additions & 3 deletions tests/specs/generate-pdf.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
const { test, expect } = require('../fixtures');
const ComparePdf = require("compare-pdf");

test.describe.configure({ mode: 'serial' });
//test.describe.configure({ mode: 'serial' });

const comparePdfConfig = {
paths: {
actualPdfRootFolder: process.cwd() + "/data/newActualPdfs",
baselinePdfRootFolder: process.cwd() + "/data/baselinePdfs",
actualPngRootFolder: process.cwd() + "/data/actualPngs",
baselinePngRootFolder: process.cwd() + "/data/baselinePngs",
diffPngRootFolder: process.cwd() + "/data/diffPngs"
},
settings: {
density: 100,
quality: 70,
tolerance: 100,
threshold: 0.05,
cleanPngPaths: false,
matchPageCount: true
}
}

const pdfCompare = async (actual, expected) => {
return await new ComparePdf()
return await new ComparePdf(comparePdfConfig)
.actualPdfFile(actual)
.baselinePdfFile(expected)
.compare();
Expand All @@ -17,7 +35,7 @@ const checkPdf = async (download, expected, testInfo) => {
try {
result = await pdfCompare(await download.path(), expected);
} catch (error) {
result.message = error;
result = { message: error };
}

const actualPath = testInfo.outputPath("test-pdf.foldable.pdf");
Expand Down

0 comments on commit 3eced9d

Please sign in to comment.