@applitools/core 4.27.1 → 4.29.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/CHANGELOG.md +141 -0
- package/dist/autonomous/open-eyes.js +2 -0
- package/dist/classic/core.js +3 -3
- package/dist/cli/cli.js +5 -0
- package/dist/close-batch.js +2 -0
- package/dist/core.js +6 -5
- package/dist/delete-test.js +3 -0
- package/dist/extract-text.js +2 -0
- package/dist/locate-text.js +2 -0
- package/dist/locate.js +2 -0
- package/dist/make-manager.js +5 -5
- package/dist/offline/run-offline-snapshots.js +17 -5
- package/dist/open-eyes.js +2 -0
- package/dist/ufg/core.js +3 -3
- package/dist/ufg/utils/take-dom-snapshot.js +7 -4
- package/dist/universal/core-server.js +18 -2
- package/dist/universal/history.js +4 -0
- package/package.json +18 -18
- package/types/classic/core.d.ts +2 -1
- package/types/core.d.ts +2 -1
- package/types/make-manager.d.ts +2 -1
- package/types/offline/run-offline-snapshots.d.ts +1 -0
- package/types/ufg/core.d.ts +2 -1
- package/types/universal/core-server.d.ts +2 -1
- package/dist/universal/core.js +0 -174
- package/types/universal/core.d.ts +0 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,146 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.29.0](https://github.com/Applitools-Dev/sdk/compare/js/core@4.28.0...js/core@4.29.0) (2025-01-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* jsonFilePath in offline mode ([#2734](https://github.com/Applitools-Dev/sdk/issues/2734)) ([2f9fbe8](https://github.com/Applitools-Dev/sdk/commit/2f9fbe8fc3c5212db6b7cc58a98b041c3ffd5572))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* support batching tests in distributed env - close batch only when required ([#2733](https://github.com/Applitools-Dev/sdk/issues/2733)) ([2e59e4a](https://github.com/Applitools-Dev/sdk/commit/2e59e4a76edcc02b8888dfc78a42749bae76f79c))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Dependencies
|
|
17
|
+
|
|
18
|
+
* @applitools/dom-snapshot bumped to 4.11.14
|
|
19
|
+
#### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* remove side-eyes and fix code scanning issues ([#2712](https://github.com/Applitools-Dev/sdk/issues/2712)) ([cda98e4](https://github.com/Applitools-Dev/sdk/commit/cda98e4748c73cd97c11f646a2b5e26ff9416892))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
* @applitools/snippets bumped to 2.6.4
|
|
26
|
+
#### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* remove side-eyes and fix code scanning issues ([#2712](https://github.com/Applitools-Dev/sdk/issues/2712)) ([cda98e4](https://github.com/Applitools-Dev/sdk/commit/cda98e4748c73cd97c11f646a2b5e26ff9416892))
|
|
29
|
+
* @applitools/dom-capture bumped to 11.5.4
|
|
30
|
+
#### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* remove side-eyes and fix code scanning issues ([#2712](https://github.com/Applitools-Dev/sdk/issues/2712)) ([cda98e4](https://github.com/Applitools-Dev/sdk/commit/cda98e4748c73cd97c11f646a2b5e26ff9416892))
|
|
33
|
+
* @applitools/driver bumped to 1.20.3
|
|
34
|
+
|
|
35
|
+
* @applitools/spec-driver-webdriver bumped to 1.1.23
|
|
36
|
+
|
|
37
|
+
* @applitools/spec-driver-selenium bumped to 1.5.94
|
|
38
|
+
|
|
39
|
+
* @applitools/spec-driver-puppeteer bumped to 1.4.23
|
|
40
|
+
|
|
41
|
+
* @applitools/screenshoter bumped to 3.10.3
|
|
42
|
+
|
|
43
|
+
* @applitools/nml-client bumped to 1.8.22
|
|
44
|
+
|
|
45
|
+
* @applitools/ec-client bumped to 1.10.1
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## [4.28.0](https://github.com/Applitools-Dev/sdk/compare/js/core@4.27.1...js/core@4.28.0) (2024-12-31)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Features
|
|
52
|
+
|
|
53
|
+
* deterministic output in offline execution ([#2711](https://github.com/Applitools-Dev/sdk/issues/2711)) ([5e8c7ca](https://github.com/Applitools-Dev/sdk/commit/5e8c7ca43c98e7ba6aed0c1a66c5a60b4001aeff))
|
|
54
|
+
* logger masking ([#2640](https://github.com/Applitools-Dev/sdk/issues/2640)) ([bd69d21](https://github.com/Applitools-Dev/sdk/commit/bd69d21f6341447b1acdb042f4ee1a6328d7428f))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Bug Fixes
|
|
58
|
+
|
|
59
|
+
* take snapshots with coded regions on pages that has cross origin frames ([#2705](https://github.com/Applitools-Dev/sdk/issues/2705)) ([5972fec](https://github.com/Applitools-Dev/sdk/commit/5972fec890a1454a9f96c4eddcf17634e72111aa))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Dependencies
|
|
63
|
+
|
|
64
|
+
* @applitools/utils bumped to 1.7.7
|
|
65
|
+
#### Bug Fixes
|
|
66
|
+
|
|
67
|
+
* shim process execution functions for browser environment ([#2698](https://github.com/Applitools-Dev/sdk/issues/2698)) ([8d77db4](https://github.com/Applitools-Dev/sdk/commit/8d77db48e1c7fd54cad92c89a819a924255e5868))
|
|
68
|
+
* @applitools/logger bumped to 2.1.0
|
|
69
|
+
#### Features
|
|
70
|
+
|
|
71
|
+
* logger masking ([#2640](https://github.com/Applitools-Dev/sdk/issues/2640)) ([bd69d21](https://github.com/Applitools-Dev/sdk/commit/bd69d21f6341447b1acdb042f4ee1a6328d7428f))
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
* @applitools/dom-snapshot bumped to 4.11.13
|
|
76
|
+
#### Bug Fixes
|
|
77
|
+
|
|
78
|
+
* code scanning issue ([#2687](https://github.com/Applitools-Dev/sdk/issues/2687)) ([f301056](https://github.com/Applitools-Dev/sdk/commit/f301056cccfc9cc0c21ceedbd521d8f4b054f058))
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
* @applitools/socket bumped to 1.2.0
|
|
83
|
+
#### Features
|
|
84
|
+
|
|
85
|
+
* logger masking ([#2640](https://github.com/Applitools-Dev/sdk/issues/2640)) ([bd69d21](https://github.com/Applitools-Dev/sdk/commit/bd69d21f6341447b1acdb042f4ee1a6328d7428f))
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
* @applitools/dom-capture bumped to 11.5.3
|
|
90
|
+
#### Bug Fixes
|
|
91
|
+
|
|
92
|
+
* code scanning issue ([#2687](https://github.com/Applitools-Dev/sdk/issues/2687)) ([f301056](https://github.com/Applitools-Dev/sdk/commit/f301056cccfc9cc0c21ceedbd521d8f4b054f058))
|
|
93
|
+
* @applitools/ufg-client bumped to 1.16.0
|
|
94
|
+
#### Features
|
|
95
|
+
|
|
96
|
+
* deterministic output in offline execution ([#2711](https://github.com/Applitools-Dev/sdk/issues/2711)) ([5e8c7ca](https://github.com/Applitools-Dev/sdk/commit/5e8c7ca43c98e7ba6aed0c1a66c5a60b4001aeff))
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
#### Bug Fixes
|
|
100
|
+
|
|
101
|
+
* code scanning issue ([#2687](https://github.com/Applitools-Dev/sdk/issues/2687)) ([f301056](https://github.com/Applitools-Dev/sdk/commit/f301056cccfc9cc0c21ceedbd521d8f4b054f058))
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
* @applitools/spec-driver-webdriver bumped to 1.1.22
|
|
106
|
+
|
|
107
|
+
* @applitools/spec-driver-selenium bumped to 1.5.93
|
|
108
|
+
|
|
109
|
+
* @applitools/screenshoter bumped to 3.10.2
|
|
110
|
+
|
|
111
|
+
* @applitools/nml-client bumped to 1.8.21
|
|
112
|
+
|
|
113
|
+
* @applitools/tunnel-client bumped to 1.6.0
|
|
114
|
+
#### Features
|
|
115
|
+
|
|
116
|
+
* logger masking ([#2640](https://github.com/Applitools-Dev/sdk/issues/2640)) ([bd69d21](https://github.com/Applitools-Dev/sdk/commit/bd69d21f6341447b1acdb042f4ee1a6328d7428f))
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
* @applitools/ec-client bumped to 1.10.0
|
|
121
|
+
#### Features
|
|
122
|
+
|
|
123
|
+
* logger masking ([#2640](https://github.com/Applitools-Dev/sdk/issues/2640)) ([bd69d21](https://github.com/Applitools-Dev/sdk/commit/bd69d21f6341447b1acdb042f4ee1a6328d7428f))
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
* @applitools/req bumped to 1.7.6
|
|
128
|
+
|
|
129
|
+
* @applitools/image bumped to 1.1.16
|
|
130
|
+
|
|
131
|
+
* @applitools/driver bumped to 1.20.2
|
|
132
|
+
|
|
133
|
+
* @applitools/spec-driver-puppeteer bumped to 1.4.22
|
|
134
|
+
|
|
135
|
+
* @applitools/core-base bumped to 1.22.0
|
|
136
|
+
#### Features
|
|
137
|
+
|
|
138
|
+
* deterministic output in offline execution ([#2711](https://github.com/Applitools-Dev/sdk/issues/2711)) ([5e8c7ca](https://github.com/Applitools-Dev/sdk/commit/5e8c7ca43c98e7ba6aed0c1a66c5a60b4001aeff))
|
|
139
|
+
* logger masking ([#2640](https://github.com/Applitools-Dev/sdk/issues/2640)) ([bd69d21](https://github.com/Applitools-Dev/sdk/commit/bd69d21f6341447b1acdb042f4ee1a6328d7428f))
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
3
144
|
## [4.27.1](https://github.com/Applitools-Dev/sdk/compare/js/core@4.27.0...js/core@4.27.1) (2024-12-22)
|
|
4
145
|
|
|
5
146
|
|
|
@@ -5,6 +5,8 @@ const populate_eyes_server_settings_1 = require("../utils/populate-eyes-server-s
|
|
|
5
5
|
function makeOpenEyes({ core, logger: defaultLogger }) {
|
|
6
6
|
return async function openEyes({ settings, logger = defaultLogger, }) {
|
|
7
7
|
(0, populate_eyes_server_settings_1.populateEyesServerSettings)(settings);
|
|
8
|
+
logger.mask(settings.apiKey);
|
|
9
|
+
logger.mask(settings.eyesServerUrl);
|
|
8
10
|
return core.base.openEyes({ settings, logger });
|
|
9
11
|
};
|
|
10
12
|
}
|
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', logger: defaultLogger, offlineLocationPath, }) {
|
|
38
|
-
const logger = (0, logger_1.makeLogger)({ logger: defaultLogger, format: { label: 'core-classic' } });
|
|
37
|
+
function makeCore({ spec, clients, base: defaultBase, concurrency, agentId = 'core-classic', logger: defaultLogger, maskLog, offlineLocationPath, }) {
|
|
38
|
+
const logger = (0, logger_1.makeLogger)({ logger: defaultLogger, format: { label: 'core-classic' }, maskLog });
|
|
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, logger, offlineLocationPath });
|
|
40
|
+
const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId, concurrency, logger, offlineLocationPath, maskLog });
|
|
41
41
|
return utils.general.extend(base, core => {
|
|
42
42
|
return {
|
|
43
43
|
type: 'classic',
|
package/dist/cli/cli.js
CHANGED
|
@@ -103,6 +103,11 @@ void yargs_1.default
|
|
|
103
103
|
type: 'string',
|
|
104
104
|
coerce: JSON.parse,
|
|
105
105
|
},
|
|
106
|
+
maskLog: {
|
|
107
|
+
description: 'mask sensitive information in the log',
|
|
108
|
+
type: 'boolean',
|
|
109
|
+
default: false,
|
|
110
|
+
},
|
|
106
111
|
}),
|
|
107
112
|
handler: async (args) => {
|
|
108
113
|
if (args.fork) {
|
package/dist/close-batch.js
CHANGED
|
@@ -31,6 +31,8 @@ function makeCloseBatch({ core, logger: mainLogger }) {
|
|
|
31
31
|
logger = logger.extend(mainLogger, { tags: [`close-batch-${utils.general.shortid()}`] });
|
|
32
32
|
(utils.types.isArray(settings) ? settings : [settings]).forEach(settings => {
|
|
33
33
|
(0, populate_eyes_server_settings_1.populateEyesServerSettings)(settings);
|
|
34
|
+
logger.mask(settings.apiKey);
|
|
35
|
+
logger.mask(settings.eyesServerUrl);
|
|
34
36
|
});
|
|
35
37
|
return core.base.closeBatch({ settings, logger });
|
|
36
38
|
};
|
package/dist/core.js
CHANGED
|
@@ -46,18 +46,18 @@ const ensure_offline_folder_1 = require("./utils/ensure-offline-folder");
|
|
|
46
46
|
const validate_sdk_version_1 = require("./utils/validate-sdk-version");
|
|
47
47
|
const memory_usage_logging_1 = require("./utils/memory-usage-logging");
|
|
48
48
|
const take_snapshots_1 = require("./ufg/take-snapshots");
|
|
49
|
-
function makeCore({ spec, clients, base: defaultBase, concurrency = utils.general.getEnvValue('CONCURRENCY', 'number'), environment: defaultEnvironment, agentId = 'core', cwd = process.cwd(), logger: defaultLogger, asyncCache, } = {}) {
|
|
50
|
-
const logger = (0, logger_1.makeLogger)({ logger: defaultLogger, format: { label: 'core' } });
|
|
49
|
+
function makeCore({ spec, clients, base: defaultBase, concurrency = utils.general.getEnvValue('CONCURRENCY', 'number'), environment: defaultEnvironment, agentId = 'core', cwd = process.cwd(), maskLog = false, logger: defaultLogger, asyncCache, } = {}) {
|
|
50
|
+
const logger = (0, logger_1.makeLogger)({ logger: defaultLogger, format: { label: 'core' }, maskLog });
|
|
51
51
|
(0, memory_usage_logging_1.startMemoryUsageLogging)({ logger });
|
|
52
52
|
const environment = (0, extract_test_environment_1.extractTestEnvironment)(defaultEnvironment);
|
|
53
53
|
const offlineLocationPath = (0, ensure_offline_folder_1.ensureOfflineFolder)();
|
|
54
54
|
logger.log(`[pid=${process.pid} Core is initialized ${defaultBase ? 'with' : 'without'} custom base core ${offlineLocationPath ? `and offline location ${offlineLocationPath} ` : ''}and environment `, environment);
|
|
55
55
|
if (environment.sdk)
|
|
56
56
|
void (0, validate_sdk_version_1.validateSdkVersion)(environment.sdk, { logger });
|
|
57
|
-
const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId, concurrency, logger, offlineLocationPath });
|
|
57
|
+
const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId, concurrency, logger, offlineLocationPath, maskLog });
|
|
58
58
|
const cores = {
|
|
59
|
-
ufg: (0, core_2.makeCore)({ spec, clients, base, asyncCache, logger, offlineLocationPath }),
|
|
60
|
-
classic: (0, core_1.makeCore)({ spec, clients, base, logger, offlineLocationPath }),
|
|
59
|
+
ufg: (0, core_2.makeCore)({ spec, clients, base, asyncCache, logger, offlineLocationPath, maskLog }),
|
|
60
|
+
classic: (0, core_1.makeCore)({ spec, clients, base, logger, offlineLocationPath, maskLog }),
|
|
61
61
|
};
|
|
62
62
|
return utils.general.extend(base, core => {
|
|
63
63
|
return {
|
|
@@ -80,6 +80,7 @@ function makeCore({ spec, clients, base: defaultBase, concurrency = utils.genera
|
|
|
80
80
|
asyncCache,
|
|
81
81
|
logger,
|
|
82
82
|
offlineLocationPath,
|
|
83
|
+
maskLog,
|
|
83
84
|
}),
|
|
84
85
|
locate: (0, locate_1.makeLocate)({ spec, core, logger }),
|
|
85
86
|
locateText: (0, locate_text_1.makeLocateText)({ spec, core, logger }),
|
package/dist/delete-test.js
CHANGED
|
@@ -31,6 +31,9 @@ function makeDeleteTest({ core, logger: mainLogger }) {
|
|
|
31
31
|
logger = logger.extend(mainLogger, { tags: [`delete-test-${utils.general.shortid()}`] });
|
|
32
32
|
(utils.types.isArray(settings) ? settings : [settings]).forEach(settings => {
|
|
33
33
|
(0, populate_eyes_server_settings_1.populateEyesServerSettings)(settings);
|
|
34
|
+
logger.mask(settings.apiKey);
|
|
35
|
+
logger.mask(settings.eyesServerUrl);
|
|
36
|
+
logger.mask(settings.secretToken);
|
|
34
37
|
});
|
|
35
38
|
return core.base.deleteTest({ settings, logger });
|
|
36
39
|
};
|
package/dist/extract-text.js
CHANGED
|
@@ -36,6 +36,8 @@ function makeExtractText({ spec, core, logger: mainLogger }) {
|
|
|
36
36
|
settings = { ...config === null || config === void 0 ? void 0 : config.open, ...config === null || config === void 0 ? void 0 : config.screenshot, ...settings };
|
|
37
37
|
(_a = settings.userCommandId) !== null && _a !== void 0 ? _a : (settings.userCommandId = `extract-text--${utils.general.guid()}`);
|
|
38
38
|
(0, populate_eyes_server_settings_1.populateEyesServerSettings)(settings);
|
|
39
|
+
logger.mask(settings.apiKey);
|
|
40
|
+
logger.mask(settings.eyesServerUrl);
|
|
39
41
|
return settings;
|
|
40
42
|
});
|
|
41
43
|
const classicCore = (0, core_1.makeCore)({ spec, base: core.base, logger });
|
package/dist/locate-text.js
CHANGED
|
@@ -32,6 +32,8 @@ function makeLocateText({ spec, core, logger: mainLogger }) {
|
|
|
32
32
|
logger = logger.extend(mainLogger, { tags: [`locate-text-${utils.general.shortid()}`] });
|
|
33
33
|
settings = { ...config === null || config === void 0 ? void 0 : config.open, ...config === null || config === void 0 ? void 0 : config.screenshot, ...settings };
|
|
34
34
|
(0, populate_eyes_server_settings_1.populateEyesServerSettings)(settings);
|
|
35
|
+
logger.mask(settings.apiKey);
|
|
36
|
+
logger.mask(settings.eyesServerUrl);
|
|
35
37
|
const classicCore = (0, core_1.makeCore)({ spec, base: core.base, logger });
|
|
36
38
|
const results = await classicCore.locateText({ target, settings, logger });
|
|
37
39
|
return results;
|
package/dist/locate.js
CHANGED
|
@@ -32,6 +32,8 @@ function makeLocate({ spec, core, logger: mainLogger }) {
|
|
|
32
32
|
logger = logger.extend(mainLogger, { tags: [`locate-${utils.general.shortid()}`] });
|
|
33
33
|
settings = { ...config === null || config === void 0 ? void 0 : config.open, ...config === null || config === void 0 ? void 0 : config.screenshot, ...settings };
|
|
34
34
|
(0, populate_eyes_server_settings_1.populateEyesServerSettings)(settings);
|
|
35
|
+
logger.mask(settings.apiKey);
|
|
36
|
+
logger.mask(settings.eyesServerUrl);
|
|
35
37
|
const classicCore = (0, core_1.makeCore)({ spec, base: core.base, logger });
|
|
36
38
|
const results = await classicCore.locate({ target, settings, logger });
|
|
37
39
|
return results;
|
package/dist/make-manager.js
CHANGED
|
@@ -30,11 +30,11 @@ const core_2 = require("./ufg/core");
|
|
|
30
30
|
const open_eyes_1 = require("./open-eyes");
|
|
31
31
|
const get_manager_results_1 = require("./get-manager-results");
|
|
32
32
|
const utils = __importStar(require("@applitools/utils"));
|
|
33
|
-
function makeMakeManager({ spec, clients, core, base: defaultBase, agentId: defaultAgentId, environment, cwd = process.cwd(), logger: mainLogger, asyncCache, offlineLocationPath, }) {
|
|
33
|
+
function makeMakeManager({ spec, clients, core, base: defaultBase, agentId: defaultAgentId, environment, cwd = process.cwd(), logger: mainLogger, asyncCache, offlineLocationPath, maskLog, }) {
|
|
34
34
|
return async function makeManager({ type = 'classic', settings, logger = mainLogger, } = {}) {
|
|
35
35
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
36
36
|
var _h, _j;
|
|
37
|
-
logger = logger.extend(mainLogger, { tags: [`manager-${type}-${utils.general.shortid()}`] });
|
|
37
|
+
logger = logger.extend(mainLogger, { tags: [`manager-${type}-${utils.general.shortid()}`], maskLog });
|
|
38
38
|
settings !== null && settings !== void 0 ? settings : (settings = {});
|
|
39
39
|
(_a = settings.concurrency) !== null && _a !== void 0 ? _a : (settings.concurrency = (_b = utils.general.getEnvValue('CONCURRENCY', 'number')) !== null && _b !== void 0 ? _b : (utils.types.isInteger(settings.legacyConcurrency) ? settings.legacyConcurrency * 5 : 100));
|
|
40
40
|
(_c = settings.batch) !== null && _c !== void 0 ? _c : (settings.batch = {});
|
|
@@ -42,11 +42,11 @@ 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, logger, offlineLocationPath });
|
|
45
|
+
const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId: settings.agentId, concurrency: settings.concurrency, logger, offlineLocationPath, maskLog });
|
|
46
46
|
const fetchConcurrency = settings.fetchConcurrency;
|
|
47
47
|
const cores = {
|
|
48
|
-
ufg: (0, core_2.makeCore)({ spec, clients, base, fetchConcurrency, asyncCache, logger, offlineLocationPath }),
|
|
49
|
-
classic: (0, core_1.makeCore)({ spec, clients, base, logger }),
|
|
48
|
+
ufg: (0, core_2.makeCore)({ spec, clients, base, fetchConcurrency, asyncCache, logger, offlineLocationPath, maskLog }),
|
|
49
|
+
classic: (0, core_1.makeCore)({ spec, clients, base, logger, maskLog }),
|
|
50
50
|
};
|
|
51
51
|
const storage = [];
|
|
52
52
|
return {
|
|
@@ -36,14 +36,15 @@ const to_base_check_settings_1 = require("../automation/utils/to-base-check-sett
|
|
|
36
36
|
const chalk_1 = __importDefault(require("chalk"));
|
|
37
37
|
const utils = __importStar(require("@applitools/utils"));
|
|
38
38
|
const merge_configs_1 = require("./merge-configs");
|
|
39
|
+
const format_results_1 = require("../utils/format-results");
|
|
39
40
|
async function runOfflineSnapshots(options) {
|
|
40
|
-
var _a
|
|
41
|
+
var _a;
|
|
41
42
|
if (!options.offlineLocationPath)
|
|
42
43
|
throw new Error('offlineLocationPath is required');
|
|
43
44
|
const offlineLocationPath = path_1.default.resolve(options.offlineLocationPath);
|
|
44
45
|
const startTime = Date.now();
|
|
45
46
|
const logger = (_a = options.logger) !== null && _a !== void 0 ? _a : (0, logger_1.makeLogger)({ format: { label: 'offline-exec' } });
|
|
46
|
-
const eyesServerSettings = { ...
|
|
47
|
+
const eyesServerSettings = { ...options.config.open, ...options };
|
|
47
48
|
const core = (0, core_1.makeCore)();
|
|
48
49
|
const account = await core.getAccountInfo({ settings: eyesServerSettings });
|
|
49
50
|
const ufgClient = await (0, get_ufg_client_1.makeGetUFGClient)({ logger })({
|
|
@@ -65,7 +66,11 @@ async function runOfflineSnapshots(options) {
|
|
|
65
66
|
throw new Error(`Unable to find offline executions in ${offlineLocationPath}`);
|
|
66
67
|
}
|
|
67
68
|
const allTestResults = await runTests(testFolders);
|
|
68
|
-
const { isSuccess, outputStr } = processResults({
|
|
69
|
+
const { isSuccess, outputStr } = processResults({
|
|
70
|
+
testResults: allTestResults,
|
|
71
|
+
totalTime: Date.now() - startTime,
|
|
72
|
+
jsonFilePath: options.jsonFilePath,
|
|
73
|
+
});
|
|
69
74
|
if (!isSuccess && options.failOnDiff) {
|
|
70
75
|
throw new Error(outputStr);
|
|
71
76
|
}
|
|
@@ -88,7 +93,10 @@ async function runOfflineSnapshots(options) {
|
|
|
88
93
|
const batchIds = [...new Set(results.map(t => t.batchId))];
|
|
89
94
|
const allTestResults = results.map(t => t.results);
|
|
90
95
|
logger.log('done running all tests', allTestResults);
|
|
91
|
-
|
|
96
|
+
const keepBatchOpen = utils.general.getEnvValue('DONT_CLOSE_BATCHES', 'boolean') || options.config.open.keepBatchOpen;
|
|
97
|
+
if (!keepBatchOpen) {
|
|
98
|
+
await core.closeBatch({ settings: batchIds.map(batchId => ({ batchId, ...account.eyesServer })) });
|
|
99
|
+
}
|
|
92
100
|
logger.log('done closing batches');
|
|
93
101
|
return allTestResults;
|
|
94
102
|
}
|
|
@@ -196,7 +204,7 @@ exports.runOfflineSnapshots = runOfflineSnapshots;
|
|
|
196
204
|
function uniq(arr) {
|
|
197
205
|
return [...new Set(arr)];
|
|
198
206
|
}
|
|
199
|
-
function processResults({ testResults, totalTime, saveNewTests = true, failOnDiff = true, }) {
|
|
207
|
+
function processResults({ testResults, totalTime, saveNewTests = true, failOnDiff = true, jsonFilePath, }) {
|
|
200
208
|
let outputStr = '\n';
|
|
201
209
|
const pluralize = utils.general.pluralize;
|
|
202
210
|
const testResultsWithErrors = testResults.filter(r => r && r.reason);
|
|
@@ -269,6 +277,10 @@ function processResults({ testResults, totalTime, saveNewTests = true, failOnDif
|
|
|
269
277
|
else if (passedOrNew.length) {
|
|
270
278
|
outputStr += chalk_1.default.green(`\nNo differences were found!`);
|
|
271
279
|
}
|
|
280
|
+
if (jsonFilePath) {
|
|
281
|
+
outputStr += '\n\nWriting test results to ' + jsonFilePath + '\n';
|
|
282
|
+
fs_1.default.writeFileSync(jsonFilePath, (0, format_results_1.toJsonOutput)(testResults));
|
|
283
|
+
}
|
|
272
284
|
if (hasResults) {
|
|
273
285
|
outputStr += `\n${seeDetailsStr}\nTotal time: ${Math.round(totalTime / 1000)} seconds\n`;
|
|
274
286
|
}
|
package/dist/open-eyes.js
CHANGED
|
@@ -44,6 +44,8 @@ function makeOpenEyes({ type: defaultType = 'classic', clients, batch, removeDup
|
|
|
44
44
|
logger = logger.extend(mainLogger, { tags: [`eyes-${type}-${utils.general.shortid()}`] });
|
|
45
45
|
const settings = { ...config === null || config === void 0 ? void 0 : config.open, ...openSettings };
|
|
46
46
|
const eyesServerSettings = (0, populate_eyes_server_settings_1.populateEyesServerSettings)(settings);
|
|
47
|
+
logger.mask(eyesServerSettings.apiKey);
|
|
48
|
+
logger.mask(eyesServerSettings.eyesServerUrl);
|
|
47
49
|
(_a = settings.userTestId) !== null && _a !== void 0 ? _a : (settings.userTestId = `${settings.testName}--${utils.general.guid()}`);
|
|
48
50
|
settings.batch = { ...batch, ...settings.batch };
|
|
49
51
|
(_b = (_w = settings.batch).id) !== null && _b !== void 0 ? _b : (_w.id = (_c = utils.general.getEnvValue('BATCH_ID')) !== null && _c !== void 0 ? _c : `generated-${utils.general.guid()}`);
|
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', logger: defaultLogger, }) {
|
|
40
|
-
const logger = (0, logger_1.makeLogger)({ logger: defaultLogger, format: { label: 'core-ufg' } });
|
|
39
|
+
function makeCore({ spec, clients, base: defaultBase, asyncCache, concurrency, offlineLocationPath, fetchConcurrency, agentId = 'core-ufg', logger: defaultLogger, maskLog, }) {
|
|
40
|
+
const logger = (0, logger_1.makeLogger)({ logger: defaultLogger, format: { label: 'core-ufg' }, maskLog });
|
|
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, logger, offlineLocationPath });
|
|
42
|
+
const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId, concurrency, logger, offlineLocationPath, maskLog });
|
|
43
43
|
const ufgClient = clients === null || clients === void 0 ? void 0 : clients.ufg;
|
|
44
44
|
return utils.general.extend(base, core => {
|
|
45
45
|
return {
|
|
@@ -38,10 +38,10 @@ async function takeDomSnapshot({ context, settings, logger, }) {
|
|
|
38
38
|
for (const elementReference of (_b = settings === null || settings === void 0 ? void 0 : settings.elementReferences) !== null && _b !== void 0 ? _b : []) {
|
|
39
39
|
elements.push(await context.elements(elementReference));
|
|
40
40
|
}
|
|
41
|
-
const snapshot = transformRawDomSnapshot(await takeContextDomSnapshot({ context }), elements);
|
|
41
|
+
const snapshot = transformRawDomSnapshot(await takeContextDomSnapshot({ context, isRootFrame: true }), elements);
|
|
42
42
|
snapshot.cookies = features.allCookies ? await driver.getCookies().catch(() => []) : cookies; // intentionally fetching cookies after the dom snapshot runs
|
|
43
43
|
return snapshot;
|
|
44
|
-
async function takeContextDomSnapshot({ context }) {
|
|
44
|
+
async function takeContextDomSnapshot({ context, isRootFrame, }) {
|
|
45
45
|
// logger.log(`taking dom snapshot. ${context._reference ? `context referece: ${JSON.stringify(context._reference)}` : ''}`)
|
|
46
46
|
var _a, _b, _c;
|
|
47
47
|
const arg = {
|
|
@@ -53,7 +53,7 @@ async function takeDomSnapshot({ context, settings, logger, }) {
|
|
|
53
53
|
serializeResources: true,
|
|
54
54
|
compressResources: false,
|
|
55
55
|
showLogs: settings === null || settings === void 0 ? void 0 : settings.showLogs,
|
|
56
|
-
elements,
|
|
56
|
+
elements: isRootFrame ? elements : [],
|
|
57
57
|
};
|
|
58
58
|
const scripts = {
|
|
59
59
|
main: features.canExecuteOnlyFunctionScripts
|
|
@@ -85,7 +85,10 @@ async function takeDomSnapshot({ context, settings, logger, }) {
|
|
|
85
85
|
logger.log(`could not switch to frame during takeDomSnapshot. Path to frame: ${JSON.stringify(reference)}`, err);
|
|
86
86
|
});
|
|
87
87
|
if (frameContext) {
|
|
88
|
-
const frameSnapshot = await takeContextDomSnapshot({
|
|
88
|
+
const frameSnapshot = await takeContextDomSnapshot({
|
|
89
|
+
context: frameContext,
|
|
90
|
+
isRootFrame: false, // when we're diving into a frame, it's not the root frame anymore and we shouldn't pass the elements
|
|
91
|
+
});
|
|
89
92
|
let url = new URL(frameSnapshot.url);
|
|
90
93
|
if (url.protocol === 'data:')
|
|
91
94
|
url = new URL(`http://data-url-frame${url.search}`);
|
|
@@ -15,13 +15,14 @@ const history_1 = require("./history");
|
|
|
15
15
|
const os_1 = __importDefault(require("os"));
|
|
16
16
|
const path_1 = __importDefault(require("path"));
|
|
17
17
|
async function makeCoreServer({ environment: defaultEnvironment, agentIdPrefix = `eyes-universal/${require('../../package.json').version}`, debug = false, shutdownMode = 'lazy', idleTimeout = 900000, // 15min
|
|
18
|
-
printStdout = false, isProcess = false, ...handlerOptions } = {}) {
|
|
18
|
+
printStdout = false, isProcess = false, maskLog = false, ...handlerOptions } = {}) {
|
|
19
19
|
var _a, _b;
|
|
20
20
|
const logDirname = (_a = process.env.APPLITOOLS_LOG_DIR) !== null && _a !== void 0 ? _a : path_1.default.resolve(os_1.default.tmpdir(), `applitools-logs`);
|
|
21
21
|
const baseLogger = (0, logger_1.makeLogger)({
|
|
22
22
|
handler: { type: 'rolling file', name: 'universal', dirname: logDirname },
|
|
23
23
|
level: 'info',
|
|
24
24
|
format: { label: 'core-universal', colors: false },
|
|
25
|
+
maskLog,
|
|
25
26
|
});
|
|
26
27
|
baseLogger.log('Core universal is going to be initialized with options', {
|
|
27
28
|
debug,
|
|
@@ -83,6 +84,7 @@ printStdout = false, isProcess = false, ...handlerOptions } = {}) {
|
|
|
83
84
|
error: (message) => socket.emit('Logger.log', { level: 'error', message }),
|
|
84
85
|
fatal: (message) => socket.emit('Logger.log', { level: 'fatal', message }),
|
|
85
86
|
},
|
|
87
|
+
maskLog,
|
|
86
88
|
});
|
|
87
89
|
logger.console.log(`Logs saved in: ${logDirname}`);
|
|
88
90
|
const corePromise = socket.wait('Core.makeCore', ({ spec, agentId, environment, cwd }) => {
|
|
@@ -97,6 +99,7 @@ printStdout = false, isProcess = false, ...handlerOptions } = {}) {
|
|
|
97
99
|
universal: true,
|
|
98
100
|
},
|
|
99
101
|
logger,
|
|
102
|
+
maskLog,
|
|
100
103
|
});
|
|
101
104
|
});
|
|
102
105
|
socket.command('Core.getAccountInfo', async (options) => {
|
|
@@ -181,7 +184,20 @@ printStdout = false, isProcess = false, ...handlerOptions } = {}) {
|
|
|
181
184
|
return (_a = refer.deref(eyes)) === null || _a === void 0 ? void 0 : _a.getResults(options);
|
|
182
185
|
});
|
|
183
186
|
socket.command('Debug.getHistory', async () => {
|
|
184
|
-
return
|
|
187
|
+
return {
|
|
188
|
+
...getHistory(),
|
|
189
|
+
initialArgs: {
|
|
190
|
+
environment: defaultEnvironment,
|
|
191
|
+
agentIdPrefix,
|
|
192
|
+
debug,
|
|
193
|
+
shutdownMode,
|
|
194
|
+
idleTimeout,
|
|
195
|
+
printStdout,
|
|
196
|
+
isProcess,
|
|
197
|
+
maskLog,
|
|
198
|
+
...handlerOptions,
|
|
199
|
+
},
|
|
200
|
+
};
|
|
185
201
|
});
|
|
186
202
|
});
|
|
187
203
|
process.on('unhandledRejection', error => {
|
|
@@ -7,6 +7,7 @@ function withHistory(socket) {
|
|
|
7
7
|
managers: new Map(),
|
|
8
8
|
eyes: new Map(),
|
|
9
9
|
startedAt: new Date().toISOString(),
|
|
10
|
+
unknownEvents: [],
|
|
10
11
|
};
|
|
11
12
|
const originalCommand = socket.command;
|
|
12
13
|
socket.command = function command(name, fn) {
|
|
@@ -64,6 +65,9 @@ function withHistory(socket) {
|
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
}
|
|
68
|
+
else {
|
|
69
|
+
history.unknownEvents.push({ name, payload });
|
|
70
|
+
}
|
|
67
71
|
}
|
|
68
72
|
});
|
|
69
73
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.29.0",
|
|
4
4
|
"homepage": "https://applitools.com",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
|
|
@@ -74,20 +74,20 @@
|
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@applitools/core-base": "1.
|
|
78
|
-
"@applitools/dom-capture": "11.5.
|
|
79
|
-
"@applitools/dom-snapshot": "4.11.
|
|
80
|
-
"@applitools/driver": "1.20.
|
|
81
|
-
"@applitools/ec-client": "1.
|
|
82
|
-
"@applitools/logger": "2.0
|
|
83
|
-
"@applitools/nml-client": "1.8.
|
|
84
|
-
"@applitools/req": "1.7.
|
|
85
|
-
"@applitools/screenshoter": "3.10.
|
|
86
|
-
"@applitools/snippets": "2.6.
|
|
87
|
-
"@applitools/socket": "1.
|
|
88
|
-
"@applitools/spec-driver-webdriver": "1.1.
|
|
89
|
-
"@applitools/ufg-client": "1.
|
|
90
|
-
"@applitools/utils": "1.7.
|
|
77
|
+
"@applitools/core-base": "1.22.0",
|
|
78
|
+
"@applitools/dom-capture": "11.5.4",
|
|
79
|
+
"@applitools/dom-snapshot": "4.11.14",
|
|
80
|
+
"@applitools/driver": "1.20.3",
|
|
81
|
+
"@applitools/ec-client": "1.10.1",
|
|
82
|
+
"@applitools/logger": "2.1.0",
|
|
83
|
+
"@applitools/nml-client": "1.8.22",
|
|
84
|
+
"@applitools/req": "1.7.6",
|
|
85
|
+
"@applitools/screenshoter": "3.10.3",
|
|
86
|
+
"@applitools/snippets": "2.6.4",
|
|
87
|
+
"@applitools/socket": "1.2.0",
|
|
88
|
+
"@applitools/spec-driver-webdriver": "1.1.23",
|
|
89
|
+
"@applitools/ufg-client": "1.16.0",
|
|
90
|
+
"@applitools/utils": "1.7.7",
|
|
91
91
|
"@types/ws": "8.5.5",
|
|
92
92
|
"abort-controller": "3.0.0",
|
|
93
93
|
"chalk": "4.1.2",
|
|
@@ -100,11 +100,11 @@
|
|
|
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.23",
|
|
104
|
+
"@applitools/spec-driver-selenium": "^1.5.94",
|
|
105
105
|
"@applitools/test-server": "^1.2.2",
|
|
106
106
|
"@applitools/test-utils": "^1.5.17",
|
|
107
|
-
"@applitools/tunnel-client": "^1.
|
|
107
|
+
"@applitools/tunnel-client": "^1.6.0",
|
|
108
108
|
"@types/node": "^12.20.55",
|
|
109
109
|
"@types/selenium-webdriver": "^4.1.2",
|
|
110
110
|
"@types/semver": "^7.5.8",
|
package/types/classic/core.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ type Options<TSpec extends SpecType> = {
|
|
|
13
13
|
agentId?: string;
|
|
14
14
|
logger?: Logger;
|
|
15
15
|
offlineLocationPath?: string;
|
|
16
|
+
maskLog?: boolean;
|
|
16
17
|
};
|
|
17
|
-
export declare function makeCore<TSpec extends SpecType>({ spec, clients, base: defaultBase, concurrency, agentId, logger: defaultLogger, offlineLocationPath, }: Options<TSpec>): Core<TSpec>;
|
|
18
|
+
export declare function makeCore<TSpec extends SpecType>({ spec, clients, base: defaultBase, concurrency, agentId, logger: defaultLogger, maskLog, offlineLocationPath, }: Options<TSpec>): Core<TSpec>;
|
|
18
19
|
export {};
|
package/types/core.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ type Options<TSpec extends SpecType> = {
|
|
|
17
17
|
cwd?: string;
|
|
18
18
|
logger?: Logger;
|
|
19
19
|
asyncCache?: AsyncCache;
|
|
20
|
+
maskLog?: boolean;
|
|
20
21
|
};
|
|
21
|
-
export declare function makeCore<TSpec extends SpecType>({ spec, clients, base: defaultBase, concurrency, environment: defaultEnvironment, agentId, cwd, logger: defaultLogger, asyncCache, }?: Options<TSpec>): Core<TSpec, 'classic' | 'ufg'>;
|
|
22
|
+
export declare function makeCore<TSpec extends SpecType>({ spec, clients, base: defaultBase, concurrency, environment: defaultEnvironment, agentId, cwd, maskLog, logger: defaultLogger, asyncCache, }?: Options<TSpec>): Core<TSpec, 'classic' | 'ufg'>;
|
|
22
23
|
export {};
|
package/types/make-manager.d.ts
CHANGED
|
@@ -18,8 +18,9 @@ type Options<TSpec extends SpecType> = {
|
|
|
18
18
|
logger: Logger;
|
|
19
19
|
asyncCache?: AsyncCache;
|
|
20
20
|
offlineLocationPath?: string;
|
|
21
|
+
maskLog?: boolean;
|
|
21
22
|
};
|
|
22
|
-
export declare function makeMakeManager<TSpec extends SpecType>({ spec, clients, core, base: defaultBase, agentId: defaultAgentId, environment, cwd, logger: mainLogger, asyncCache, offlineLocationPath, }: Options<TSpec>): <TType extends "classic" | "ufg" = "classic">({ type, settings, logger, }?: {
|
|
23
|
+
export declare function makeMakeManager<TSpec extends SpecType>({ spec, clients, core, base: defaultBase, agentId: defaultAgentId, environment, cwd, logger: mainLogger, asyncCache, offlineLocationPath, maskLog, }: Options<TSpec>): <TType extends "classic" | "ufg" = "classic">({ type, settings, logger, }?: {
|
|
23
24
|
type?: TType | undefined;
|
|
24
25
|
settings?: ManagerSettings | undefined;
|
|
25
26
|
logger?: Logger | undefined;
|
|
@@ -7,5 +7,6 @@ export type OfflineSnapshotsSettings = EyesServerSettings & {
|
|
|
7
7
|
failOnDiff: boolean;
|
|
8
8
|
config: Config<SpecType, 'ufg'>;
|
|
9
9
|
logger?: Logger;
|
|
10
|
+
jsonFilePath?: string;
|
|
10
11
|
};
|
|
11
12
|
export declare function runOfflineSnapshots(options: OfflineSnapshotsSettings): Promise<TestResult[]>;
|
package/types/ufg/core.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ type Options<TSpec extends SpecType> = {
|
|
|
17
17
|
agentId?: string;
|
|
18
18
|
logger?: Logger;
|
|
19
19
|
offlineLocationPath?: string;
|
|
20
|
+
maskLog?: boolean;
|
|
20
21
|
};
|
|
21
|
-
export declare function makeCore<TSpec extends SpecType>({ spec, clients, base: defaultBase, asyncCache, concurrency, offlineLocationPath, fetchConcurrency, agentId, logger: defaultLogger, }: Options<TSpec>): Core<TSpec>;
|
|
22
|
+
export declare function makeCore<TSpec extends SpecType>({ spec, clients, base: defaultBase, asyncCache, concurrency, offlineLocationPath, fetchConcurrency, agentId, logger: defaultLogger, maskLog, }: Options<TSpec>): Core<TSpec>;
|
|
22
23
|
export {};
|
|
@@ -7,9 +7,10 @@ export type Options = ServerOptions & {
|
|
|
7
7
|
idleTimeout?: number;
|
|
8
8
|
printStdout?: boolean;
|
|
9
9
|
isProcess?: boolean;
|
|
10
|
+
maskLog?: boolean;
|
|
10
11
|
};
|
|
11
12
|
export declare function makeCoreServer({ environment: defaultEnvironment, agentIdPrefix, debug, shutdownMode, idleTimeout, // 15min
|
|
12
|
-
printStdout, isProcess, ...handlerOptions }?: Options): Promise<{
|
|
13
|
+
printStdout, isProcess, maskLog, ...handlerOptions }?: Options): Promise<{
|
|
13
14
|
port: number;
|
|
14
15
|
close?: () => void;
|
|
15
16
|
}>;
|
package/dist/universal/core.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.makeClientSocket = exports.makeEyes = exports.makeManager = exports.makeCore = void 0;
|
|
27
|
-
const socket_1 = require("@applitools/socket");
|
|
28
|
-
const ws_1 = require("ws");
|
|
29
|
-
const core_server_1 = require("./core-server");
|
|
30
|
-
const utils = __importStar(require("@applitools/utils"));
|
|
31
|
-
//TODO add refer and sanitizing support, solve types issues
|
|
32
|
-
function makeCore(options) {
|
|
33
|
-
const socketPromise = makeClientSocket(options);
|
|
34
|
-
const core = {
|
|
35
|
-
concurrency: undefined,
|
|
36
|
-
base: null,
|
|
37
|
-
async getAccountInfo(options) {
|
|
38
|
-
const socket = await socketPromise;
|
|
39
|
-
return socket.request('Core.getAccountInfo', options);
|
|
40
|
-
},
|
|
41
|
-
async getViewportSize(options) {
|
|
42
|
-
const socket = await socketPromise;
|
|
43
|
-
return socket.request('Core.getViewportSize', options);
|
|
44
|
-
},
|
|
45
|
-
async setViewportSize(options) {
|
|
46
|
-
const socket = await socketPromise;
|
|
47
|
-
return socket.request('Core.setViewportSize', options);
|
|
48
|
-
},
|
|
49
|
-
async getNMLClient(_options) {
|
|
50
|
-
// TODO
|
|
51
|
-
return null;
|
|
52
|
-
},
|
|
53
|
-
async clearNMLClientCache(_driver) {
|
|
54
|
-
return null;
|
|
55
|
-
},
|
|
56
|
-
async getECClient(options) {
|
|
57
|
-
const socket = await socketPromise;
|
|
58
|
-
return socket.request('Core.makeECClient', options);
|
|
59
|
-
},
|
|
60
|
-
async locate(options) {
|
|
61
|
-
const socket = await socketPromise;
|
|
62
|
-
return socket.request('Core.locate', options);
|
|
63
|
-
},
|
|
64
|
-
async locateText(options) {
|
|
65
|
-
const socket = await socketPromise;
|
|
66
|
-
return socket.request('Core.locateText', options);
|
|
67
|
-
},
|
|
68
|
-
async extractText(options) {
|
|
69
|
-
const socket = await socketPromise;
|
|
70
|
-
return socket.request('Core.extractText', options);
|
|
71
|
-
},
|
|
72
|
-
async openEyes(options) {
|
|
73
|
-
const socket = await socketPromise;
|
|
74
|
-
const eyesRef = await socket.request('Core.openEyes', options);
|
|
75
|
-
return makeEyes({ socket, core, eyesRef });
|
|
76
|
-
},
|
|
77
|
-
async openFunctionalSession(_options) {
|
|
78
|
-
// TODO
|
|
79
|
-
return null;
|
|
80
|
-
},
|
|
81
|
-
async makeManager(options) {
|
|
82
|
-
const socket = await socketPromise;
|
|
83
|
-
const managerRef = await socket.request('Core.makeManager', options);
|
|
84
|
-
return makeManager({ socket, core, managerRef });
|
|
85
|
-
},
|
|
86
|
-
async closeBatch(options) {
|
|
87
|
-
const socket = await socketPromise;
|
|
88
|
-
return socket.request('Core.closeBatch', options);
|
|
89
|
-
},
|
|
90
|
-
async deleteTest(options) {
|
|
91
|
-
const socket = await socketPromise;
|
|
92
|
-
return socket.request('Core.deleteTest', options);
|
|
93
|
-
},
|
|
94
|
-
async logEvent(options) {
|
|
95
|
-
const socket = await socketPromise;
|
|
96
|
-
return socket.request('Core.logEvent', options);
|
|
97
|
-
},
|
|
98
|
-
async updateIfScm() {
|
|
99
|
-
// TODO
|
|
100
|
-
return null;
|
|
101
|
-
},
|
|
102
|
-
async openCheckAndClose() {
|
|
103
|
-
// TODO
|
|
104
|
-
return null;
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
return core;
|
|
108
|
-
}
|
|
109
|
-
exports.makeCore = makeCore;
|
|
110
|
-
function makeManager({ socket, core, managerRef, }) {
|
|
111
|
-
const manager = {
|
|
112
|
-
concurrency: undefined,
|
|
113
|
-
base: null,
|
|
114
|
-
async openEyes(options) {
|
|
115
|
-
const eyesRef = await socket.request('EyesManager.openEyes', { ...options, manager: managerRef });
|
|
116
|
-
return makeEyes({ socket, core, eyesRef });
|
|
117
|
-
},
|
|
118
|
-
async getResults(options) {
|
|
119
|
-
return socket.request('EyesManager.getResults', { ...options, manager: managerRef });
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
return manager;
|
|
123
|
-
}
|
|
124
|
-
exports.makeManager = makeManager;
|
|
125
|
-
function makeEyes({ socket, core, eyesRef, }) {
|
|
126
|
-
const eyes = {
|
|
127
|
-
test: null,
|
|
128
|
-
running: null,
|
|
129
|
-
storage: null,
|
|
130
|
-
core,
|
|
131
|
-
getBaseEyes() {
|
|
132
|
-
return null;
|
|
133
|
-
},
|
|
134
|
-
getTypedEyes() {
|
|
135
|
-
return null;
|
|
136
|
-
},
|
|
137
|
-
async check(options) {
|
|
138
|
-
return socket.request('Eyes.check', { ...options, eyes: eyesRef });
|
|
139
|
-
},
|
|
140
|
-
async checkAndClose(options) {
|
|
141
|
-
return socket.request('Eyes.checkAndClose', { ...options, eyes: eyesRef });
|
|
142
|
-
},
|
|
143
|
-
async close(options) {
|
|
144
|
-
return socket.request('Eyes.close', { ...options, eyes: eyesRef });
|
|
145
|
-
},
|
|
146
|
-
async abort(options) {
|
|
147
|
-
return socket.request('Eyes.abort', { ...options, eyes: eyesRef });
|
|
148
|
-
},
|
|
149
|
-
async getResults(options) {
|
|
150
|
-
return socket.request('Eyes.getResults', { ...options, eyes: eyesRef });
|
|
151
|
-
},
|
|
152
|
-
};
|
|
153
|
-
return eyes;
|
|
154
|
-
}
|
|
155
|
-
exports.makeEyes = makeEyes;
|
|
156
|
-
async function makeClientSocket({ agentId, environment, spec, }) {
|
|
157
|
-
const { port } = await (0, core_server_1.makeCoreServer)();
|
|
158
|
-
const socket = (0, socket_1.makeSocket)(new ws_1.WebSocket(`ws://localhost:${port}/eyes`), {
|
|
159
|
-
transport: 'ws',
|
|
160
|
-
});
|
|
161
|
-
socket.emit('Core.makeCore', {
|
|
162
|
-
spec: utils.types.isString(spec) ? spec : Object.keys(spec),
|
|
163
|
-
agentId,
|
|
164
|
-
environment,
|
|
165
|
-
cwd: process.cwd(),
|
|
166
|
-
});
|
|
167
|
-
if (!utils.types.isString(spec)) {
|
|
168
|
-
Object.entries(spec).forEach(([name, command]) => {
|
|
169
|
-
socket.command(`Driver.${name}`, args => command(...args));
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
return socket;
|
|
173
|
-
}
|
|
174
|
-
exports.makeClientSocket = makeClientSocket;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Core, EyesManager, Eyes } from '../types';
|
|
2
|
-
import type { ClientSocket, Ref } from './types';
|
|
3
|
-
import type { SpecType, SpecDriver } from '@applitools/driver';
|
|
4
|
-
import { type Socket } from '@applitools/socket';
|
|
5
|
-
import { WebSocket } from 'ws';
|
|
6
|
-
export declare function makeCore<TSpec extends SpecType, TType extends 'classic' | 'ufg'>(options: {
|
|
7
|
-
spec: 'webdriver' | SpecDriver<TSpec>;
|
|
8
|
-
environment?: Record<string, any>;
|
|
9
|
-
agentId: string;
|
|
10
|
-
}): Core<TSpec, TType>;
|
|
11
|
-
export declare function makeManager<TSpec extends SpecType, TType extends 'classic' | 'ufg'>({ socket, core, managerRef, }: {
|
|
12
|
-
socket: ClientSocket<TSpec, TType>;
|
|
13
|
-
core: Core<TSpec, TType>;
|
|
14
|
-
managerRef: Ref<EyesManager<TSpec, TType>>;
|
|
15
|
-
}): EyesManager<TSpec, TType>;
|
|
16
|
-
export declare function makeEyes<TSpec extends SpecType, TType extends 'classic' | 'ufg'>({ socket, core, eyesRef, }: {
|
|
17
|
-
socket: ClientSocket<TSpec, TType>;
|
|
18
|
-
core: Core<TSpec, TType>;
|
|
19
|
-
eyesRef: Ref<Eyes<TSpec, TType>>;
|
|
20
|
-
}): Eyes<TSpec, TType>;
|
|
21
|
-
export declare function makeClientSocket<TSpec extends SpecType>({ agentId, environment, spec, }: {
|
|
22
|
-
agentId: string;
|
|
23
|
-
environment?: Record<string, any>;
|
|
24
|
-
spec: 'webdriver' | SpecDriver<TSpec>;
|
|
25
|
-
}): Promise<ClientSocket<TSpec, 'classic' | 'ufg'> & Socket<WebSocket>>;
|