Skip to content

Commit ec0f016

Browse files
authored
Merge pull request #7191 from Countly/update-pdfjs-dist-package-in-ui-test
[QA] Update latest version of pdfjs-dist package in ui-test
2 parents 62feb45 + 6e5a15f commit ec0f016

3 files changed

Lines changed: 280 additions & 667 deletions

File tree

ui-tests/cypress.config.sample.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
// Define missing DOMMatrix in Node context (for pdfjs)
2+
if (typeof global.DOMMatrix === "undefined") {
3+
global.DOMMatrix = class DOMMatrix { };
4+
}
5+
16
const { defineConfig } = require("cypress");
27
const fs = require("fs");
38
const path = require("path");
4-
const pdfjsLib = require("pdfjs-dist/legacy/build/pdf.js");
9+
const pdfjsLib = require("pdfjs-dist/legacy/build/pdf.mjs");
510
const { PNG } = require("pngjs");
611
const sharp = require("sharp");
712

8-
// Define missing DOMMatrix in Node context (for pdfjs)
9-
if (typeof global.DOMMatrix === "undefined") {
10-
global.DOMMatrix = class DOMMatrix { };
11-
}
13+
1214

1315
module.exports = defineConfig({
1416
e2e: {
@@ -69,7 +71,15 @@ module.exports = defineConfig({
6971

7072
if (doLogoCheck && args[0]) {
7173
const objName = args[0];
72-
const imgData = await page.objs.get(objName);
74+
const imgData = await new Promise((resolve) => {
75+
try {
76+
page.objs.get(objName, (data) => resolve(data));
77+
}
78+
catch (e) {
79+
resolve(null);
80+
}
81+
});
82+
7383
if (!imgData) {
7484
continue;
7585
}

0 commit comments

Comments
 (0)