@applitools/core 4.20.2 → 4.21.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/CHANGELOG.md +94 -0
- package/dist/automation/utils/take-screenshot.js +1 -0
- package/dist/automation/utils/to-base-check-settings.js +1 -1
- package/dist/autonomous/core.js +2 -2
- package/dist/check.js +7 -1
- package/dist/classic/core.js +2 -2
- package/dist/core.js +2 -2
- package/dist/make-manager.js +2 -1
- package/dist/open-eyes.js +79 -23
- package/dist/run-offline-snapshots.js +0 -2
- package/dist/ufg/core.js +2 -2
- package/dist/ufg/take-snapshots.js +3 -25
- package/dist/ufg/utils/generate-safe-selectors.js +7 -30
- package/dist/ufg/utils/take-dom-snapshot.js +53 -16
- package/dist/ufg/utils/take-dom-snapshots.js +5 -19
- package/dist/ufg/utils/to-generated-selectors.js +1 -0
- package/dist/universal/core.js +4 -0
- package/dist/utils/extract-git-info.js +165 -0
- package/dist/utils/populate-eyes-server-settings.js +6 -0
- package/package.json +11 -11
- package/types/automation/types.d.ts +1 -0
- package/types/autonomous/core.d.ts +1 -2
- package/types/classic/core.d.ts +1 -2
- package/types/open-eyes.d.ts +2 -1
- package/types/ufg/core.d.ts +1 -2
- package/types/ufg/utils/generate-safe-selectors.d.ts +4 -19
- package/types/ufg/utils/take-dom-snapshot.d.ts +7 -13
- package/types/ufg/utils/take-dom-snapshots.d.ts +2 -3
- package/types/utils/extract-git-info.d.ts +59 -0
- package/types/utils/populate-eyes-server-settings.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,99 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.21.1](https://github.com/Applitools-Dev/sdk/compare/js/core@4.21.0...js/core@4.21.1) (2024-10-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* better handling of stale elements ([cab10ff](https://github.com/Applitools-Dev/sdk/commit/cab10ff1ae1e6f9560a7d278c710b3fa03f58c83))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Performance Improvements
|
|
12
|
+
|
|
13
|
+
* avoid logging entire dom snapshots ([#2573](https://github.com/Applitools-Dev/sdk/issues/2573)) ([e6dc792](https://github.com/Applitools-Dev/sdk/commit/e6dc792c75eb39bd4d3e53775b63ba49fad20740))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Dependencies
|
|
17
|
+
|
|
18
|
+
* @applitools/dom-snapshot bumped to 4.11.4
|
|
19
|
+
#### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* better handling of stale elements ([cab10ff](https://github.com/Applitools-Dev/sdk/commit/cab10ff1ae1e6f9560a7d278c710b3fa03f58c83))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
* @applitools/snippets bumped to 2.5.2
|
|
26
|
+
#### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* better handling of stale elements ([cab10ff](https://github.com/Applitools-Dev/sdk/commit/cab10ff1ae1e6f9560a7d278c710b3fa03f58c83))
|
|
29
|
+
* @applitools/driver bumped to 1.19.4
|
|
30
|
+
#### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* better handling of stale elements ([cab10ff](https://github.com/Applitools-Dev/sdk/commit/cab10ff1ae1e6f9560a7d278c710b3fa03f58c83))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
* @applitools/spec-driver-webdriver bumped to 1.1.16
|
|
37
|
+
|
|
38
|
+
* @applitools/spec-driver-selenium bumped to 1.5.87
|
|
39
|
+
|
|
40
|
+
* @applitools/spec-driver-puppeteer bumped to 1.4.16
|
|
41
|
+
|
|
42
|
+
* @applitools/screenshoter bumped to 3.9.1
|
|
43
|
+
|
|
44
|
+
* @applitools/nml-client bumped to 1.8.14
|
|
45
|
+
|
|
46
|
+
* @applitools/ec-client bumped to 1.9.10
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## [4.21.0](https://github.com/Applitools-Dev/sdk/compare/js/core@4.20.2...js/core@4.21.0) (2024-10-21)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Features
|
|
53
|
+
|
|
54
|
+
* add chrome emulation devices ([#2559](https://github.com/Applitools-Dev/sdk/issues/2559)) ([0499aaf](https://github.com/Applitools-Dev/sdk/commit/0499aaf3bb809d2ac0105b4493e6f6bb8730ea3f))
|
|
55
|
+
* capture status bar ([#2571](https://github.com/Applitools-Dev/sdk/issues/2571)) ([5e1c75e](https://github.com/Applitools-Dev/sdk/commit/5e1c75ef9cf34af80f08806a3bceaf06a94f2780))
|
|
56
|
+
* dynamic regions ([#2538](https://github.com/Applitools-Dev/sdk/issues/2538)) ([d8b5c48](https://github.com/Applitools-Dev/sdk/commit/d8b5c48fb35f9789c702447314dc72b4f415ade1))
|
|
57
|
+
* setting up SCM information automatically ([#2542](https://github.com/Applitools-Dev/sdk/issues/2542)) ([696461a](https://github.com/Applitools-Dev/sdk/commit/696461af3f8e2e3ed94eb78fed5ead6233bd16b2))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### Bug Fixes
|
|
61
|
+
|
|
62
|
+
* don't remove offline execution folder after running ([654e195](https://github.com/Applitools-Dev/sdk/commit/654e195dd50dc7dab93dd907ec26d788549c6e81))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### Dependencies
|
|
66
|
+
|
|
67
|
+
* @applitools/snippets bumped to 2.5.1
|
|
68
|
+
#### Bug Fixes
|
|
69
|
+
|
|
70
|
+
* isStaleElement error ([#2567](https://github.com/Applitools-Dev/sdk/issues/2567)) ([2675086](https://github.com/Applitools-Dev/sdk/commit/2675086aa28589082249e2958942ee29a5f2ef12))
|
|
71
|
+
* @applitools/screenshoter bumped to 3.9.0
|
|
72
|
+
#### Features
|
|
73
|
+
|
|
74
|
+
* capture status bar ([#2571](https://github.com/Applitools-Dev/sdk/issues/2571)) ([5e1c75e](https://github.com/Applitools-Dev/sdk/commit/5e1c75ef9cf34af80f08806a3bceaf06a94f2780))
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
* @applitools/driver bumped to 1.19.3
|
|
79
|
+
|
|
80
|
+
* @applitools/spec-driver-webdriver bumped to 1.1.15
|
|
81
|
+
|
|
82
|
+
* @applitools/spec-driver-selenium bumped to 1.5.86
|
|
83
|
+
|
|
84
|
+
* @applitools/spec-driver-puppeteer bumped to 1.4.15
|
|
85
|
+
|
|
86
|
+
* @applitools/nml-client bumped to 1.8.13
|
|
87
|
+
|
|
88
|
+
* @applitools/core-base bumped to 1.18.0
|
|
89
|
+
#### Features
|
|
90
|
+
|
|
91
|
+
* ability to download side by side with highlighted diffs (2419) ([#2530](https://github.com/Applitools-Dev/sdk/issues/2530)) ([e06ce69](https://github.com/Applitools-Dev/sdk/commit/e06ce699f30e9e444ac58dafdf5989ff1c96ca1c))
|
|
92
|
+
* dynamic regions ([#2538](https://github.com/Applitools-Dev/sdk/issues/2538)) ([d8b5c48](https://github.com/Applitools-Dev/sdk/commit/d8b5c48fb35f9789c702447314dc72b4f415ade1))
|
|
93
|
+
* setting up SCM information automatically ([#2542](https://github.com/Applitools-Dev/sdk/issues/2542)) ([696461a](https://github.com/Applitools-Dev/sdk/commit/696461af3f8e2e3ed94eb78fed5ead6233bd16b2))
|
|
94
|
+
* @applitools/ec-client bumped to 1.9.9
|
|
95
|
+
|
|
96
|
+
|
|
3
97
|
## [4.20.2](https://github.com/Applitools-Dev/sdk/compare/js/core@4.20.1...js/core@4.20.2) (2024-10-03)
|
|
4
98
|
|
|
5
99
|
|
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.toBaseCheckSettings = exports.extractMobileElementsIntoCheckSettings = exports.hasCodedRegions = void 0;
|
|
27
27
|
const utils = __importStar(require("@applitools/utils"));
|
|
28
|
-
const regionTypes = ['ignore', 'layout', 'strict', 'content', 'floating', 'accessibility'];
|
|
28
|
+
const regionTypes = ['ignore', 'layout', 'strict', 'content', 'floating', 'accessibility', 'dynamic'];
|
|
29
29
|
function hasCodedRegions(settings) {
|
|
30
30
|
for (const regionType of regionTypes) {
|
|
31
31
|
if (settings[`${regionType}Regions`])
|
package/dist/autonomous/core.js
CHANGED
|
@@ -9,9 +9,9 @@ const start_renders_1 = require("./start-renders");
|
|
|
9
9
|
const get_render_results_1 = require("./get-render-results");
|
|
10
10
|
const create_render_results_1 = require("./create-render-results");
|
|
11
11
|
const open_eyes_1 = require("./open-eyes");
|
|
12
|
-
function makeAutonomousCore({ spec, clients, base: defaultBase, asyncCache, agentId = 'core-autonomous',
|
|
12
|
+
function makeAutonomousCore({ spec, clients, base: defaultBase, asyncCache, agentId = 'core-autonomous', logger: defaultLogger, } = {}) {
|
|
13
13
|
const logger = (0, logger_1.makeLogger)({ logger: defaultLogger, format: { label: 'core-autonomous' } });
|
|
14
|
-
const core = (0, core_1.makeCore)({ spec, clients, base: defaultBase, asyncCache, agentId,
|
|
14
|
+
const core = (0, core_1.makeCore)({ spec, clients, base: defaultBase, asyncCache, agentId, logger });
|
|
15
15
|
return {
|
|
16
16
|
type: 'autonomous',
|
|
17
17
|
takeSnapshots: spec && (0, take_snapshots_1.makeTakeSnapshots)({ core, spec, logger }),
|
package/dist/check.js
CHANGED
|
@@ -45,7 +45,13 @@ function makeCheck({ type: defaultType = 'classic', eyes, target: defaultTarget,
|
|
|
45
45
|
settings.overlap = { top: 10, bottom: 50, ...settings === null || settings === void 0 ? void 0 : settings.overlap };
|
|
46
46
|
(_e = settings.matchLevel) !== null && _e !== void 0 ? _e : (settings.matchLevel = 'Strict');
|
|
47
47
|
(_f = settings.ignoreCaret) !== null && _f !== void 0 ? _f : (settings.ignoreCaret = true);
|
|
48
|
-
(_g = settings.sendDom) !== null && _g !== void 0 ? _g : (settings.sendDom = eyes.test.account.rcaEnabled ||
|
|
48
|
+
(_g = settings.sendDom) !== null && _g !== void 0 ? _g : (settings.sendDom = eyes.test.account.rcaEnabled ||
|
|
49
|
+
settings.matchLevel === 'Layout' ||
|
|
50
|
+
settings.matchLevel === 'Dynamic' ||
|
|
51
|
+
settings.enablePatterns ||
|
|
52
|
+
settings.useDom ||
|
|
53
|
+
!utils.types.isEmpty(settings.dynamicRegions) ||
|
|
54
|
+
!utils.types.isEmpty(settings.layoutRegions));
|
|
49
55
|
(_h = settings.autProxy) !== null && _h !== void 0 ? _h : (settings.autProxy = eyes.test.eyesServer.proxy);
|
|
50
56
|
(_j = settings.useDom) !== null && _j !== void 0 ? _j : (settings.useDom = false);
|
|
51
57
|
(_k = (_q = settings).retryTimeout) !== null && _k !== void 0 ? _k : (_q.retryTimeout = 0);
|
package/dist/classic/core.js
CHANGED
|
@@ -34,10 +34,10 @@ const extract_text_1 = require("../automation/extract-text");
|
|
|
34
34
|
const get_nml_client_1 = require("../automation/get-nml-client");
|
|
35
35
|
const open_eyes_1 = require("./open-eyes");
|
|
36
36
|
const utils = __importStar(require("@applitools/utils"));
|
|
37
|
-
function makeCore({ spec, clients, base: defaultBase, concurrency, agentId = 'core-classic',
|
|
37
|
+
function makeCore({ spec, clients, base: defaultBase, concurrency, agentId = 'core-classic', logger: defaultLogger, offlineLocationPath, }) {
|
|
38
38
|
const logger = (0, logger_1.makeLogger)({ logger: defaultLogger, format: { label: 'core-classic' } });
|
|
39
39
|
logger.log(`Core classic is initialized ${defaultBase ? 'with' : 'without'} custom base core`);
|
|
40
|
-
const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId, concurrency,
|
|
40
|
+
const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId, concurrency, logger, offlineLocationPath });
|
|
41
41
|
return utils.general.extend(base, core => {
|
|
42
42
|
return {
|
|
43
43
|
type: 'classic',
|
package/dist/core.js
CHANGED
|
@@ -53,7 +53,7 @@ function makeCore({ spec, clients, base: defaultBase, concurrency = utils.genera
|
|
|
53
53
|
logger.log(`[pid=${process.pid} Core is initialized ${defaultBase ? 'with' : 'without'} custom base core ${offlineLocationPath ? `and offline location ${offlineLocationPath} ` : ''}and environment `, environment);
|
|
54
54
|
if (environment.sdk)
|
|
55
55
|
(0, validate_sdk_version_1.validateSdkVersion)(environment.sdk, { logger });
|
|
56
|
-
const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId, concurrency,
|
|
56
|
+
const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId, concurrency, logger, offlineLocationPath });
|
|
57
57
|
const cores = {
|
|
58
58
|
ufg: (0, core_2.makeCore)({ spec, clients, base, asyncCache, logger, offlineLocationPath }),
|
|
59
59
|
classic: (0, core_1.makeCore)({ spec, clients, base, logger, offlineLocationPath }),
|
|
@@ -83,7 +83,7 @@ function makeCore({ spec, clients, base: defaultBase, concurrency = utils.genera
|
|
|
83
83
|
locate: (0, locate_1.makeLocate)({ spec, core, logger }),
|
|
84
84
|
locateText: (0, locate_text_1.makeLocateText)({ spec, core, logger }),
|
|
85
85
|
extractText: (0, extract_text_1.makeExtractText)({ spec, core, logger }),
|
|
86
|
-
openEyes: (0, open_eyes_1.makeOpenEyes)({ spec, clients, core, cores, environment, asyncCache, logger }),
|
|
86
|
+
openEyes: (0, open_eyes_1.makeOpenEyes)({ spec, clients, core, cores, environment, asyncCache, cwd, logger }),
|
|
87
87
|
closeBatch: (0, close_batch_1.makeCloseBatch)({ core, logger }),
|
|
88
88
|
deleteTest: (0, delete_test_1.makeDeleteTest)({ core, logger }),
|
|
89
89
|
};
|
package/dist/make-manager.js
CHANGED
|
@@ -42,7 +42,7 @@ function makeMakeManager({ spec, clients, core, base: defaultBase, agentId: defa
|
|
|
42
42
|
(_f = (_j = settings.batch).buildId) !== null && _f !== void 0 ? _f : (_j.buildId = utils.general.getEnvValue('BATCH_BUILD_ID'));
|
|
43
43
|
(_g = settings.agentId) !== null && _g !== void 0 ? _g : (settings.agentId = type === 'ufg' ? defaultAgentId === null || defaultAgentId === void 0 ? void 0 : defaultAgentId.replace(/(\/\d)/, '.visualgrid$1') : defaultAgentId);
|
|
44
44
|
logger.log('Command "makeManager" is called with settings', settings);
|
|
45
|
-
const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId: settings.agentId, concurrency: settings.concurrency,
|
|
45
|
+
const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId: settings.agentId, concurrency: settings.concurrency, logger, offlineLocationPath });
|
|
46
46
|
const fetchConcurrency = settings.fetchConcurrency;
|
|
47
47
|
const cores = {
|
|
48
48
|
ufg: (0, core_2.makeCore)({ spec, clients, base, fetchConcurrency, asyncCache, logger, offlineLocationPath }),
|
|
@@ -64,6 +64,7 @@ function makeMakeManager({ spec, clients, core, base: defaultBase, agentId: defa
|
|
|
64
64
|
cores,
|
|
65
65
|
environment,
|
|
66
66
|
asyncCache,
|
|
67
|
+
cwd,
|
|
67
68
|
logger,
|
|
68
69
|
}), async (openEyes, options) => {
|
|
69
70
|
const eyes = await openEyes(options);
|
package/dist/open-eyes.js
CHANGED
|
@@ -36,30 +36,58 @@ const get_eyes_results_1 = require("./get-eyes-results");
|
|
|
36
36
|
const populate_eyes_server_settings_1 = require("./utils/populate-eyes-server-settings");
|
|
37
37
|
const utils = __importStar(require("@applitools/utils"));
|
|
38
38
|
const core_base_1 = require("@applitools/core-base");
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var
|
|
39
|
+
const extract_git_info_1 = require("./utils/extract-git-info");
|
|
40
|
+
function makeOpenEyes({ type: defaultType = 'classic', clients, batch, removeDuplicateTests, core, cores, spec, environment, logger: mainLogger, asyncCache, cwd = process.cwd(), }) {
|
|
41
|
+
return async function openEyes({ type = defaultType, settings: openSettings, config, target, logger = mainLogger, }) {
|
|
42
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
43
|
+
var _y, _z, _0, _1, _2, _3;
|
|
43
44
|
logger = logger.extend(mainLogger, { tags: [`eyes-${type}-${utils.general.shortid()}`] });
|
|
44
|
-
settings = { ...config === null || config === void 0 ? void 0 : config.open, ...
|
|
45
|
-
(0, populate_eyes_server_settings_1.populateEyesServerSettings)(settings);
|
|
45
|
+
const settings = { ...config === null || config === void 0 ? void 0 : config.open, ...openSettings };
|
|
46
|
+
const eyesServerSettings = (0, populate_eyes_server_settings_1.populateEyesServerSettings)(settings);
|
|
46
47
|
(_a = settings.userTestId) !== null && _a !== void 0 ? _a : (settings.userTestId = `${settings.testName}--${utils.general.guid()}`);
|
|
47
48
|
settings.batch = { ...batch, ...settings.batch };
|
|
48
|
-
(_b = (
|
|
49
|
-
(
|
|
50
|
-
(
|
|
51
|
-
(
|
|
52
|
-
(
|
|
53
|
-
(
|
|
54
|
-
(
|
|
55
|
-
(
|
|
56
|
-
(
|
|
57
|
-
(
|
|
58
|
-
(
|
|
59
|
-
(
|
|
60
|
-
(
|
|
61
|
-
(
|
|
62
|
-
(
|
|
49
|
+
(_b = (_y = settings.batch).id) !== null && _b !== void 0 ? _b : (_y.id = utils.general.getEnvValue('BATCH_ID'));
|
|
50
|
+
(_c = (_z = settings.batch).buildId) !== null && _c !== void 0 ? _c : (_z.buildId = utils.general.getEnvValue('BATCH_BUILD_ID'));
|
|
51
|
+
(_d = (_0 = settings.batch).name) !== null && _d !== void 0 ? _d : (_0.name = utils.general.getEnvValue('BATCH_NAME'));
|
|
52
|
+
(_e = (_1 = settings.batch).sequenceName) !== null && _e !== void 0 ? _e : (_1.sequenceName = utils.general.getEnvValue('BATCH_SEQUENCE'));
|
|
53
|
+
(_f = (_2 = settings.batch).notifyOnCompletion) !== null && _f !== void 0 ? _f : (_2.notifyOnCompletion = utils.general.getEnvValue('BATCH_NOTIFY', 'boolean'));
|
|
54
|
+
(_g = settings.keepBatchOpen) !== null && _g !== void 0 ? _g : (settings.keepBatchOpen = utils.general.getEnvValue('DONT_CLOSE_BATCHES', 'boolean'));
|
|
55
|
+
(_h = settings.branchName) !== null && _h !== void 0 ? _h : (settings.branchName = utils.general.getEnvValue('BRANCH'));
|
|
56
|
+
(_j = settings.parentBranchName) !== null && _j !== void 0 ? _j : (settings.parentBranchName = utils.general.getEnvValue('PARENT_BRANCH'));
|
|
57
|
+
(_k = settings.baselineBranchName) !== null && _k !== void 0 ? _k : (settings.baselineBranchName = utils.general.getEnvValue('BASELINE_BRANCH'));
|
|
58
|
+
(_l = settings.gitBranchingTimestamp) !== null && _l !== void 0 ? _l : (settings.gitBranchingTimestamp = utils.general.getEnvValue('GIT_MERGE_BASE_TIMESTAMP'));
|
|
59
|
+
(_m = settings.latestCommitInfo) !== null && _m !== void 0 ? _m : (settings.latestCommitInfo = getLatestCommitInfoFromEnvVars(logger));
|
|
60
|
+
(_o = settings.ufgServerUrl) !== null && _o !== void 0 ? _o : (settings.ufgServerUrl = utils.general.getEnvValue('UFG_SERVER_URL'));
|
|
61
|
+
(_p = settings.ignoreBaseline) !== null && _p !== void 0 ? _p : (settings.ignoreBaseline = false);
|
|
62
|
+
(_q = settings.compareWithParentBranch) !== null && _q !== void 0 ? _q : (settings.compareWithParentBranch = false);
|
|
63
|
+
(_r = settings.removeDuplicateTests) !== null && _r !== void 0 ? _r : (settings.removeDuplicateTests = removeDuplicateTests);
|
|
64
|
+
(_s = settings.latestCommitInfo) !== null && _s !== void 0 ? _s : (settings.latestCommitInfo = await (0, extract_git_info_1.extractLatestCommitInfo)({ execOptions: { cwd }, logger }));
|
|
65
|
+
if (settings.latestCommitInfo && !(0, extract_git_info_1.isISODate)(settings.latestCommitInfo.timestamp)) {
|
|
66
|
+
logger.warn(`latestCommitInfo.timestamp is an invalid ISO date string: ${settings.latestCommitInfo.timestamp}`);
|
|
67
|
+
settings.latestCommitInfo = undefined;
|
|
68
|
+
}
|
|
69
|
+
if (process.env.CI && (((_t = settings.batch) === null || _t === void 0 ? void 0 : _t.id) || settings.latestCommitInfo)) {
|
|
70
|
+
await populateAutoScmInfo(((_u = settings.batch) === null || _u === void 0 ? void 0 : _u.id) || settings.latestCommitInfo.sha);
|
|
71
|
+
}
|
|
72
|
+
(_v = (_3 = settings.batch).id) !== null && _v !== void 0 ? _v : (_3.id = `generated-${utils.general.guid()}`);
|
|
73
|
+
if (settings.ignoreGitBranching) {
|
|
74
|
+
settings.gitBranchingTimestamp = undefined;
|
|
75
|
+
}
|
|
76
|
+
else if (!settings.gitBranchingTimestamp) {
|
|
77
|
+
const { branchName, parentBranchName } = settings;
|
|
78
|
+
if (branchName && parentBranchName && branchName !== parentBranchName) {
|
|
79
|
+
settings.gitBranchingTimestamp = await (0, extract_git_info_1.extractBranchingTimestamp)({
|
|
80
|
+
branchName,
|
|
81
|
+
parentBranchName,
|
|
82
|
+
execOptions: { cwd },
|
|
83
|
+
logger,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (settings.gitBranchingTimestamp && !(0, extract_git_info_1.isISODate)(settings.gitBranchingTimestamp)) {
|
|
88
|
+
logger.warn(`gitBranchingTimestamp is an invalid ISO date string: ${settings.gitBranchingTimestamp}`);
|
|
89
|
+
settings.gitBranchingTimestamp = undefined;
|
|
90
|
+
}
|
|
63
91
|
const driver = target && (await (0, driver_1.makeDriver)({ spec, driver: target, logger, customConfig: settings }));
|
|
64
92
|
const driverEnvironment = await (driver === null || driver === void 0 ? void 0 : driver.getEnvironment());
|
|
65
93
|
const driverUrl = await (driver === null || driver === void 0 ? void 0 : driver.getDriverUrl());
|
|
@@ -70,7 +98,7 @@ function makeOpenEyes({ type: defaultType = 'classic', clients, batch, removeDup
|
|
|
70
98
|
event: {
|
|
71
99
|
type: 'openEyes',
|
|
72
100
|
userTestId: settings.userTestId,
|
|
73
|
-
concurrency: (
|
|
101
|
+
concurrency: (_w = cores === null || cores === void 0 ? void 0 : cores[type].concurrency) !== null && _w !== void 0 ? _w : core.concurrency,
|
|
74
102
|
environment,
|
|
75
103
|
driver: {
|
|
76
104
|
deviceName: driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.deviceName,
|
|
@@ -78,7 +106,7 @@ function makeOpenEyes({ type: defaultType = 'classic', clients, batch, removeDup
|
|
|
78
106
|
browserVersion: driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.browserVersion,
|
|
79
107
|
platformName: driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.platformName,
|
|
80
108
|
platformVersion: driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.platformVersion,
|
|
81
|
-
isApplitoolsLib: (
|
|
109
|
+
isApplitoolsLib: (_x = driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.applitoolsLib) === null || _x === void 0 ? void 0 : _x.instrumented,
|
|
82
110
|
isEC: driverEnvironment === null || driverEnvironment === void 0 ? void 0 : driverEnvironment.isEC,
|
|
83
111
|
},
|
|
84
112
|
driverUrl,
|
|
@@ -113,6 +141,34 @@ function makeOpenEyes({ type: defaultType = 'classic', clients, batch, removeDup
|
|
|
113
141
|
getResults: (0, get_eyes_results_1.makeGetEyesResults)({ eyes, logger }),
|
|
114
142
|
});
|
|
115
143
|
}); // TODO solve the types issue
|
|
144
|
+
/////// END FUNCTION BODY ///////////////////
|
|
145
|
+
async function populateAutoScmInfo(batchId) {
|
|
146
|
+
var _a, _b, _c, _d, _e;
|
|
147
|
+
var _f, _g;
|
|
148
|
+
const branchName = await (0, extract_git_info_1.extractGitBranch)({ execOptions: { cwd }, logger });
|
|
149
|
+
const { owner: repoOwner, name: repoName } = await (0, extract_git_info_1.extractGitRepo)({ execOptions: { cwd }, logger });
|
|
150
|
+
const buildId = await (0, extract_git_info_1.extractBuildIdFromCI)();
|
|
151
|
+
if (branchName && repoOwner && repoName) {
|
|
152
|
+
const scmInfo = await core.base
|
|
153
|
+
.updateIfScm({
|
|
154
|
+
settings: { ...eyesServerSettings, batchId, branchName, repoOwner, repoName, buildId },
|
|
155
|
+
logger,
|
|
156
|
+
})
|
|
157
|
+
.catch(error => {
|
|
158
|
+
throw refineMissingApiKeyException(error, environment === null || environment === void 0 ? void 0 : environment.sdk);
|
|
159
|
+
});
|
|
160
|
+
if (scmInfo) {
|
|
161
|
+
(_a = settings.batch) !== null && _a !== void 0 ? _a : (settings.batch = {});
|
|
162
|
+
(_b = (_f = settings.batch).id) !== null && _b !== void 0 ? _b : (_f.id = batchId);
|
|
163
|
+
(_c = (_g = settings.batch).buildId) !== null && _c !== void 0 ? _c : (_g.buildId = buildId);
|
|
164
|
+
(_d = settings.branchName) !== null && _d !== void 0 ? _d : (settings.branchName = branchName);
|
|
165
|
+
(_e = settings.parentBranchName) !== null && _e !== void 0 ? _e : (settings.parentBranchName = scmInfo.scmTargetBranch);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
logger.log(`Skipping check for SCM integration due to missing information: branchName=${branchName} repoName=${repoName} repoOwner=${repoOwner}`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
116
172
|
};
|
|
117
173
|
}
|
|
118
174
|
exports.makeOpenEyes = makeOpenEyes;
|
|
@@ -84,8 +84,6 @@ async function runOfflineSnapshots(options) {
|
|
|
84
84
|
const batchIds = [...new Set(results.map(t => t.batchId))];
|
|
85
85
|
const allTestResults = results.map(t => t.results);
|
|
86
86
|
executionLogger.log('done running all tests', allTestResults);
|
|
87
|
-
// @ts-expect-error // we use node v12 types, therefore it's not aware of the existence of `fs.promises.rm`
|
|
88
|
-
await fs_1.default.promises.rm(executionPath, { recursive: true });
|
|
89
87
|
await core.closeBatch({ settings: batchIds.map(batchId => ({ batchId, ...account.eyesServer })) });
|
|
90
88
|
executionLogger.log('done execution', executionName);
|
|
91
89
|
return allTestResults;
|
package/dist/ufg/core.js
CHANGED
|
@@ -36,10 +36,10 @@ const take_snapshots_1 = require("./take-snapshots");
|
|
|
36
36
|
const get_ufg_client_1 = require("./get-ufg-client");
|
|
37
37
|
const open_eyes_1 = require("./open-eyes");
|
|
38
38
|
const utils = __importStar(require("@applitools/utils"));
|
|
39
|
-
function makeCore({ spec, clients, base: defaultBase, asyncCache, concurrency, offlineLocationPath, fetchConcurrency, agentId = 'core-ufg',
|
|
39
|
+
function makeCore({ spec, clients, base: defaultBase, asyncCache, concurrency, offlineLocationPath, fetchConcurrency, agentId = 'core-ufg', logger: defaultLogger, }) {
|
|
40
40
|
const logger = (0, logger_1.makeLogger)({ logger: defaultLogger, format: { label: 'core-ufg' } });
|
|
41
41
|
logger.log(`Core ufg is initialized ${defaultBase ? 'with' : 'without'} custom base core`);
|
|
42
|
-
const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId, concurrency,
|
|
42
|
+
const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId, concurrency, logger, offlineLocationPath });
|
|
43
43
|
const ufgClient = clients === null || clients === void 0 ? void 0 : clients.ufg;
|
|
44
44
|
return utils.general.extend(base, core => {
|
|
45
45
|
return {
|
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.makeTakeSnapshots = void 0;
|
|
27
4
|
const driver_1 = require("@applitools/driver");
|
|
@@ -29,7 +6,6 @@ const take_dom_snapshots_1 = require("./utils/take-dom-snapshots");
|
|
|
29
6
|
const to_safe_check_settings_1 = require("./utils/to-safe-check-settings");
|
|
30
7
|
const to_generated_selectors_1 = require("./utils/to-generated-selectors");
|
|
31
8
|
const abort_error_1 = require("../errors/abort-error");
|
|
32
|
-
const utils = __importStar(require("@applitools/utils"));
|
|
33
9
|
function makeTakeSnapshots({ core, spec, signal, logger: mainLogger }) {
|
|
34
10
|
return async function takeSnapshots({ driver, settings = {}, account, logger = mainLogger, }) {
|
|
35
11
|
var _a;
|
|
@@ -48,6 +24,7 @@ function makeTakeSnapshots({ core, spec, signal, logger: mainLogger }) {
|
|
|
48
24
|
const { elementReferences, getSafeCheckSettings } = (0, to_safe_check_settings_1.toSafeCheckSettings)({ settings });
|
|
49
25
|
const { elementReferencesToMark, getGeneratedSelectors } = (0, to_generated_selectors_1.toGeneratedSelectors)({
|
|
50
26
|
elementReferences,
|
|
27
|
+
// dead code - `transformElementReference` was used for NMG but it's not longer used anywhere
|
|
51
28
|
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; },
|
|
52
29
|
});
|
|
53
30
|
let snapshots;
|
|
@@ -79,6 +56,7 @@ function makeTakeSnapshots({ core, spec, signal, logger: mainLogger }) {
|
|
|
79
56
|
});
|
|
80
57
|
}
|
|
81
58
|
else {
|
|
59
|
+
// dead code - used for NMG
|
|
82
60
|
const nmlClient = await core.getNMLClient({
|
|
83
61
|
driver,
|
|
84
62
|
settings: { ...account.eyesServer, supportedEnvironmentsUrl: account.supportedEnvironmentsUrl },
|
|
@@ -100,7 +78,7 @@ function makeTakeSnapshots({ core, spec, signal, logger: mainLogger }) {
|
|
|
100
78
|
return snapshots.map((snapshot, index) => ({
|
|
101
79
|
target: snapshot,
|
|
102
80
|
settings: getSafeCheckSettings({
|
|
103
|
-
selectors: getGeneratedSelectors(
|
|
81
|
+
selectors: getGeneratedSelectors(snapshot.generatedSelectors),
|
|
104
82
|
}),
|
|
105
83
|
environment: uniqueEnvironments[index],
|
|
106
84
|
account,
|
|
@@ -25,39 +25,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.generateSafeSelectors = void 0;
|
|
27
27
|
const utils = __importStar(require("@applitools/utils"));
|
|
28
|
-
const { addElementIds
|
|
28
|
+
const { addElementIds } = require('@applitools/snippets');
|
|
29
29
|
async function generateSafeSelectors({ context, elementReferences, }) {
|
|
30
30
|
if (!(elementReferences === null || elementReferences === void 0 ? void 0 : elementReferences.length))
|
|
31
|
-
return;
|
|
32
|
-
const mapping = await Promise.all(elementReferences.map(async (ref) => {
|
|
33
|
-
const elements = await context.elements(ref);
|
|
34
|
-
return {
|
|
35
|
-
ref,
|
|
36
|
-
elements,
|
|
37
|
-
id: utils.general.guid(), // same id for all elements that match the same ref
|
|
38
|
-
};
|
|
39
|
-
}));
|
|
31
|
+
return { generatedSelectors: [] };
|
|
40
32
|
// we can't structure elementsWithIds as object because it's not supported in safari webdriver (https://stackoverflow.com/questions/78953951/ios-safari-webdriver-executescript-fails-to-serialize-objects-with-elements)
|
|
41
|
-
const elementsWithIds =
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (elements.length === 0)
|
|
46
|
-
return { safeSelector: null, originalSelector: null, elementReference: ref };
|
|
47
|
-
const safeSelector = generatedSelectors[offset].reduceRight((selector, value) => {
|
|
48
|
-
return selector ? { type: 'css', selector: value, shadow: selector } : { type: 'css', selector: value };
|
|
49
|
-
}, undefined);
|
|
50
|
-
offset += elements.length;
|
|
51
|
-
return { safeSelector, originalSelector: elements[0].commonSelector, elementReference: ref };
|
|
52
|
-
});
|
|
53
|
-
return {
|
|
54
|
-
selectors,
|
|
55
|
-
cleanupGeneratedSelectors,
|
|
56
|
-
};
|
|
57
|
-
async function cleanupGeneratedSelectors() {
|
|
58
|
-
if (!mapping.length)
|
|
59
|
-
return;
|
|
60
|
-
await context.execute(cleanupElementIds, [mapping.map(({ elements }) => elements).flat()]);
|
|
33
|
+
const elementsWithIds = [];
|
|
34
|
+
for (const ref of elementReferences) {
|
|
35
|
+
const elements = await context.elements(ref);
|
|
36
|
+
elementsWithIds.push([elements, utils.general.guid()]); // same id for all elements that match the same ref
|
|
61
37
|
}
|
|
38
|
+
return { generatedSelectors: await context.execute(addElementIds, elementsWithIds) };
|
|
62
39
|
}
|
|
63
40
|
exports.generateSafeSelectors = generateSafeSelectors;
|
|
@@ -23,24 +23,27 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.takeDomSnapshot = void 0;
|
|
27
27
|
const utils = __importStar(require("@applitools/utils"));
|
|
28
28
|
const { getProcessPagePoll, getPollResult } = require('@applitools/dom-snapshot');
|
|
29
29
|
async function takeDomSnapshot({ context, settings, logger, }) {
|
|
30
|
-
var _a;
|
|
30
|
+
var _a, _b;
|
|
31
31
|
const driver = context.driver;
|
|
32
32
|
const environment = await driver.getEnvironment();
|
|
33
33
|
const features = await driver.getFeatures();
|
|
34
|
-
const cookies = (
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
const cookies = (_a = settings === null || settings === void 0 ? void 0 : settings.cookies) !== null && _a !== void 0 ? _a : [];
|
|
35
|
+
// assumption is that elementReferences are all in the frame which is `context`
|
|
36
|
+
// otherwise, the elements would still be found inside other frames, but `takeContextDomSnapshot` should be passed only the specific element references that it needs
|
|
37
|
+
const elements = [];
|
|
38
|
+
for (const elementReference of (_b = settings === null || settings === void 0 ? void 0 : settings.elementReferences) !== null && _b !== void 0 ? _b : []) {
|
|
39
|
+
elements.push(await context.elements(elementReference));
|
|
40
|
+
}
|
|
41
|
+
const snapshot = transformRawDomSnapshot(await takeContextDomSnapshot({ context }), elements);
|
|
42
|
+
snapshot.cookies = features.allCookies ? await driver.getCookies().catch(() => []) : cookies; // intentionally fetching cookies after the dom snapshot runs
|
|
37
43
|
return snapshot;
|
|
38
44
|
async function takeContextDomSnapshot({ context }) {
|
|
39
45
|
// logger.log(`taking dom snapshot. ${context._reference ? `context referece: ${JSON.stringify(context._reference)}` : ''}`)
|
|
40
46
|
var _a, _b, _c;
|
|
41
|
-
if (!features.allCookies) {
|
|
42
|
-
cookies.push(...(await context.getCookies()));
|
|
43
|
-
}
|
|
44
47
|
const arg = {
|
|
45
48
|
dontFetchResources: settings === null || settings === void 0 ? void 0 : settings.disableBrowserFetching,
|
|
46
49
|
skipResources: settings === null || settings === void 0 ? void 0 : settings.skipResources,
|
|
@@ -50,6 +53,7 @@ async function takeDomSnapshot({ context, settings, logger, }) {
|
|
|
50
53
|
serializeResources: true,
|
|
51
54
|
compressResources: false,
|
|
52
55
|
showLogs: settings === null || settings === void 0 ? void 0 : settings.showLogs,
|
|
56
|
+
elements,
|
|
53
57
|
};
|
|
54
58
|
const scripts = {
|
|
55
59
|
main: features.canExecuteOnlyFunctionScripts
|
|
@@ -65,6 +69,10 @@ async function takeDomSnapshot({ context, settings, logger, }) {
|
|
|
65
69
|
executionTimeout: (_b = settings === null || settings === void 0 ? void 0 : settings.executionTimeout) !== null && _b !== void 0 ? _b : 5 * 60 * 1000,
|
|
66
70
|
pollTimeout: (_c = settings === null || settings === void 0 ? void 0 : settings.pollTimeout) !== null && _c !== void 0 ? _c : 200,
|
|
67
71
|
});
|
|
72
|
+
// intentionally fetching cookies after the dom snapshot runs
|
|
73
|
+
if (!features.allCookies) {
|
|
74
|
+
cookies.push(...(await context.getCookies()));
|
|
75
|
+
}
|
|
68
76
|
const crossFrames = extractCrossFrames({ snapshot, logger });
|
|
69
77
|
for (const { reference, parentSnapshot, cdtNode } of crossFrames) {
|
|
70
78
|
const frameContext = await context
|
|
@@ -88,16 +96,14 @@ async function takeDomSnapshot({ context, settings, logger, }) {
|
|
|
88
96
|
cdtNode.attributes.push({ name: 'data-applitools-src', value: frameSnapshot.url });
|
|
89
97
|
}
|
|
90
98
|
}
|
|
91
|
-
logger
|
|
92
|
-
logger.log(`blobs urls (${snapshot.blobs.length}):`, JSON.stringify(snapshot.blobs.map(({ url }) => url)));
|
|
93
|
-
logger.log(`resource urls (${snapshot.resourceUrls.length}):`, JSON.stringify(snapshot.resourceUrls));
|
|
99
|
+
logSnapshot(logger, snapshot);
|
|
94
100
|
return snapshot;
|
|
95
101
|
}
|
|
96
102
|
}
|
|
97
103
|
exports.takeDomSnapshot = takeDomSnapshot;
|
|
98
|
-
function transformRawDomSnapshot(snapshot) {
|
|
99
|
-
const { blobs, selector: _, crossFrames: __, ...rest } = snapshot;
|
|
100
|
-
|
|
104
|
+
function transformRawDomSnapshot(snapshot, elements) {
|
|
105
|
+
const { blobs, safeSelectors, selector: _, crossFrames: __, ...rest } = snapshot;
|
|
106
|
+
const domSnapshot = {
|
|
101
107
|
...rest,
|
|
102
108
|
resourceContents: blobs.reduce((resourceContents, blob) => {
|
|
103
109
|
return {
|
|
@@ -107,6 +113,16 @@ function transformRawDomSnapshot(snapshot) {
|
|
|
107
113
|
}, {}),
|
|
108
114
|
frames: snapshot.frames.map(frameSnapshot => transformRawDomSnapshot(frameSnapshot)),
|
|
109
115
|
};
|
|
116
|
+
if (elements === null || elements === void 0 ? void 0 : elements.length) {
|
|
117
|
+
domSnapshot.generatedSelectors = elements.map((elements, i) => {
|
|
118
|
+
var _a, _b;
|
|
119
|
+
return ({
|
|
120
|
+
originalSelector: (_b = (_a = elements[0]) === null || _a === void 0 ? void 0 : _a.commonSelector) !== null && _b !== void 0 ? _b : null,
|
|
121
|
+
safeSelector: safeSelectors[i],
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return domSnapshot;
|
|
110
126
|
}
|
|
111
127
|
function extractCrossFrames({ snapshot, parent = null, logger, }) {
|
|
112
128
|
var _a;
|
|
@@ -128,7 +144,28 @@ function extractCrossFrames({ snapshot, parent = null, logger, }) {
|
|
|
128
144
|
: []),
|
|
129
145
|
];
|
|
130
146
|
});
|
|
131
|
-
logger.log(
|
|
147
|
+
logger.log(...(snapshot.crossFrames
|
|
148
|
+
? [
|
|
149
|
+
`frames paths for ${JSON.stringify(snapshot.crossFrames)}:`,
|
|
150
|
+
crossFrames.map(selector => ({
|
|
151
|
+
// we don't want `selector.parentSnapshot` to be logged - the size of it can be huge
|
|
152
|
+
cdtNode: selector.cdtNode,
|
|
153
|
+
reference: selector.reference,
|
|
154
|
+
})),
|
|
155
|
+
]
|
|
156
|
+
: ['no cross frames found']));
|
|
132
157
|
return crossFrames;
|
|
133
158
|
}
|
|
134
|
-
|
|
159
|
+
function logSnapshot(logger, snapshot) {
|
|
160
|
+
try {
|
|
161
|
+
logger.log(`dom snapshot cdt length: ${snapshot.cdt.length}`);
|
|
162
|
+
logger.log(`blobs urls (${snapshot.blobs.length}):`, JSON.stringify(snapshot.blobs.map(({ url }) => url)));
|
|
163
|
+
logger.log(`resource urls (${snapshot.resourceUrls.length}):`, JSON.stringify(snapshot.resourceUrls));
|
|
164
|
+
logger.log(`cdt nodes with data-applitools-selector: ${JSON.stringify(snapshot.cdt.filter(node => { var _a; return (_a = node.attributes) === null || _a === void 0 ? void 0 : _a.some(attr => attr.name === 'data-applitools-selector'); }))}`);
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
logger.error(`error while logging cdt`, err);
|
|
168
|
+
}
|
|
169
|
+
if (snapshot.error)
|
|
170
|
+
logger.error('snapshot error:', snapshot.error);
|
|
171
|
+
}
|
|
@@ -38,7 +38,7 @@ const utils = __importStar(require("@applitools/utils"));
|
|
|
38
38
|
const lang = __importStar(require("../../lang"));
|
|
39
39
|
__exportStar(require("./take-dom-snapshot"), exports);
|
|
40
40
|
async function takeDomSnapshots({ driver, settings, hooks, provides, logger, }) {
|
|
41
|
-
var _a, _b
|
|
41
|
+
var _a, _b;
|
|
42
42
|
// calculating cookies here once so that we (a) don't do it for each dom snapshot, and (b) do it before generating safe selectors
|
|
43
43
|
const features = await driver.getFeatures();
|
|
44
44
|
settings.cookies = features.allCookies ? await driver.getCookies().catch(() => []) : [];
|
|
@@ -50,16 +50,10 @@ async function takeDomSnapshots({ driver, settings, hooks, provides, logger, })
|
|
|
50
50
|
}
|
|
51
51
|
logger.log(`taking single dom snapshot`);
|
|
52
52
|
await beforeEachSnapshot();
|
|
53
|
-
// it's important that we calculate safe selectors as close as possible to taking the dom snapshot
|
|
54
|
-
const safeSelectorResult = await (0, generate_safe_selectors_1.generateSafeSelectors)({
|
|
55
|
-
context: currentContext,
|
|
56
|
-
elementReferences: settings.elementReferences,
|
|
57
|
-
});
|
|
58
53
|
const snapshot = await (0, take_dom_snapshot_1.takeDomSnapshot)({ context: currentContext, settings, logger });
|
|
59
|
-
|
|
60
|
-
return Array(settings.environments.length).fill({ ...snapshot, generatedSelectors: safeSelectorResult === null || safeSelectorResult === void 0 ? void 0 : safeSelectorResult.selectors });
|
|
54
|
+
return Array(settings.environments.length).fill(snapshot);
|
|
61
55
|
}
|
|
62
|
-
const isStrictBreakpoints = utils.types.isArray((
|
|
56
|
+
const isStrictBreakpoints = utils.types.isArray((_b = settings.layoutBreakpoints) === null || _b === void 0 ? void 0 : _b.breakpoints);
|
|
63
57
|
const requiredWidths = await settings.environments.reduce(async (prev, environment, index) => {
|
|
64
58
|
const { name, width } = (await extractEnvironmentInfo(environment));
|
|
65
59
|
const requiredWidths = await prev;
|
|
@@ -92,7 +86,7 @@ async function takeDomSnapshots({ driver, settings, hooks, provides, logger, })
|
|
|
92
86
|
requiredWidths.forEach((browsers, requiredWidth) => entries.push({ viewportSize: { width: requiredWidth, height: initialViewportSize.height }, browsers }));
|
|
93
87
|
logger.log(`All entries to take dom snapshots for`, entries);
|
|
94
88
|
// making safe selectors before any resize in order to make sure fallback selectors are created
|
|
95
|
-
|
|
89
|
+
await (0, generate_safe_selectors_1.generateSafeSelectors)({
|
|
96
90
|
context: currentContext,
|
|
97
91
|
elementReferences: settings.elementReferences,
|
|
98
92
|
});
|
|
@@ -132,22 +126,14 @@ async function takeDomSnapshots({ driver, settings, hooks, provides, logger, })
|
|
|
132
126
|
await (0, wait_for_lazy_load_1.waitForLazyLoad)({ context: currentContext, settings: settings.lazyLoad, logger });
|
|
133
127
|
}
|
|
134
128
|
await beforeEachSnapshot();
|
|
135
|
-
// it's important that we calculate safe selectors as close as possible to taking the dom snapshot
|
|
136
|
-
safeSelectorResult = await (0, generate_safe_selectors_1.generateSafeSelectors)({
|
|
137
|
-
context: currentContext,
|
|
138
|
-
elementReferences: settings.elementReferences,
|
|
139
|
-
});
|
|
140
129
|
const snapshot = await (0, take_dom_snapshot_1.takeDomSnapshot)({ context: currentContext, settings, logger });
|
|
141
|
-
browsers.forEach(({ index }) => (snapshots[index] =
|
|
130
|
+
browsers.forEach(({ index }) => (snapshots[index] = snapshot));
|
|
142
131
|
}
|
|
143
132
|
await driver.setViewportSize(initialViewportSize);
|
|
144
133
|
if (settings.layoutBreakpoints.reload) {
|
|
145
134
|
await driver.reloadPage();
|
|
146
135
|
await beforeEachSnapshot();
|
|
147
136
|
}
|
|
148
|
-
else {
|
|
149
|
-
await (safeSelectorResult === null || safeSelectorResult === void 0 ? void 0 : safeSelectorResult.cleanupGeneratedSelectors());
|
|
150
|
-
}
|
|
151
137
|
return snapshots;
|
|
152
138
|
async function beforeEachSnapshot() {
|
|
153
139
|
var _a, _b;
|
|
@@ -27,6 +27,7 @@ function toGeneratedSelectors({ elementReferences, transformElementReference, })
|
|
|
27
27
|
calculate = generatedSelectors.slice(offset);
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
|
+
// the entire else statement should be a dead code that was used for NMG, will be removed later
|
|
30
31
|
target = elementReferences.target && transformElementReference(elementReferences.target);
|
|
31
32
|
scrolling = elementReferences.scrolling && transformElementReference(elementReferences.scrolling);
|
|
32
33
|
calculate = ((_c = elementReferences.calculate) !== null && _c !== void 0 ? _c : []).map(elementReference => {
|
package/dist/universal/core.js
CHANGED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.isISODate = exports.extractBranchingTimestamp = exports.extractBuildIdFromCI = exports.extractGitRepo = exports.extractGitBranch = exports.extractLatestCommitInfo = exports.cacheKey = void 0;
|
|
30
|
+
const utils = __importStar(require("@applitools/utils"));
|
|
31
|
+
const fs_1 = __importDefault(require("fs"));
|
|
32
|
+
const path_1 = __importDefault(require("path"));
|
|
33
|
+
const logger_1 = require("@applitools/logger");
|
|
34
|
+
exports.cacheKey = 'default';
|
|
35
|
+
exports.extractLatestCommitInfo = utils.general.cachify(async function ({ execOptions, logger = (0, logger_1.makeLogger)(), }) {
|
|
36
|
+
let result;
|
|
37
|
+
try {
|
|
38
|
+
const githubPullRequestLastCommitSha = await extractGithubPullRequestLastCommitSha();
|
|
39
|
+
result = await executeWithLog(`git log ${githubPullRequestLastCommitSha !== null && githubPullRequestLastCommitSha !== void 0 ? githubPullRequestLastCommitSha : ''} -1 --format="%aI %H"`, {
|
|
40
|
+
execOptions,
|
|
41
|
+
logger,
|
|
42
|
+
});
|
|
43
|
+
if (result.stderr) {
|
|
44
|
+
logger.log(`Error during extracting commit information from git`, result.stderr);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const [timestamp, sha] = result.stdout.trim().split(' ');
|
|
48
|
+
if (isISODate(timestamp)) {
|
|
49
|
+
return { sha, timestamp };
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
logger.log(`latestCommitInfo.timestamp is an invalid ISO date string: ${timestamp}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
logger.log(`Error during parsing commit hash from git`, err, result === null || result === void 0 ? void 0 : result.stdout);
|
|
58
|
+
}
|
|
59
|
+
async function extractGithubPullRequestLastCommitSha() {
|
|
60
|
+
var _a, _b, _c;
|
|
61
|
+
if (((_a = process.env.GITHUB_EVENT_NAME) === null || _a === void 0 ? void 0 : _a.startsWith('pull_request')) && process.env.GITHUB_EVENT_PATH) {
|
|
62
|
+
await executeWithLog(`git fetch origin --depth=2`, { execOptions, logger });
|
|
63
|
+
const event = await fs_1.default.promises.readFile(process.env.GITHUB_EVENT_PATH, 'utf-8').then(JSON.parse);
|
|
64
|
+
return (_c = (_b = event === null || event === void 0 ? void 0 : event.pull_request) === null || _b === void 0 ? void 0 : _b.head) === null || _c === void 0 ? void 0 : _c.sha;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}, () => exports.cacheKey);
|
|
68
|
+
exports.extractGitBranch = utils.general.cachify(async function ({ execOptions, logger = (0, logger_1.makeLogger)() }) {
|
|
69
|
+
if (process.env.GITHUB_HEAD_REF) {
|
|
70
|
+
return process.env.GITHUB_HEAD_REF;
|
|
71
|
+
}
|
|
72
|
+
if (process.env.GITHUB_REF) {
|
|
73
|
+
return process.env.GITHUB_REF.split('/')[2]; // refs/heads/<branch_name>
|
|
74
|
+
}
|
|
75
|
+
const result = await executeWithLog('git branch --show-current', { execOptions, logger });
|
|
76
|
+
if (result.stderr) {
|
|
77
|
+
logger.log(`Error during extracting current branch from git`, result.stderr);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const branch = result.stdout.trim();
|
|
81
|
+
logger.log(`Extracted current git branch: "${branch}"`);
|
|
82
|
+
return branch;
|
|
83
|
+
}
|
|
84
|
+
}, () => exports.cacheKey);
|
|
85
|
+
exports.extractGitRepo = utils.general.cachify(async function ({ execOptions, logger = (0, logger_1.makeLogger)() }) {
|
|
86
|
+
const remotes = await extractRemotes();
|
|
87
|
+
logger.log(`Extracted remotes from git: ${remotes}`);
|
|
88
|
+
const remote = remotes.includes('origin') ? 'origin' : remotes[0];
|
|
89
|
+
const result = await executeWithLog(`git remote get-url ${remote}`, { execOptions, logger });
|
|
90
|
+
if (result.stderr) {
|
|
91
|
+
logger.log(`Error during extracting remote url from git`, result.stderr);
|
|
92
|
+
return {};
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
const remoteUrl = result.stdout.trim();
|
|
96
|
+
logger.log(`Extracted url for git remote ${remote}: ${remoteUrl}`);
|
|
97
|
+
return extractRepoFromRemoteUrl(remoteUrl);
|
|
98
|
+
}
|
|
99
|
+
async function extractRemotes() {
|
|
100
|
+
const result = await executeWithLog('git remote show', { execOptions, logger });
|
|
101
|
+
if (result.stderr) {
|
|
102
|
+
logger.log(`Error during extracting remotes from git`, result.stderr);
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
return result.stdout.trim().split(/\s+/);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function extractRepoFromRemoteUrl(remoteUrl) {
|
|
110
|
+
try {
|
|
111
|
+
const url = new URL(remoteUrl);
|
|
112
|
+
return { name: path_1.default.basename(url.pathname, '.git'), owner: path_1.default.dirname(url.pathname).replace(/^\//, '') };
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
return { name: path_1.default.basename(remoteUrl, '.git'), owner: path_1.default.dirname(remoteUrl).replace(/^[^:]+:/, '') };
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}, () => exports.cacheKey);
|
|
119
|
+
async function extractBuildIdFromCI() {
|
|
120
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
121
|
+
return ((_k = (_j = (_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a = process.env.GITHUB_RUN_ID) !== null && _a !== void 0 ? _a : process.env.CI_JOB_ID) !== null && _b !== void 0 ? _b : process.env.CIRCLE_BUILD_NUM) !== null && _c !== void 0 ? _c : process.env.BUILD_BUILDID) !== null && _d !== void 0 ? _d : process.env.BITBUCKET_BUILD_NUMBER) !== null && _e !== void 0 ? _e : process.env.CODEBUILD_BUILD_ID) !== null && _f !== void 0 ? _f : process.env.BUILD_ID) !== null && _g !== void 0 ? _g : process.env.BUILD_NUMBER) !== null && _h !== void 0 ? _h : process.env.TRAVIS_BUILD_ID) !== null && _j !== void 0 ? _j : process.env.BUILDKITE_BUILD_ID) !== null && _k !== void 0 ? _k : process.env.BAMBOO // TODO: Bamboo
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
exports.extractBuildIdFromCI = extractBuildIdFromCI;
|
|
125
|
+
exports.extractBranchingTimestamp = utils.general.cachify(async function ({ branchName, parentBranchName, execOptions, logger = (0, logger_1.makeLogger)(), }) {
|
|
126
|
+
var _a;
|
|
127
|
+
logger = logger.extend({ tags: [`extract-branching-timestamp-${utils.general.shortid()}`] });
|
|
128
|
+
const command = `HASH=$(git merge-base ${branchName} ${parentBranchName}) && git show -q --format=%aI $HASH`;
|
|
129
|
+
let result = await executeWithLog(command, { execOptions, logger });
|
|
130
|
+
if (result.stderr) {
|
|
131
|
+
const [, missingBranch] = (_a = result.stderr.match(/Not a valid object name ([^\s]+)/)) !== null && _a !== void 0 ? _a : [];
|
|
132
|
+
if (missingBranch) {
|
|
133
|
+
result = await executeWithLog(`git fetch origin ${missingBranch}:${missingBranch} && ${command}`, {
|
|
134
|
+
execOptions,
|
|
135
|
+
logger,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (!result.stdout) {
|
|
140
|
+
result = await executeWithLog(`git fetch origin --unshallow && ${command}`, { execOptions, logger });
|
|
141
|
+
}
|
|
142
|
+
const timestamp = result.stdout.replace(/\s/g, '');
|
|
143
|
+
if (isISODate(timestamp)) {
|
|
144
|
+
logger.log('git branching timestamp successfully extracted', timestamp);
|
|
145
|
+
return timestamp;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
logger.log(`Error during extracting merge timestamp: git branching timestamp is an invalid ISO date string: ${timestamp}. stderr: ${result.stderr}, stdout: ${result.stdout}`);
|
|
149
|
+
}
|
|
150
|
+
}, () => exports.cacheKey);
|
|
151
|
+
async function executeWithLog(command, { execOptions, logger = (0, logger_1.makeLogger)() } = {
|
|
152
|
+
execOptions: {},
|
|
153
|
+
logger: (0, logger_1.makeLogger)(),
|
|
154
|
+
}) {
|
|
155
|
+
logger.log(`executing command: ${command}`);
|
|
156
|
+
const result = await utils.process.execute(command, execOptions);
|
|
157
|
+
if (result.stderr && result.code) {
|
|
158
|
+
logger.log(`exit code: ${result.code}, stderr: ${result.stderr}`);
|
|
159
|
+
}
|
|
160
|
+
return result;
|
|
161
|
+
}
|
|
162
|
+
function isISODate(str) {
|
|
163
|
+
return /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\+\d{2}:\d{2})?/.test(str);
|
|
164
|
+
}
|
|
165
|
+
exports.isISODate = isISODate;
|
|
@@ -31,5 +31,11 @@ function populateEyesServerSettings(settings) {
|
|
|
31
31
|
(_d = settings.apiKey) !== null && _d !== void 0 ? _d : (settings.apiKey = utils.general.getEnvValue('API_KEY'));
|
|
32
32
|
(_e = settings.proxy) !== null && _e !== void 0 ? _e : (settings.proxy = utils.general.getEnvValue('PROXY_URL') ? { url: utils.general.getEnvValue('PROXY_URL') } : undefined);
|
|
33
33
|
(_f = settings.useDnsCache) !== null && _f !== void 0 ? _f : (settings.useDnsCache = utils.general.getEnvValue('USE_DNS_CACHE', 'boolean'));
|
|
34
|
+
return {
|
|
35
|
+
eyesServerUrl: settings.eyesServerUrl,
|
|
36
|
+
apiKey: settings.apiKey,
|
|
37
|
+
proxy: settings.proxy,
|
|
38
|
+
useDnsCache: settings.useDnsCache,
|
|
39
|
+
};
|
|
34
40
|
}
|
|
35
41
|
exports.populateEyesServerSettings = populateEyesServerSettings;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.21.1",
|
|
4
4
|
"homepage": "https://applitools.com",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
|
|
@@ -74,18 +74,18 @@
|
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@applitools/core-base": "1.
|
|
77
|
+
"@applitools/core-base": "1.18.0",
|
|
78
78
|
"@applitools/dom-capture": "11.5.0",
|
|
79
|
-
"@applitools/dom-snapshot": "4.11.
|
|
80
|
-
"@applitools/driver": "1.19.
|
|
81
|
-
"@applitools/ec-client": "1.9.
|
|
79
|
+
"@applitools/dom-snapshot": "4.11.4",
|
|
80
|
+
"@applitools/driver": "1.19.4",
|
|
81
|
+
"@applitools/ec-client": "1.9.10",
|
|
82
82
|
"@applitools/logger": "2.0.18",
|
|
83
|
-
"@applitools/nml-client": "1.8.
|
|
83
|
+
"@applitools/nml-client": "1.8.14",
|
|
84
84
|
"@applitools/req": "1.7.2",
|
|
85
|
-
"@applitools/screenshoter": "3.
|
|
86
|
-
"@applitools/snippets": "2.5.
|
|
85
|
+
"@applitools/screenshoter": "3.9.1",
|
|
86
|
+
"@applitools/snippets": "2.5.2",
|
|
87
87
|
"@applitools/socket": "1.1.18",
|
|
88
|
-
"@applitools/spec-driver-webdriver": "1.1.
|
|
88
|
+
"@applitools/spec-driver-webdriver": "1.1.16",
|
|
89
89
|
"@applitools/ufg-client": "1.13.1",
|
|
90
90
|
"@applitools/utils": "1.7.4",
|
|
91
91
|
"@types/ws": "8.5.5",
|
|
@@ -100,8 +100,8 @@
|
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@applitools/bongo": "^5.10.0",
|
|
102
102
|
"@applitools/sea": "^1.0.0",
|
|
103
|
-
"@applitools/spec-driver-puppeteer": "^1.4.
|
|
104
|
-
"@applitools/spec-driver-selenium": "^1.5.
|
|
103
|
+
"@applitools/spec-driver-puppeteer": "^1.4.16",
|
|
104
|
+
"@applitools/spec-driver-selenium": "^1.5.87",
|
|
105
105
|
"@applitools/test-server": "^1.2.2",
|
|
106
106
|
"@applitools/test-utils": "^1.5.17",
|
|
107
107
|
"@applitools/tunnel-client": "^1.5.8",
|
|
@@ -148,6 +148,7 @@ export interface ScreenshotSettings<TSpec extends SpecType> extends BaseCore.Ima
|
|
|
148
148
|
waitBetweenStitches?: number;
|
|
149
149
|
lazyLoad?: boolean | LazyLoadOptions;
|
|
150
150
|
sendDom?: boolean;
|
|
151
|
+
captureStatusBar?: boolean;
|
|
151
152
|
}
|
|
152
153
|
export type LocateSettings<TLocator extends string, TSpec extends SpecType> = BaseCore.LocateSettings<TLocator, Region | ElementReference<TSpec>> & ScreenshotSettings<TSpec>;
|
|
153
154
|
export type LocateTextSettings<TPattern extends string, TSpec extends SpecType> = BaseCore.LocateTextSettings<TPattern, Region | ElementReference<TSpec>> & ScreenshotSettings<TSpec>;
|
|
@@ -13,8 +13,7 @@ type Options<TSpec extends SpecType> = {
|
|
|
13
13
|
base?: BaseCore;
|
|
14
14
|
asyncCache?: AsyncCache;
|
|
15
15
|
agentId?: string;
|
|
16
|
-
cwd?: string;
|
|
17
16
|
logger?: Logger;
|
|
18
17
|
};
|
|
19
|
-
export declare function makeAutonomousCore<TSpec extends SpecType>({ spec, clients, base: defaultBase, asyncCache, agentId,
|
|
18
|
+
export declare function makeAutonomousCore<TSpec extends SpecType>({ spec, clients, base: defaultBase, asyncCache, agentId, logger: defaultLogger, }?: Options<TSpec>): AutonomousCore<TSpec>;
|
|
20
19
|
export {};
|
package/types/classic/core.d.ts
CHANGED
|
@@ -11,9 +11,8 @@ type Options<TSpec extends SpecType> = {
|
|
|
11
11
|
base?: BaseCore;
|
|
12
12
|
concurrency?: number;
|
|
13
13
|
agentId?: string;
|
|
14
|
-
cwd?: string;
|
|
15
14
|
logger?: Logger;
|
|
16
15
|
offlineLocationPath?: string;
|
|
17
16
|
};
|
|
18
|
-
export declare function makeCore<TSpec extends SpecType>({ spec, clients, base: defaultBase, concurrency, agentId,
|
|
17
|
+
export declare function makeCore<TSpec extends SpecType>({ spec, clients, base: defaultBase, concurrency, agentId, logger: defaultLogger, offlineLocationPath, }: Options<TSpec>): Core<TSpec>;
|
|
19
18
|
export {};
|
package/types/open-eyes.d.ts
CHANGED
|
@@ -19,8 +19,9 @@ type Options<TSpec extends SpecType, TType extends 'classic' | 'ufg'> = {
|
|
|
19
19
|
environment?: Record<string, any>;
|
|
20
20
|
logger: Logger;
|
|
21
21
|
asyncCache?: AsyncCache;
|
|
22
|
+
cwd?: string;
|
|
22
23
|
};
|
|
23
|
-
export declare function makeOpenEyes<TSpec extends SpecType, TDefaultType extends 'classic' | 'ufg' = 'classic'>({ type: defaultType, clients, batch, removeDuplicateTests, core, cores, spec, environment, logger: mainLogger, asyncCache, }: Options<TSpec, TDefaultType>): <TType extends "classic" | "ufg" = TDefaultType>({ type, settings, config, target, logger, }: {
|
|
24
|
+
export declare function makeOpenEyes<TSpec extends SpecType, TDefaultType extends 'classic' | 'ufg' = 'classic'>({ type: defaultType, clients, batch, removeDuplicateTests, core, cores, spec, environment, logger: mainLogger, asyncCache, cwd, }: Options<TSpec, TDefaultType>): <TType extends "classic" | "ufg" = TDefaultType>({ type, settings: openSettings, config, target, logger, }: {
|
|
24
25
|
type?: TType | undefined;
|
|
25
26
|
settings?: Partial<OpenSettings<TDefaultType> & OpenSettings<TType>> | undefined;
|
|
26
27
|
config?: (Config<TSpec, TDefaultType> & Config<TSpec, TType>) | undefined;
|
package/types/ufg/core.d.ts
CHANGED
|
@@ -15,9 +15,8 @@ type Options<TSpec extends SpecType> = {
|
|
|
15
15
|
concurrency?: number;
|
|
16
16
|
fetchConcurrency?: number;
|
|
17
17
|
agentId?: string;
|
|
18
|
-
cwd?: string;
|
|
19
18
|
logger?: Logger;
|
|
20
19
|
offlineLocationPath?: string;
|
|
21
20
|
};
|
|
22
|
-
export declare function makeCore<TSpec extends SpecType>({ spec, clients, base: defaultBase, asyncCache, concurrency, offlineLocationPath, fetchConcurrency, agentId,
|
|
21
|
+
export declare function makeCore<TSpec extends SpecType>({ spec, clients, base: defaultBase, asyncCache, concurrency, offlineLocationPath, fetchConcurrency, agentId, logger: defaultLogger, }: Options<TSpec>): Core<TSpec>;
|
|
23
22
|
export {};
|
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
import { type SpecType, type Context, type ElementReference
|
|
2
|
-
type GeneratedSafeSelector<TSpec extends SpecType> = {
|
|
3
|
-
selectors: {
|
|
4
|
-
safeSelector: CommonSelector | null;
|
|
5
|
-
originalSelector: CommonSelector | null;
|
|
6
|
-
elementReference: ElementReference<TSpec>;
|
|
7
|
-
}[];
|
|
8
|
-
cleanupGeneratedSelectors: () => Promise<void>;
|
|
9
|
-
};
|
|
10
|
-
export declare function generateSafeSelectors<TSpec extends SpecType>({ context, elementReferences, }: {
|
|
11
|
-
context: Context<TSpec>;
|
|
12
|
-
elementReferences: ElementReference<TSpec>[];
|
|
13
|
-
}): Promise<GeneratedSafeSelector<TSpec>>;
|
|
14
|
-
export declare function generateSafeSelectors<TSpec extends SpecType>({ context, elementReferences, }: {
|
|
15
|
-
context: Context<TSpec>;
|
|
16
|
-
elementReferences: undefined | [];
|
|
17
|
-
}): Promise<undefined>;
|
|
1
|
+
import { type SpecType, type Context, type ElementReference } from '@applitools/driver';
|
|
18
2
|
export declare function generateSafeSelectors<TSpec extends SpecType>({ context, elementReferences, }: {
|
|
19
3
|
context: Context<TSpec>;
|
|
20
4
|
elementReferences?: ElementReference<TSpec>[];
|
|
21
|
-
}): Promise<
|
|
22
|
-
|
|
5
|
+
}): Promise<{
|
|
6
|
+
generatedSelectors: string[][][];
|
|
7
|
+
}>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type DomSnapshot } from '../types';
|
|
2
2
|
import { type Logger } from '@applitools/logger';
|
|
3
|
-
import { type SpecType, type Context, type Cookie } from '@applitools/driver';
|
|
3
|
+
import { type SpecType, type Context, type Cookie, type ElementReference, type CommonSelector } from '@applitools/driver';
|
|
4
4
|
export type RawDomSnapshot = {
|
|
5
5
|
url: string;
|
|
6
|
-
selector
|
|
6
|
+
selector?: string;
|
|
7
7
|
cdt: {
|
|
8
8
|
attributes: {
|
|
9
9
|
name: string;
|
|
@@ -22,8 +22,10 @@ export type RawDomSnapshot = {
|
|
|
22
22
|
}[];
|
|
23
23
|
srcAttr: string | null;
|
|
24
24
|
scriptVersion: string;
|
|
25
|
+
safeSelectors?: (CommonSelector | null)[];
|
|
26
|
+
error?: string;
|
|
25
27
|
};
|
|
26
|
-
export type DomSnapshotSettings = {
|
|
28
|
+
export type DomSnapshotSettings<TSpec extends SpecType> = {
|
|
27
29
|
disableBrowserFetching?: boolean;
|
|
28
30
|
skipResources?: string[];
|
|
29
31
|
chunkByteLength?: number;
|
|
@@ -31,18 +33,10 @@ export type DomSnapshotSettings = {
|
|
|
31
33
|
pollTimeout?: number;
|
|
32
34
|
showLogs?: boolean;
|
|
33
35
|
cookies?: Cookie[];
|
|
36
|
+
elementReferences?: ElementReference<TSpec>[];
|
|
34
37
|
};
|
|
35
38
|
export declare function takeDomSnapshot<TSpec extends SpecType>({ context, settings, logger, }: {
|
|
36
39
|
context: Context<TSpec>;
|
|
37
|
-
settings?: DomSnapshotSettings
|
|
40
|
+
settings?: DomSnapshotSettings<TSpec>;
|
|
38
41
|
logger: Logger;
|
|
39
42
|
}): Promise<DomSnapshot>;
|
|
40
|
-
export declare function extractCrossFrames({ snapshot, parent, logger, }: {
|
|
41
|
-
snapshot: RawDomSnapshot;
|
|
42
|
-
parent?: any;
|
|
43
|
-
logger: Logger;
|
|
44
|
-
}): {
|
|
45
|
-
cdtNode: RawDomSnapshot['cdt'][number];
|
|
46
|
-
reference: any;
|
|
47
|
-
parentSnapshot: RawDomSnapshot;
|
|
48
|
-
}[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { DomSnapshot, LazyLoadOptions } from '../types';
|
|
2
2
|
import { type Size } from '@applitools/utils';
|
|
3
3
|
import { type Logger } from '@applitools/logger';
|
|
4
|
-
import { type SpecType, type Driver
|
|
4
|
+
import { type SpecType, type Driver } from '@applitools/driver';
|
|
5
5
|
import { type Environment } from '@applitools/ufg-client';
|
|
6
6
|
import { type DomSnapshotSettings } from './take-dom-snapshot';
|
|
7
7
|
export * from './take-dom-snapshot';
|
|
8
|
-
export type DomSnapshotsSettings<TSpec extends SpecType> = DomSnapshotSettings & {
|
|
8
|
+
export type DomSnapshotsSettings<TSpec extends SpecType> = DomSnapshotSettings<TSpec> & {
|
|
9
9
|
environments: Environment[];
|
|
10
10
|
waitBeforeCapture?: number | (() => Promise<void>);
|
|
11
11
|
layoutBreakpoints?: {
|
|
@@ -13,7 +13,6 @@ export type DomSnapshotsSettings<TSpec extends SpecType> = DomSnapshotSettings &
|
|
|
13
13
|
reload?: boolean;
|
|
14
14
|
};
|
|
15
15
|
lazyLoad?: boolean | LazyLoadOptions;
|
|
16
|
-
elementReferences?: ElementReference<TSpec>[];
|
|
17
16
|
};
|
|
18
17
|
export declare function takeDomSnapshots<TSpec extends SpecType>({ driver, settings, hooks, provides, logger, }: {
|
|
19
18
|
driver: Driver<TSpec>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { ExecOptions } from 'child_process';
|
|
3
|
+
import { type Logger } from '@applitools/logger';
|
|
4
|
+
type Options = {
|
|
5
|
+
execOptions?: ExecOptions;
|
|
6
|
+
logger: Logger;
|
|
7
|
+
};
|
|
8
|
+
type ExtractGitBranchingTimestampOptions = {
|
|
9
|
+
branchName: string;
|
|
10
|
+
execOptions?: ExecOptions;
|
|
11
|
+
logger?: Logger;
|
|
12
|
+
parentBranchName: string;
|
|
13
|
+
};
|
|
14
|
+
type ExtractCurrentCommitTimestampOptions = {
|
|
15
|
+
execOptions?: ExecOptions;
|
|
16
|
+
logger?: Logger;
|
|
17
|
+
};
|
|
18
|
+
export declare const cacheKey = "default";
|
|
19
|
+
export declare const extractLatestCommitInfo: (({ execOptions, logger, }: ExtractCurrentCommitTimestampOptions) => Promise<{
|
|
20
|
+
timestamp: string;
|
|
21
|
+
sha: string;
|
|
22
|
+
} | undefined>) & {
|
|
23
|
+
getCachedValues(): Promise<{
|
|
24
|
+
timestamp: string;
|
|
25
|
+
sha: string;
|
|
26
|
+
} | undefined>[];
|
|
27
|
+
setCachedValue(key: any, value: Promise<{
|
|
28
|
+
timestamp: string;
|
|
29
|
+
sha: string;
|
|
30
|
+
} | undefined>): void;
|
|
31
|
+
clearCache(): void;
|
|
32
|
+
};
|
|
33
|
+
export declare const extractGitBranch: (({ execOptions, logger }: Options) => Promise<string | undefined>) & {
|
|
34
|
+
getCachedValues(): Promise<string | undefined>[];
|
|
35
|
+
setCachedValue(key: any, value: Promise<string | undefined>): void;
|
|
36
|
+
clearCache(): void;
|
|
37
|
+
};
|
|
38
|
+
export declare const extractGitRepo: (({ execOptions, logger }: Options) => Promise<{
|
|
39
|
+
name?: string;
|
|
40
|
+
owner?: string;
|
|
41
|
+
}>) & {
|
|
42
|
+
getCachedValues(): Promise<{
|
|
43
|
+
name?: string | undefined;
|
|
44
|
+
owner?: string | undefined;
|
|
45
|
+
}>[];
|
|
46
|
+
setCachedValue(key: any, value: Promise<{
|
|
47
|
+
name?: string | undefined;
|
|
48
|
+
owner?: string | undefined;
|
|
49
|
+
}>): void;
|
|
50
|
+
clearCache(): void;
|
|
51
|
+
};
|
|
52
|
+
export declare function extractBuildIdFromCI(): Promise<string | undefined>;
|
|
53
|
+
export declare const extractBranchingTimestamp: (({ branchName, parentBranchName, execOptions, logger, }: ExtractGitBranchingTimestampOptions) => Promise<string | undefined>) & {
|
|
54
|
+
getCachedValues(): Promise<string | undefined>[];
|
|
55
|
+
setCachedValue(key: any, value: Promise<string | undefined>): void;
|
|
56
|
+
clearCache(): void;
|
|
57
|
+
};
|
|
58
|
+
export declare function isISODate(str: string): boolean;
|
|
59
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { EyesServerSettings } from '../types';
|
|
2
|
-
export declare function populateEyesServerSettings(settings: Partial<EyesServerSettings>):
|
|
2
|
+
export declare function populateEyesServerSettings(settings: Partial<EyesServerSettings>): EyesServerSettings;
|