@progress/kendo-e2e 4.2.2 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/excel.d.ts +6 -0
- package/dist/utils/excel.js +115 -0
- package/dist/utils/excel.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -27,4 +27,5 @@ __exportStar(require("./selenium"), exports);
|
|
|
27
27
|
__exportStar(require("./settings"), exports);
|
|
28
28
|
__exportStar(require("./snapshot-markup"), exports);
|
|
29
29
|
__exportStar(require("./snapshot-image/snapshot-image"), exports);
|
|
30
|
+
__exportStar(require("./utils"), exports);
|
|
30
31
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAiE;AAAxD,wGAAA,EAAE,OAAA;AAAE,yGAAA,GAAG,OAAA;AAAE,2GAAA,KAAK,OAAA;AAAE,gHAAA,UAAU,OAAA;AACnC,yCAAuB;AACvB,+CAA6B;AAC7B,8CAA4B;AAC5B,6CAA2B;AAC3B,6CAA2B;AAC3B,oDAAkC;AAClC,kEAAgD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAiE;AAAxD,wGAAA,EAAE,OAAA;AAAE,yGAAA,GAAG,OAAA;AAAE,2GAAA,KAAK,OAAA;AAAE,gHAAA,UAAU,OAAA;AACnC,yCAAuB;AACvB,+CAA6B;AAC7B,8CAA4B;AAC5B,6CAA2B;AAC3B,6CAA2B;AAC3B,oDAAkC;AAClC,kEAAgD;AAChD,0CAAwB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main function to extract, convert, and compare the content of two .xlsx files.
|
|
3
|
+
* @param {string} filePath1 - Path to the first .xlsx file.
|
|
4
|
+
* @param {string} filePath2 - Path to the second .xlsx file.
|
|
5
|
+
*/
|
|
6
|
+
export declare function matchXLSXFiles(filePath1: any, filePath2: any): Promise<boolean>;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.matchXLSXFiles = void 0;
|
|
16
|
+
const yauzl_1 = __importDefault(require("yauzl"));
|
|
17
|
+
/**
|
|
18
|
+
* Extracts the content of all files in an .xlsx file except those in the `docProps` folder as Buffers.
|
|
19
|
+
* @param {string} xlsxFilePath - Path to the .xlsx file.
|
|
20
|
+
* @returns {Promise<Object>} - A promise that resolves to an object with file names as keys and their data as Buffer values.
|
|
21
|
+
*/
|
|
22
|
+
function extractAllContentExceptDocProps(xlsxFilePath) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
yauzl_1.default.open(xlsxFilePath, { lazyEntries: true }, (err, zipfile) => {
|
|
26
|
+
if (err) {
|
|
27
|
+
reject(err);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const fileBuffers = {}; // Store file contents as key-value pairs
|
|
31
|
+
zipfile.on('entry', (entry) => {
|
|
32
|
+
// Exclude files in the `docProps` folder
|
|
33
|
+
if (!entry.fileName.startsWith('docProps')) {
|
|
34
|
+
let fileBuffer = Buffer.alloc(0); // Start with an empty buffer
|
|
35
|
+
zipfile.openReadStream(entry, (err, readStream) => {
|
|
36
|
+
if (err) {
|
|
37
|
+
reject(err);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
readStream.on('data', (chunk) => {
|
|
41
|
+
fileBuffer = Buffer.concat([fileBuffer, chunk]);
|
|
42
|
+
});
|
|
43
|
+
readStream.on('end', () => {
|
|
44
|
+
fileBuffers[entry.fileName] = fileBuffer; // Save buffer with the file name as key
|
|
45
|
+
zipfile.readEntry(); // Continue to the next entry
|
|
46
|
+
});
|
|
47
|
+
readStream.on('error', (err) => {
|
|
48
|
+
reject(err);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
zipfile.readEntry(); // Skip entries in `docProps` and continue
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
zipfile.on('end', () => {
|
|
57
|
+
resolve(fileBuffers); // Resolve with the collected file buffers
|
|
58
|
+
});
|
|
59
|
+
zipfile.on('error', (err) => {
|
|
60
|
+
reject(err);
|
|
61
|
+
});
|
|
62
|
+
zipfile.readEntry(); // Start reading entries
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Compare the extracted content of two .xlsx files.
|
|
69
|
+
* @param {Object} fileContents1 - Extracted content of the first file as an object.
|
|
70
|
+
* @param {Object} fileContents2 - Extracted content of the second file as an object.
|
|
71
|
+
* @returns {boolean} - True if all files' contents are the same, false otherwise.
|
|
72
|
+
*/
|
|
73
|
+
function compareFileContents(fileContents1, fileContents2) {
|
|
74
|
+
const fileNames1 = Object.keys(fileContents1);
|
|
75
|
+
const fileNames2 = Object.keys(fileContents2);
|
|
76
|
+
// Compare the sets of file names
|
|
77
|
+
if (fileNames1.length !== fileNames2.length || !fileNames1.every((name) => fileNames2.includes(name))) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
// Compare the content of each file
|
|
81
|
+
for (const fileName of fileNames1) {
|
|
82
|
+
if (!fileContents1[fileName].equals(fileContents2[fileName])) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Main function to extract, convert, and compare the content of two .xlsx files.
|
|
90
|
+
* @param {string} filePath1 - Path to the first .xlsx file.
|
|
91
|
+
* @param {string} filePath2 - Path to the second .xlsx file.
|
|
92
|
+
*/
|
|
93
|
+
function matchXLSXFiles(filePath1, filePath2) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
try {
|
|
96
|
+
// Extract content from both files
|
|
97
|
+
const fileContents1 = yield extractAllContentExceptDocProps(filePath1);
|
|
98
|
+
const fileContents2 = yield extractAllContentExceptDocProps(filePath2);
|
|
99
|
+
// Compare the extracted content
|
|
100
|
+
if (compareFileContents(fileContents1, fileContents2)) {
|
|
101
|
+
console.log(`The contents of the files are the same.`);
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
console.log(`The contents of the files are different.`);
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
throw new Error(`Error: ${error}`);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
exports.matchXLSXFiles = matchXLSXFiles;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AAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,EAAE;YAC1D,OAAO,KAAK,CAAC;SAChB;KACJ;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,SAAsB,cAAc,CAAC,SAAS,EAAE,SAAS;;QACrD,IAAI;YACA,kCAAkC;YAClC,MAAM,aAAa,GAAG,MAAM,+BAA+B,CAAC,SAAS,CAAC,CAAC;YACvE,MAAM,aAAa,GAAG,MAAM,+BAA+B,CAAC,SAAS,CAAC,CAAC;YAEvE,gCAAgC;YAChC,IAAI,mBAAmB,CAAC,aAAa,EAAE,aAAa,CAAC,EAAE;gBACnD,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;gBACvD,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;gBACxD,OAAO,KAAK,CAAC;aAChB;SACJ;QAAC,OAAO,KAAK,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC;SACtC;IACL,CAAC;CAAA;AAjBD,wCAiBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { matchXLSXFiles } from './excel';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.matchXLSXFiles = void 0;
|
|
4
|
+
var excel_1 = require("./excel");
|
|
5
|
+
Object.defineProperty(exports, "matchXLSXFiles", { enumerable: true, get: function () { return excel_1.matchXLSXFiles; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,iCAAyC;AAAhC,uGAAA,cAAc,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-e2e",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"description": "Kendo UI end-to-end test utilities.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"test:components": "npx jest tests/components",
|
|
18
18
|
"test:e2e": "npx jest tests/e2e",
|
|
19
19
|
"test:rendering": "npx jest tests/rendering",
|
|
20
|
+
"test:utils": "npx jest tests/utils/**/*.tests.ts",
|
|
20
21
|
"test:visual": "npx jest tests/visual",
|
|
21
22
|
"test:snapshot": "cd tests/snapshot-cli && chmod +x run.sh && ./run.sh",
|
|
22
23
|
"semantic-release": "semantic-release"
|
|
@@ -70,7 +71,8 @@
|
|
|
70
71
|
"rgb2hex": "^0.2.5",
|
|
71
72
|
"sanitize-html": "^2.10.0",
|
|
72
73
|
"selenium-webdriver": "4.27.0",
|
|
73
|
-
"sharp": "^0.33.0"
|
|
74
|
+
"sharp": "^0.33.0",
|
|
75
|
+
"yauzl": "^3.2.0"
|
|
74
76
|
},
|
|
75
77
|
"devDependencies": {
|
|
76
78
|
"@commitlint/cli": "^17.6.6",
|