@applitools/core 4.24.0 → 4.24.2
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/CHANGELOG.md +75 -0
- package/dist/classic/utils/take-screenshots.js +4 -1
- package/dist/open-eyes.js +4 -5
- package/dist/ufg/take-snapshots.js +1 -0
- package/dist/ufg/utils/to-generated-selectors.js +31 -6
- package/package.json +12 -12
- package/types/ufg/types.d.ts +3 -1
- package/types/ufg/utils/take-dom-snapshot.d.ts +3 -1
- package/types/ufg/utils/to-generated-selectors.d.ts +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,80 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.24.2](https://github.com/Applitools-Dev/sdk/compare/js/core@4.24.1...js/core@4.24.2) (2024-11-27)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* don't populate branchName and parentBranchName when scm integration exists ([#2634](https://github.com/Applitools-Dev/sdk/issues/2634)) ([e45d671](https://github.com/Applitools-Dev/sdk/commit/e45d671e11ed40a82de1bd5ab22e757aff00b63f))
|
|
9
|
+
* enhance error logging in takeScreenshots and pollify functions ([#2644](https://github.com/Applitools-Dev/sdk/issues/2644)) ([2428fa5](https://github.com/Applitools-Dev/sdk/commit/2428fa500a9fd47a803aa5aca9f79e5c5b3584f9))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Dependencies
|
|
13
|
+
|
|
14
|
+
* @applitools/dom-shared bumped to 1.0.16
|
|
15
|
+
#### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* enhance error logging in takeScreenshots and pollify functions ([#2644](https://github.com/Applitools-Dev/sdk/issues/2644)) ([2428fa5](https://github.com/Applitools-Dev/sdk/commit/2428fa500a9fd47a803aa5aca9f79e5c5b3584f9))
|
|
18
|
+
* @applitools/dom-snapshot bumped to 4.11.11
|
|
19
|
+
|
|
20
|
+
* @applitools/req bumped to 1.7.4
|
|
21
|
+
#### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* set heartbeat request timeout as the request interval ([#2587](https://github.com/Applitools-Dev/sdk/issues/2587)) ([0251d27](https://github.com/Applitools-Dev/sdk/commit/0251d27d9ed44ec247732f66904ae3d4fa4123f1))
|
|
24
|
+
* @applitools/dom-capture bumped to 11.5.2
|
|
25
|
+
|
|
26
|
+
* @applitools/nml-client bumped to 1.8.19
|
|
27
|
+
|
|
28
|
+
* @applitools/tunnel-client bumped to 1.5.10
|
|
29
|
+
|
|
30
|
+
* @applitools/ufg-client bumped to 1.14.1
|
|
31
|
+
|
|
32
|
+
* @applitools/core-base bumped to 1.19.3
|
|
33
|
+
#### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* set heartbeat request timeout as the request interval ([#2587](https://github.com/Applitools-Dev/sdk/issues/2587)) ([0251d27](https://github.com/Applitools-Dev/sdk/commit/0251d27d9ed44ec247732f66904ae3d4fa4123f1))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
* @applitools/ec-client bumped to 1.9.15
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## [4.24.1](https://github.com/Applitools-Dev/sdk/compare/js/core@4.24.0...js/core@4.24.1) (2024-11-14)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
* don't throw error on stale/missing non-target regions ([#2598](https://github.com/Applitools-Dev/sdk/issues/2598)) ([ae39ad9](https://github.com/Applitools-Dev/sdk/commit/ae39ad9fdb129a3f987ee5076660071b66dc1342))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### Dependencies
|
|
51
|
+
|
|
52
|
+
* @applitools/dom-snapshot bumped to 4.11.10
|
|
53
|
+
#### Bug Fixes
|
|
54
|
+
|
|
55
|
+
* don't throw error on stale/missing non-target regions ([#2598](https://github.com/Applitools-Dev/sdk/issues/2598)) ([ae39ad9](https://github.com/Applitools-Dev/sdk/commit/ae39ad9fdb129a3f987ee5076660071b66dc1342))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
* @applitools/snippets bumped to 2.6.3
|
|
60
|
+
#### Bug Fixes
|
|
61
|
+
|
|
62
|
+
* don't throw error on stale/missing non-target regions ([#2598](https://github.com/Applitools-Dev/sdk/issues/2598)) ([ae39ad9](https://github.com/Applitools-Dev/sdk/commit/ae39ad9fdb129a3f987ee5076660071b66dc1342))
|
|
63
|
+
* @applitools/driver bumped to 1.20.1
|
|
64
|
+
|
|
65
|
+
* @applitools/spec-driver-webdriver bumped to 1.1.21
|
|
66
|
+
|
|
67
|
+
* @applitools/spec-driver-selenium bumped to 1.5.92
|
|
68
|
+
|
|
69
|
+
* @applitools/spec-driver-puppeteer bumped to 1.4.21
|
|
70
|
+
|
|
71
|
+
* @applitools/screenshoter bumped to 3.10.1
|
|
72
|
+
|
|
73
|
+
* @applitools/nml-client bumped to 1.8.19
|
|
74
|
+
|
|
75
|
+
* @applitools/ec-client bumped to 1.9.15
|
|
76
|
+
|
|
77
|
+
|
|
3
78
|
## [4.24.0](https://github.com/Applitools-Dev/sdk/compare/js/core@4.23.1...js/core@4.24.0) (2024-11-12)
|
|
4
79
|
|
|
5
80
|
|
|
@@ -44,7 +44,10 @@ async function takeScreenshots({ driver, settings, logger, }) {
|
|
|
44
44
|
await ((_a = screenshot.scrollingElement) === null || _a === void 0 ? void 0 : _a.setAttribute('data-applitools-scroll', 'true'));
|
|
45
45
|
else
|
|
46
46
|
await ((_b = screenshot.element) === null || _b === void 0 ? void 0 : _b.setAttribute('data-applitools-scroll', 'true'));
|
|
47
|
-
baseTarget.dom = await (0, take_dom_capture_1.takeDomCapture)({ driver, settings: settings.domSettings, logger }).catch(
|
|
47
|
+
baseTarget.dom = await (0, take_dom_capture_1.takeDomCapture)({ driver, settings: settings.domSettings, logger }).catch(error => {
|
|
48
|
+
logger.error('failed to capture DOM', error);
|
|
49
|
+
return undefined;
|
|
50
|
+
});
|
|
48
51
|
}
|
|
49
52
|
if (settings.calculateView) {
|
|
50
53
|
const scrollingElement = await driver.mainContext.getScrollingElement();
|
package/dist/open-eyes.js
CHANGED
|
@@ -142,8 +142,8 @@ function makeOpenEyes({ type: defaultType = 'classic', clients, batch, removeDup
|
|
|
142
142
|
}); // TODO solve the types issue
|
|
143
143
|
/////// END FUNCTION BODY ///////////////////
|
|
144
144
|
async function populateAutoScmInfo(batchId) {
|
|
145
|
-
var _a, _b
|
|
146
|
-
var
|
|
145
|
+
var _a, _b;
|
|
146
|
+
var _c;
|
|
147
147
|
const branchName = await (0, extract_git_info_1.extractGitBranch)({ execOptions: { cwd }, logger });
|
|
148
148
|
const { owner: repoOwner, name: repoName } = await (0, extract_git_info_1.extractGitRepo)({ execOptions: { cwd }, logger });
|
|
149
149
|
const buildId = await (0, extract_git_info_1.extractBuildIdFromCI)();
|
|
@@ -159,9 +159,8 @@ function makeOpenEyes({ type: defaultType = 'classic', clients, batch, removeDup
|
|
|
159
159
|
if (scmInfo) {
|
|
160
160
|
(_a = settings.batch) !== null && _a !== void 0 ? _a : (settings.batch = {});
|
|
161
161
|
settings.batch.id = isRealBatchId(settings.batch.id) ? settings.batch.id : batchId;
|
|
162
|
-
(_b = (
|
|
163
|
-
|
|
164
|
-
(_d = settings.parentBranchName) !== null && _d !== void 0 ? _d : (settings.parentBranchName = scmInfo.scmTargetBranch);
|
|
162
|
+
(_b = (_c = settings.batch).buildId) !== null && _b !== void 0 ? _b : (_c.buildId = buildId);
|
|
163
|
+
// Intentionally not auto populating branchName and parentBranchName. If there is scmInfo then Eyes already knows these values.
|
|
165
164
|
}
|
|
166
165
|
}
|
|
167
166
|
else {
|
|
@@ -24,6 +24,7 @@ function makeTakeSnapshots({ core, spec, signal, logger: mainLogger }) {
|
|
|
24
24
|
const { elementReferences, getSafeCheckSettings } = (0, to_safe_check_settings_1.toSafeCheckSettings)({ settings });
|
|
25
25
|
const { elementReferencesToMark, getGeneratedSelectors } = (0, to_generated_selectors_1.toGeneratedSelectors)({
|
|
26
26
|
elementReferences,
|
|
27
|
+
logger,
|
|
27
28
|
// dead code - `transformElementReference` was used for NMG but it's not longer used anywhere
|
|
28
29
|
transformElementReference: elementReference => { var _a; return ((0, driver_1.isSelector)(elementReference) && ((_a = spec === null || spec === void 0 ? void 0 : spec.toSimpleCommonSelector) === null || _a === void 0 ? void 0 : _a.call(spec, elementReference))) || undefined; },
|
|
29
30
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toGeneratedSelectors = void 0;
|
|
4
|
-
function toGeneratedSelectors({ elementReferences, transformElementReference, }) {
|
|
4
|
+
function toGeneratedSelectors({ elementReferences, logger, transformElementReference, }) {
|
|
5
5
|
var _a, _b, _c;
|
|
6
6
|
const elementReferencesToMark = [
|
|
7
7
|
(_a = elementReferences.target) !== null && _a !== void 0 ? _a : [],
|
|
@@ -17,14 +17,39 @@ function toGeneratedSelectors({ elementReferences, transformElementReference, })
|
|
|
17
17
|
if (generatedSelectors) {
|
|
18
18
|
let offset = 0;
|
|
19
19
|
if (elementReferences.target) {
|
|
20
|
-
|
|
21
|
-
if (!
|
|
20
|
+
const targetOrError = (_a = generatedSelectors[offset++].safeSelector) !== null && _a !== void 0 ? _a : undefined;
|
|
21
|
+
if (!targetOrError)
|
|
22
22
|
throw new Error('Target element not found');
|
|
23
|
+
if (typeof targetOrError !== 'string' && 'error' in targetOrError)
|
|
24
|
+
throw new Error(`Target element is stale - please make sure the element is not detached from the DOM tree. ${targetOrError.error}`);
|
|
25
|
+
target = targetOrError;
|
|
23
26
|
}
|
|
24
27
|
if (elementReferences.scrolling) {
|
|
25
|
-
|
|
28
|
+
const scrollingOrError = (_b = generatedSelectors[offset++].safeSelector) !== null && _b !== void 0 ? _b : undefined;
|
|
29
|
+
const isError = typeof scrollingOrError === 'object' && 'error' in scrollingOrError;
|
|
30
|
+
scrolling = isError ? undefined : scrollingOrError;
|
|
31
|
+
if (isError) {
|
|
32
|
+
logger.log('Error in scrolling element:', scrollingOrError);
|
|
33
|
+
}
|
|
34
|
+
else if (!scrolling) {
|
|
35
|
+
logger.log('Scrolling element not found');
|
|
36
|
+
}
|
|
26
37
|
}
|
|
27
|
-
calculate = generatedSelectors.slice(offset)
|
|
38
|
+
calculate = generatedSelectors.slice(offset).map(generatedSelector => {
|
|
39
|
+
var _a;
|
|
40
|
+
const safeSelector = generatedSelector.safeSelector;
|
|
41
|
+
const isError = safeSelector && typeof safeSelector === 'object' && 'error' in safeSelector;
|
|
42
|
+
if (isError) {
|
|
43
|
+
logger.log('Error in calculate element:', safeSelector);
|
|
44
|
+
}
|
|
45
|
+
else if (!safeSelector) {
|
|
46
|
+
logger.log('Calculate element not found', (_a = generatedSelector.originalSelector) !== null && _a !== void 0 ? _a : '');
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
...generatedSelector,
|
|
50
|
+
safeSelector: isError ? null : safeSelector,
|
|
51
|
+
};
|
|
52
|
+
});
|
|
28
53
|
}
|
|
29
54
|
else {
|
|
30
55
|
// the entire else statement should be a dead code that was used for NMG, will be removed later
|
|
@@ -36,7 +61,7 @@ function toGeneratedSelectors({ elementReferences, transformElementReference, })
|
|
|
36
61
|
return { originalSelector: selector, safeSelector: selector };
|
|
37
62
|
});
|
|
38
63
|
}
|
|
39
|
-
return { target, scrolling, calculate };
|
|
64
|
+
return { target: target, scrolling, calculate };
|
|
40
65
|
}
|
|
41
66
|
}
|
|
42
67
|
exports.toGeneratedSelectors = toGeneratedSelectors;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/core",
|
|
3
|
-
"version": "4.24.
|
|
3
|
+
"version": "4.24.2",
|
|
4
4
|
"homepage": "https://applitools.com",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"build:bin:zip": "zip -j ./bin/core.zip $(find ./bin -type f -not -name '*.zip' -not -name '*.tar.gz' | xargs)",
|
|
50
50
|
"build:bin:tgz": "tar -czf ./bin/core.tar.gz $(find ./bin -type f -not -name '*.zip' -not -name '*.tar.gz' | xargs)",
|
|
51
51
|
"test": "run --top-level mocha './test/**/*.spec.ts' --exclude './test/bin/**' --parallel --jobs ${MOCHA_JOBS:-15} --exit",
|
|
52
|
-
"test:local": "MOCHA_OMIT_TAGS=sauce run test",
|
|
53
|
-
"test:sauce": "MOCHA_ONLY_TAGS=sauce run test",
|
|
52
|
+
"test:local": "MOCHA_OMIT_TAGS=sauce,browserstack run test",
|
|
53
|
+
"test:sauce": "MOCHA_ONLY_TAGS=sauce,browserstack run test",
|
|
54
54
|
"test:bin": "MOCHA_GROUP=bin run --top-level mocha './test/bin/**/*.spec.ts' --parallel --jobs ${MOCHA_JOBS:-15}",
|
|
55
55
|
"test:e2e": "MOCHA_GROUP=e2e run --top-level mocha './test/e2e/**/*.spec.ts' --parallel --jobs ${MOCHA_JOBS:-15} --exit",
|
|
56
56
|
"test:it": "MOCHA_GROUP=it run --top-level mocha './test/it/**/*.spec.ts'",
|
|
@@ -74,19 +74,19 @@
|
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@applitools/core-base": "1.19.
|
|
78
|
-
"@applitools/dom-capture": "11.5.
|
|
79
|
-
"@applitools/dom-snapshot": "4.11.
|
|
77
|
+
"@applitools/core-base": "1.19.3",
|
|
78
|
+
"@applitools/dom-capture": "11.5.2",
|
|
79
|
+
"@applitools/dom-snapshot": "4.11.11",
|
|
80
80
|
"@applitools/driver": "1.20.0",
|
|
81
|
-
"@applitools/ec-client": "1.9.
|
|
81
|
+
"@applitools/ec-client": "1.9.15",
|
|
82
82
|
"@applitools/logger": "2.0.19",
|
|
83
|
-
"@applitools/nml-client": "1.8.
|
|
84
|
-
"@applitools/req": "1.7.
|
|
83
|
+
"@applitools/nml-client": "1.8.19",
|
|
84
|
+
"@applitools/req": "1.7.4",
|
|
85
85
|
"@applitools/screenshoter": "3.10.0",
|
|
86
|
-
"@applitools/snippets": "2.6.
|
|
86
|
+
"@applitools/snippets": "2.6.3",
|
|
87
87
|
"@applitools/socket": "1.1.19",
|
|
88
88
|
"@applitools/spec-driver-webdriver": "1.1.20",
|
|
89
|
-
"@applitools/ufg-client": "1.14.
|
|
89
|
+
"@applitools/ufg-client": "1.14.1",
|
|
90
90
|
"@applitools/utils": "1.7.5",
|
|
91
91
|
"@types/ws": "8.5.5",
|
|
92
92
|
"abort-controller": "3.0.0",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"@applitools/spec-driver-selenium": "^1.5.91",
|
|
105
105
|
"@applitools/test-server": "^1.2.2",
|
|
106
106
|
"@applitools/test-utils": "^1.5.17",
|
|
107
|
-
"@applitools/tunnel-client": "^1.5.
|
|
107
|
+
"@applitools/tunnel-client": "^1.5.10",
|
|
108
108
|
"@types/node": "^12.20.55",
|
|
109
109
|
"@types/selenium-webdriver": "^4.1.2",
|
|
110
110
|
"@types/semver": "^7.5.8",
|
package/types/ufg/types.d.ts
CHANGED
|
@@ -8,7 +8,9 @@ export * from '../automation/types';
|
|
|
8
8
|
export type DomSnapshot = UFGDomSnapshot & {
|
|
9
9
|
generatedSelectors?: {
|
|
10
10
|
originalSelector: CommonSelector | null;
|
|
11
|
-
safeSelector: CommonSelector |
|
|
11
|
+
safeSelector: CommonSelector | {
|
|
12
|
+
error: string;
|
|
13
|
+
} | null;
|
|
12
14
|
}[];
|
|
13
15
|
};
|
|
14
16
|
export type AndroidSnapshot = UFGAndroidSnapshot;
|
|
@@ -22,7 +22,9 @@ export type RawDomSnapshot = {
|
|
|
22
22
|
}[];
|
|
23
23
|
srcAttr: string | null;
|
|
24
24
|
scriptVersion: string;
|
|
25
|
-
safeSelectors?: (CommonSelector |
|
|
25
|
+
safeSelectors?: (CommonSelector | {
|
|
26
|
+
error: string;
|
|
27
|
+
} | null)[];
|
|
26
28
|
warnings?: string[];
|
|
27
29
|
};
|
|
28
30
|
export type DomSnapshotSettings<TSpec extends SpecType> = {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { type SpecType, type ElementReference } from '@applitools/driver';
|
|
2
|
+
import type { Logger } from '@applitools/logger';
|
|
2
3
|
import { type Selector as UFGSelector } from '@applitools/ufg-client';
|
|
3
|
-
export declare function toGeneratedSelectors<TSpec extends SpecType>({ elementReferences, transformElementReference, }: {
|
|
4
|
+
export declare function toGeneratedSelectors<TSpec extends SpecType>({ elementReferences, logger, transformElementReference, }: {
|
|
4
5
|
elementReferences: {
|
|
5
6
|
target?: ElementReference<TSpec>;
|
|
6
7
|
scrolling?: ElementReference<TSpec>;
|
|
7
8
|
calculate?: ElementReference<TSpec>[];
|
|
8
9
|
};
|
|
9
10
|
transformElementReference: (elementReference: ElementReference<TSpec>) => UFGSelector | undefined;
|
|
11
|
+
logger: Logger;
|
|
10
12
|
}): {
|
|
11
13
|
elementReferencesToMark: (string | TSpec["element"] | TSpec["secondary"]["element"] | TSpec["selector"] | TSpec["secondary"]["selector"] | {
|
|
12
14
|
selector: string | TSpec["selector"] | TSpec["secondary"]["selector"];
|
|
@@ -18,7 +20,9 @@ export declare function toGeneratedSelectors<TSpec extends SpecType>({ elementRe
|
|
|
18
20
|
} | (NonNullable<TSpec["element"]> extends infer T ? T extends NonNullable<TSpec["element"]> ? T extends readonly (infer InnerArr)[] ? InnerArr : T : never : never) | (NonNullable<TSpec["secondary"]["element"]> extends infer T_1 ? T_1 extends NonNullable<TSpec["secondary"]["element"]> ? T_1 extends readonly (infer InnerArr)[] ? InnerArr : T_1 : never : never) | (NonNullable<TSpec["selector"]> extends infer T_2 ? T_2 extends NonNullable<TSpec["selector"]> ? T_2 extends readonly (infer InnerArr)[] ? InnerArr : T_2 : never : never) | (NonNullable<TSpec["secondary"]["selector"]> extends infer T_3 ? T_3 extends NonNullable<TSpec["secondary"]["selector"]> ? T_3 extends readonly (infer InnerArr)[] ? InnerArr : T_3 : never : never))[];
|
|
19
21
|
getGeneratedSelectors: (generatedSelectors?: {
|
|
20
22
|
originalSelector: UFGSelector | null;
|
|
21
|
-
safeSelector: UFGSelector |
|
|
23
|
+
safeSelector: UFGSelector | {
|
|
24
|
+
error: string;
|
|
25
|
+
} | null;
|
|
22
26
|
}[]) => {
|
|
23
27
|
target: UFGSelector | undefined;
|
|
24
28
|
scrolling: UFGSelector | undefined;
|