@progress/kendo-e2e 1.3.0 → 1.4.0

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 CHANGED
@@ -1,6 +1,7 @@
1
1
  export { By, Key, until, WebElement, } from 'selenium-webdriver';
2
2
  export * from './a11y';
3
3
  export * from './components';
4
+ export * from './rendering';
4
5
  export * from './selenium';
5
6
  export * from './settings';
6
7
  export * from './snapshot-markup';
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "until", { enumerable: true, get: function () { r
18
18
  Object.defineProperty(exports, "WebElement", { enumerable: true, get: function () { return selenium_webdriver_1.WebElement; } });
19
19
  __exportStar(require("./a11y"), exports);
20
20
  __exportStar(require("./components"), exports);
21
+ __exportStar(require("./rendering"), exports);
21
22
  __exportStar(require("./selenium"), exports);
22
23
  __exportStar(require("./settings"), exports);
23
24
  __exportStar(require("./snapshot-markup"), exports);
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,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"}
@@ -0,0 +1,20 @@
1
+ declare type CompereOptions = {
2
+ allowMissing?: string[];
3
+ allowExtra?: string[];
4
+ };
5
+ declare type Result = {
6
+ passed: string[];
7
+ missing: string[];
8
+ extra: string[];
9
+ };
10
+ /**
11
+ * Check if two html documents have same class hierarchy.
12
+ *
13
+ * @example
14
+ * await compareHtml("<div class="set">SET</div>", "<div class="qa">QA</div>");
15
+ *
16
+ * @param actualHtml An html object.
17
+ * @param expectedHtml An html object.
18
+ */
19
+ export declare function compareHtml(actualHtml: string, expectedHtml: string, options?: CompereOptions): Result;
20
+ export {};
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.compareHtml = void 0;
7
+ /* eslint-disable prefer-const */
8
+ const sanitize_html_1 = __importDefault(require("sanitize-html"));
9
+ const jsdom_1 = __importDefault(require("jsdom"));
10
+ /**
11
+ * Check if two html documents have same class hierarchy.
12
+ *
13
+ * @example
14
+ * await compareHtml("<div class="set">SET</div>", "<div class="qa">QA</div>");
15
+ *
16
+ * @param actualHtml An html object.
17
+ * @param expectedHtml An html object.
18
+ */
19
+ function compareHtml(actualHtml, expectedHtml, options) {
20
+ const passed = [];
21
+ const missing = [];
22
+ const extra = [];
23
+ const result = { passed, missing, extra };
24
+ const config = {
25
+ allowedTags: false,
26
+ allowVulnerableTags: true,
27
+ allowedAttributes: { "*": ["class"] },
28
+ };
29
+ const actualDom = new jsdom_1.default.JSDOM(sanitize_html_1.default(actualHtml, config)).window.document.documentElement;
30
+ const expectedDom = new jsdom_1.default.JSDOM(sanitize_html_1.default(expectedHtml, config)).window.document.documentElement;
31
+ let actualSelectors = [];
32
+ let parent = "";
33
+ parseDom(actualDom, actualSelectors, parent);
34
+ parent = "";
35
+ let expectedSelectors = [];
36
+ parseDom(expectedDom, expectedSelectors);
37
+ result.passed = actualSelectors.filter((element) => expectedSelectors.includes(element));
38
+ result.extra = actualSelectors.filter((element) => !expectedSelectors.includes(element));
39
+ result.missing = expectedSelectors.filter((element) => !actualSelectors.includes(element));
40
+ if ((options === null || options === void 0 ? void 0 : options.allowExtra) !== undefined) {
41
+ for (const extraItem of options === null || options === void 0 ? void 0 : options.allowExtra) {
42
+ result.extra = result.extra.filter((item) => !item.includes(extraItem));
43
+ }
44
+ }
45
+ if ((options === null || options === void 0 ? void 0 : options.allowMissing) !== undefined) {
46
+ for (const missingItem of options === null || options === void 0 ? void 0 : options.allowMissing) {
47
+ result.missing = result.missing.filter((item) => !item.includes(missingItem));
48
+ }
49
+ }
50
+ return result;
51
+ }
52
+ exports.compareHtml = compareHtml;
53
+ function parseDom(node, attributes, parent = "") {
54
+ if (node === null) {
55
+ return;
56
+ }
57
+ let newParent = parent;
58
+ if (node.attributes[0] !== undefined) {
59
+ attributes.push(`${parent}.${node.attributes[0].value.split(" ").sort().join(".")}`);
60
+ newParent = `${parent}.${node.attributes[0].value.split(" ").sort().join(".")} `;
61
+ }
62
+ parseDom(node.firstElementChild, attributes, newParent);
63
+ parseDom(node.nextElementSibling, attributes, parent);
64
+ }
65
+ //# sourceMappingURL=html-comparer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html-comparer.js","sourceRoot":"","sources":["../../src/rendering/html-comparer.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAiC;AACjC,kEAAyC;AACzC,kDAA0B;AAa1B;;;;;;;;GAQG;AACH,SAAgB,WAAW,CAAC,UAAkB,EAAE,YAAoB,EAAE,OAAwB;IAC1F,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAW,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAElD,MAAM,MAAM,GAAG;QACX,WAAW,EAAE,KAAK;QAClB,mBAAmB,EAAE,IAAI;QAC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AC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const specToHtml: (specFile: any, options?: {}) => any;
2
+ export { compareHtml } from "./html-comparer";
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.compareHtml = exports.specToHtml = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const server_1 = __importDefault(require("react-dom/server"));
9
+ const specToHtml = (specFile, options = {}) => {
10
+ return server_1.default.renderToStaticMarkup(react_1.default.createElement(specFile, options));
11
+ };
12
+ exports.specToHtml = specToHtml;
13
+ var html_comparer_1 = require("./html-comparer");
14
+ Object.defineProperty(exports, "compareHtml", { enumerable: true, get: function () { return html_comparer_1.compareHtml; } });
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rendering/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,8DAAwC;AAEjC,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE;IACjD,OAAO,gBAAQ,CAAC,oBAAoB,CAChC,eAAK,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CACzC,CAAC;AACN,CAAC,CAAC;AAJW,QAAA,UAAU,cAIrB;AAEF,iDAA8C;AAArC,4GAAA,WAAW,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-e2e",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Kendo UI end-to-end test utilities.",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -12,6 +12,7 @@
12
12
  "build": "npm run lint && npx tsc",
13
13
  "test:a11y": "npx jest tests/a11y",
14
14
  "test:e2e": "npx jest tests/e2e",
15
+ "test:rendering": "npx jest tests/rendering",
15
16
  "test:visual": "npx jest tests/visual",
16
17
  "semantic-release": "semantic-release pre && semantic-prerelease publish --public && semantic-release post"
17
18
  },
@@ -59,12 +60,16 @@
59
60
  "jsdom": "^16.7.0",
60
61
  "looks-same": "^7.3.0",
61
62
  "pngjs": "^6.0.0",
63
+ "react": "^18.2.0",
64
+ "react-dom": "^18.2.0",
65
+ "sanitize-html": "^2.10.0",
62
66
  "selenium-webdriver": "4.8.2"
63
67
  },
64
68
  "devDependencies": {
65
69
  "@commitlint/cli": "^17.0.3",
66
70
  "@commitlint/config-conventional": "^17.0.3",
67
71
  "@progress/kendo-common-tasks": "^8.0.2",
72
+ "@progress/kendo-themes-html": "^6.4.0",
68
73
  "@progress/semantic-prerelease": "^3.0.2",
69
74
  "@types/jest": "^28.1.6",
70
75
  "@types/node": "ts4.3",