@applitools/core 4.73.2 → 4.74.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 +84 -0
- package/dist/core.js +2 -0
- package/dist/make-manager.js +12 -0
- package/dist/open-eyes.js +5 -1
- package/dist/ufg/utils/take-dom-snapshot.js +6 -0
- package/dist/utils/log-env-snapshot.js +214 -0
- package/package.json +16 -16
- package/types/utils/log-env-snapshot.d.ts +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,89 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.74.0](https://github.com/Applitools-Dev/sdk/compare/js/core@4.73.3...js/core@4.74.0) (2026-11-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* log allowlisted environment variables once at SDK initialization for diagnostics | AD-14135 ([#3883](https://github.com/Applitools-Dev/sdk/issues/3883)) ([f7d04b1](https://github.com/Applitools-Dev/sdk/commit/f7d04b19b016ce2dcd656ca543a30128f3b4b309))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* @applitools/ufg-client bumped to 1.25.0
|
|
14
|
+
#### Features
|
|
15
|
+
|
|
16
|
+
* update iOS device names for the iOS 27 UFG upgrade | AD-17131 ([#4401](https://github.com/Applitools-Dev/sdk/issues/4401)) ([22ea8f6](https://github.com/Applitools-Dev/sdk/commit/22ea8f6d57d812f8bc1563c6fb459fabfaca38df))
|
|
17
|
+
|
|
18
|
+
## [4.73.3](https://github.com/Applitools-Dev/sdk/compare/js/core@4.73.2...js/core@4.73.3) (2026-10-29)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Performance Improvements
|
|
22
|
+
|
|
23
|
+
* pre-fetch account info at makeManager | AD-17263 ([#4347](https://github.com/Applitools-Dev/sdk/issues/4347)) ([75ae06c](https://github.com/Applitools-Dev/sdk/commit/75ae06cfdc95653739c9d18734f7d8c73d947988))
|
|
24
|
+
* ship the largest style elements as css resources | FLD-4733 ([#4334](https://github.com/Applitools-Dev/sdk/issues/4334)) ([8d407ae](https://github.com/Applitools-Dev/sdk/commit/8d407ae5804364e1de2c50abb08413f403f53823))
|
|
25
|
+
* warm account info early in open; opt-in runner-init prewarm | AD-17263 ([#4380](https://github.com/Applitools-Dev/sdk/issues/4380)) ([a00d543](https://github.com/Applitools-Dev/sdk/commit/a00d5438ced1288caa32e5e14cedf828f6753dfe))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Dependencies
|
|
29
|
+
|
|
30
|
+
* @applitools/dom-shared bumped to 1.2.5
|
|
31
|
+
#### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* recreate the sandbox iframe when the page removed it | AD-17409 ([0a0b184](https://github.com/Applitools-Dev/sdk/commit/0a0b1841dd4bad2e597d47688f469716fa7b1748))
|
|
34
|
+
* @applitools/dom-snapshot bumped to 4.18.8
|
|
35
|
+
#### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* recreate the sandbox iframe when the page removed it | AD-17409 ([0a0b184](https://github.com/Applitools-Dev/sdk/commit/0a0b1841dd4bad2e597d47688f469716fa7b1748))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
#### Performance Improvements
|
|
41
|
+
|
|
42
|
+
* ship the largest style elements as css resources | FLD-4733 ([#4334](https://github.com/Applitools-Dev/sdk/issues/4334)) ([8d407ae](https://github.com/Applitools-Dev/sdk/commit/8d407ae5804364e1de2c50abb08413f403f53823))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
* @applitools/req bumped to 1.11.6
|
|
47
|
+
#### Bug Fixes
|
|
48
|
+
|
|
49
|
+
* send a stream request body without cloning it ([#4368](https://github.com/Applitools-Dev/sdk/issues/4368)) ([ebfc31e](https://github.com/Applitools-Dev/sdk/commit/ebfc31e269d09ee49dcdda9a860a7c47c55f387a))
|
|
50
|
+
* @applitools/snippets bumped to 2.9.10
|
|
51
|
+
|
|
52
|
+
* @applitools/dom-capture bumped to 11.8.10
|
|
53
|
+
#### Bug Fixes
|
|
54
|
+
|
|
55
|
+
* recreate the sandbox iframe when the page removed it | AD-17409 ([0a0b184](https://github.com/Applitools-Dev/sdk/commit/0a0b1841dd4bad2e597d47688f469716fa7b1748))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
* @applitools/driver bumped to 1.26.14
|
|
60
|
+
#### Bug Fixes
|
|
61
|
+
|
|
62
|
+
* recreate the sandbox iframe when the page removed it | AD-17409 ([0a0b184](https://github.com/Applitools-Dev/sdk/commit/0a0b1841dd4bad2e597d47688f469716fa7b1748))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
* @applitools/spec-driver-webdriver bumped to 1.6.14
|
|
67
|
+
|
|
68
|
+
* @applitools/spec-driver-selenium bumped to 1.8.14
|
|
69
|
+
|
|
70
|
+
* @applitools/spec-driver-playwright bumped to 1.9.14
|
|
71
|
+
|
|
72
|
+
* @applitools/spec-driver-puppeteer bumped to 1.8.14
|
|
73
|
+
|
|
74
|
+
* @applitools/screenshoter bumped to 3.12.36
|
|
75
|
+
|
|
76
|
+
* @applitools/nml-client bumped to 1.12.10
|
|
77
|
+
|
|
78
|
+
* @applitools/tunnel-client bumped to 1.12.8
|
|
79
|
+
|
|
80
|
+
* @applitools/ufg-client bumped to 1.24.2
|
|
81
|
+
|
|
82
|
+
* @applitools/core-base bumped to 1.41.3
|
|
83
|
+
|
|
84
|
+
* @applitools/ec-client bumped to 1.12.54
|
|
85
|
+
|
|
86
|
+
|
|
3
87
|
## [4.73.2](https://github.com/Applitools-Dev/sdk/compare/js/core@4.73.1...js/core@4.73.2) (2026-10-26)
|
|
4
88
|
|
|
5
89
|
|
package/dist/core.js
CHANGED
|
@@ -45,10 +45,12 @@ const extract_test_environment_1 = require("./utils/extract-test-environment");
|
|
|
45
45
|
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
|
+
const log_env_snapshot_1 = require("./utils/log-env-snapshot");
|
|
48
49
|
const take_snapshots_1 = require("./ufg/take-snapshots");
|
|
49
50
|
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
51
|
const logger = (0, logger_1.makeLogger)({ logger: defaultLogger, format: { label: 'core' }, maskLog });
|
|
51
52
|
(0, memory_usage_logging_1.startMemoryUsageLogging)({ logger });
|
|
53
|
+
(0, log_env_snapshot_1.logEnvSnapshot)({ logger });
|
|
52
54
|
const environment = (0, extract_test_environment_1.extractTestEnvironment)(defaultEnvironment);
|
|
53
55
|
const offlineLocationPath = (0, ensure_offline_folder_1.ensureOfflineFolder)();
|
|
54
56
|
logger.log(`[pid=${process.pid} Core is initialized ${defaultBase ? 'with' : 'without'} custom base core ${offlineLocationPath ? `and offline location ${offlineLocationPath} ` : ''}and environment `, environment);
|
package/dist/make-manager.js
CHANGED
|
@@ -30,6 +30,7 @@ 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 extract_git_info_1 = require("./utils/extract-git-info");
|
|
33
|
+
const populate_eyes_server_settings_1 = require("./utils/populate-eyes-server-settings");
|
|
33
34
|
const utils = __importStar(require("@applitools/utils"));
|
|
34
35
|
function makeMakeManager({ spec, clients, core, base: defaultBase, agentId: defaultAgentId, environment, cwd = process.cwd(), logger: mainLogger, asyncCache, offlineLocationPath, maskLog, }) {
|
|
35
36
|
return async function makeManager({ type = 'classic', settings, logger = mainLogger, } = {}) {
|
|
@@ -50,6 +51,17 @@ function makeMakeManager({ spec, clients, core, base: defaultBase, agentId: defa
|
|
|
50
51
|
(0, extract_git_info_1.extractGitBranch)({ execOptions: { cwd }, logger }),
|
|
51
52
|
(0, extract_git_info_1.extractGitRepo)({ execOptions: { cwd }, logger }),
|
|
52
53
|
]).catch(() => undefined);
|
|
54
|
+
// Warm the account cache at runner init so it also overlaps the user's pre-open setup. On by
|
|
55
|
+
// default; disable with APPLITOOLS_PREWARM_ACCOUNT_INFO=false. It uses env-only server settings,
|
|
56
|
+
// so it only matches (and only egresses through the right proxy) when apiKey + proxy come from
|
|
57
|
+
// the environment; a config override is a harmless cache miss — open-eyes always warms the cache
|
|
58
|
+
// with the real config-merged settings regardless.
|
|
59
|
+
const eyesServerSettings = (0, populate_eyes_server_settings_1.populateEyesServerSettings)({});
|
|
60
|
+
if (utils.general.getEnvValue('PREWARM_ACCOUNT_INFO', 'boolean') !== false && eyesServerSettings.apiKey) {
|
|
61
|
+
logger.mask(eyesServerSettings.apiKey);
|
|
62
|
+
logger.mask(eyesServerSettings.eyesServerUrl);
|
|
63
|
+
void core.getAccountInfo({ settings: eyesServerSettings, logger }).catch(() => undefined);
|
|
64
|
+
}
|
|
53
65
|
const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId: settings.agentId, logger, offlineLocationPath, maskLog });
|
|
54
66
|
const fetchConcurrency = settings.fetchConcurrency;
|
|
55
67
|
const cores = {
|
package/dist/open-eyes.js
CHANGED
|
@@ -69,6 +69,10 @@ function makeOpenEyes({ type: defaultType = 'classic', clients, batch, removeDup
|
|
|
69
69
|
const eyesServerSettings = (0, populate_eyes_server_settings_1.populateEyesServerSettings)(settings);
|
|
70
70
|
logger.mask(eyesServerSettings.apiKey);
|
|
71
71
|
logger.mask(eyesServerSettings.eyesServerUrl);
|
|
72
|
+
// Start the account fetch now (correct, config-merged server/proxy) so its round-trip overlaps
|
|
73
|
+
// the git/figma/driver work below; awaited where the result is first needed.
|
|
74
|
+
const accountPromise = core.getAccountInfo({ settings: eyesServerSettings, logger });
|
|
75
|
+
accountPromise.catch(() => undefined); // avoid an unhandled rejection if an earlier await throws first
|
|
72
76
|
(_a = settings.userTestId) !== null && _a !== void 0 ? _a : (settings.userTestId = `${settings.testName}--${utils.general.guid()}`);
|
|
73
77
|
settings.batch = { ...batch, ...settings.batch };
|
|
74
78
|
(_b = (_4 = settings.batch).id) !== null && _b !== void 0 ? _b : (_4.id = (_c = utils.general.getEnvValue('BATCH_ID')) !== null && _c !== void 0 ? _c : `generated-${utils.general.guid()}`);
|
|
@@ -140,7 +144,7 @@ function makeOpenEyes({ type: defaultType = 'classic', clients, batch, removeDup
|
|
|
140
144
|
});
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
|
-
const account = await
|
|
147
|
+
const account = await accountPromise;
|
|
144
148
|
await handleBranchFallbackList(account, settings, latestCommitInfoSource, logger);
|
|
145
149
|
const componentConcurrency = account.serverConcurrency.componentConcurrency;
|
|
146
150
|
settings.sessionConcurrency = handleConcurrency({
|
|
@@ -52,6 +52,11 @@ async function takeDomSnapshot({ context, settings, logger, }) {
|
|
|
52
52
|
removeReverseProxyURLPrefixes: Boolean(process.env.APPLITOOLS_SCRIPT_REMOVE_REVERSE_PROXY_URL_PREFIXES),
|
|
53
53
|
skipCDTDedup: utils.general.getEnvValue('SKIP_CDT_DEDUP', 'boolean'),
|
|
54
54
|
skipDataUriExtraction: utils.general.getEnvValue('SKIP_DATA_URI_EXTRACTION', 'boolean'),
|
|
55
|
+
skipExternalizeStyles: utils.general.getEnvValue('SKIP_EXTERNALIZE_STYLES', 'boolean'),
|
|
56
|
+
externalizeStyles: {
|
|
57
|
+
maxCount: utils.general.getEnvValue('EXTERNALIZE_STYLES_MAX_COUNT', 'number'),
|
|
58
|
+
minLength: utils.general.getEnvValue('EXTERNALIZE_STYLES_MIN_LENGTH', 'number'),
|
|
59
|
+
},
|
|
55
60
|
chunkByteLength: (_a = settings === null || settings === void 0 ? void 0 : settings.chunkByteLength) !== null && _a !== void 0 ? _a : (Number(process.env.APPLITOOLS_SCRIPT_RESULT_MAX_BYTE_LENGTH) ||
|
|
56
61
|
(environment.isIOS ? 100000 : 250 * 1024 * 1024)),
|
|
57
62
|
serializeResources: true,
|
|
@@ -173,6 +178,7 @@ function logSnapshot(logger, snapshot) {
|
|
|
173
178
|
try {
|
|
174
179
|
logger.log(`dom snapshot - cdt length: ${snapshot.cdt.length}`);
|
|
175
180
|
logger.log(`dom snapshot - blobs urls (${snapshot.blobs.length}):`, JSON.stringify(snapshot.blobs.map(({ url }) => url)));
|
|
181
|
+
logger.log(`dom snapshot - externalized styles: ${snapshot.blobs.filter(({ url }) => /\?applitools-css=[0-9a-f]{32}$/.test(url)).length}`);
|
|
176
182
|
logger.log(`dom snapshot - resource urls (${snapshot.resourceUrls.length}):`, JSON.stringify(snapshot.resourceUrls));
|
|
177
183
|
logger.log(`dom snapshot - 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'); }))}`);
|
|
178
184
|
logger.log('dom snapshot - safeSelectors:', snapshot.safeSelectors);
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.__resetLogEnvSnapshotForTests = exports.logEnvSnapshot = void 0;
|
|
4
|
+
// Module-level flag: persists for the lifetime of the Node process across multiple makeCore() calls — once-per-process by design.
|
|
5
|
+
let hasLogged = false;
|
|
6
|
+
const APPLITOOLS_DIAGNOSTIC_VARS = [
|
|
7
|
+
'APPLITOOLS_SERVER_URL',
|
|
8
|
+
'APPLITOOLS_BATCH_ID',
|
|
9
|
+
'APPLITOOLS_BATCH_NAME',
|
|
10
|
+
'APPLITOOLS_BATCH_SEQUENCE_NAME',
|
|
11
|
+
'APPLITOOLS_APP_NAME',
|
|
12
|
+
'APPLITOOLS_BUILD_MODE',
|
|
13
|
+
'APPLITOOLS_IS_DISABLED',
|
|
14
|
+
'APPLITOOLS_DONT_CLOSE_BATCHES',
|
|
15
|
+
'APPLITOOLS_BATCH_NOTIFY',
|
|
16
|
+
'APPLITOOLS_CONCURRENCY',
|
|
17
|
+
'APPLITOOLS_CONCURRENT_TABS',
|
|
18
|
+
'APPLITOOLS_RENDER_CONCURRENCY',
|
|
19
|
+
'APPLITOOLS_HTTP_VERSION',
|
|
20
|
+
'APPLITOOLS_LOG_DIR',
|
|
21
|
+
'APPLITOOLS_LOG_FILE',
|
|
22
|
+
'APPLITOOLS_LOG_LEVEL',
|
|
23
|
+
'APPLITOOLS_SHOW_LOGS',
|
|
24
|
+
'APPLITOOLS_LOG_COLORS',
|
|
25
|
+
'APPLITOOLS_MASK_LOG',
|
|
26
|
+
'APPLITOOLS_DEBUG_SCREENSHOTS_DIR',
|
|
27
|
+
'APPLITOOLS_DISABLE_AGENT_CACHIFY',
|
|
28
|
+
'APPLITOOLS_NAMESPACE',
|
|
29
|
+
'APPLITOOLS_FRAMEWORK_PROTOCOL',
|
|
30
|
+
'APPLITOOLS_FRAMEWORK_VERSION',
|
|
31
|
+
'APPLITOOLS_FRAMEWORK_MAJOR_VERSION',
|
|
32
|
+
'APPLITOOLS_USE_DNS_CACHE',
|
|
33
|
+
'APPLITOOLS_USE_SELF_HEALING',
|
|
34
|
+
'APPLITOOLS_SKIP_BRANCH_LOOKUP_IN_SHALLOW_CLONE',
|
|
35
|
+
'APPLITOOLS_ENABLE_BRANCH_LOOKUP_FALLBACK_LIST',
|
|
36
|
+
'APPLITOOLS_BASELINE_BRANCH',
|
|
37
|
+
'APPLITOOLS_PARENT_BRANCH',
|
|
38
|
+
'APPLITOOLS_BASELINE_BRANCH_NAME',
|
|
39
|
+
'APPLITOOLS_PARENT_BRANCH_NAME',
|
|
40
|
+
'APPLITOOLS_BRANCH',
|
|
41
|
+
'APPLITOOLS_BRANCH_NAME',
|
|
42
|
+
'APPLITOOLS_OFFLINE_LOCATION_PATH',
|
|
43
|
+
'APPLITOOLS_OFFLINE_LOG_LIMIT',
|
|
44
|
+
'APPLITOOLS_EYES_SERVER_URL',
|
|
45
|
+
'APPLITOOLS_UFG_SERVER_URL',
|
|
46
|
+
'APPLITOOLS_EXECUTION_CLOUD_URL',
|
|
47
|
+
'APPLITOOLS_EXECUTION_CLOUD_REGION',
|
|
48
|
+
'APPLITOOLS_EG_SERVER_URL',
|
|
49
|
+
'APPLITOOLS_EG_INACTIVITY_TIMEOUT',
|
|
50
|
+
'APPLITOOLS_EG_TIMEOUT',
|
|
51
|
+
'APPLITOOLS_EC_TUNNEL_USE_FRP',
|
|
52
|
+
'APPLITOOLS_TUNNEL_MANAGER_SOCK',
|
|
53
|
+
'APPLITOOLS_EG_TUNNEL_LOG_LEVEL',
|
|
54
|
+
'APPLITOOLS_HEARTBEAT_INTERVAL',
|
|
55
|
+
];
|
|
56
|
+
const APPLITOOLS_SENSITIVE_VARS = [
|
|
57
|
+
'APPLITOOLS_API_KEY',
|
|
58
|
+
'APPLITOOLS_API_KEY_READ',
|
|
59
|
+
'APPLITOOLS_PROXY',
|
|
60
|
+
'APPLITOOLS_PROXY_URL',
|
|
61
|
+
];
|
|
62
|
+
const GIT_CI_VARS = [
|
|
63
|
+
'GITHUB_ACTIONS',
|
|
64
|
+
'GITHUB_HEAD_REF',
|
|
65
|
+
'GITHUB_REF',
|
|
66
|
+
'GITHUB_RUN_ID',
|
|
67
|
+
'CI_COMMIT_REF_NAME',
|
|
68
|
+
'CI_JOB_ID',
|
|
69
|
+
'CIRCLE_BRANCH',
|
|
70
|
+
'CIRCLE_BUILD_NUM',
|
|
71
|
+
'BRANCH_NAME',
|
|
72
|
+
'GIT_BRANCH',
|
|
73
|
+
'BUILD_SOURCEBRANCHNAME',
|
|
74
|
+
'BUILD_BUILDID',
|
|
75
|
+
'BITBUCKET_BRANCH',
|
|
76
|
+
'BITBUCKET_BUILD_NUMBER',
|
|
77
|
+
'TRAVIS_BRANCH',
|
|
78
|
+
'TRAVIS_BUILD_ID',
|
|
79
|
+
'BUILDKITE_BRANCH',
|
|
80
|
+
'BUILDKITE_BUILD_ID',
|
|
81
|
+
'CODEBUILD_WEBHOOK_HEAD_REF',
|
|
82
|
+
'CODEBUILD_BUILD_ID',
|
|
83
|
+
'BUILD_ID',
|
|
84
|
+
'BUILD_NUMBER',
|
|
85
|
+
'BAMBOO',
|
|
86
|
+
];
|
|
87
|
+
const CI_MARKER_VARS = [
|
|
88
|
+
'CI',
|
|
89
|
+
'CONTINUOUS_INTEGRATION',
|
|
90
|
+
'JENKINS_URL',
|
|
91
|
+
'TEAMCITY_VERSION',
|
|
92
|
+
'TF_BUILD',
|
|
93
|
+
'GITLAB_CI',
|
|
94
|
+
];
|
|
95
|
+
const FRAMEWORK_VARS = [
|
|
96
|
+
'PLAYWRIGHT_BROWSERS_PATH',
|
|
97
|
+
'PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD',
|
|
98
|
+
'PLAYWRIGHT_SKIP_BROWSER_GC',
|
|
99
|
+
'PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS',
|
|
100
|
+
'PLAYWRIGHT_HOST_PLATFORM_OVERRIDE',
|
|
101
|
+
'PLAYWRIGHT_DOWNLOAD_HOST',
|
|
102
|
+
'PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST',
|
|
103
|
+
'PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST',
|
|
104
|
+
'PLAYWRIGHT_WEBKIT_DOWNLOAD_HOST',
|
|
105
|
+
'PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT',
|
|
106
|
+
'PLAYWRIGHT_TEST_BASE_URL',
|
|
107
|
+
'PLAYWRIGHT_FORCE_TTY',
|
|
108
|
+
'PLAYWRIGHT_HTML_REPORT',
|
|
109
|
+
'PLAYWRIGHT_HTML_OUTPUT_DIR',
|
|
110
|
+
'PLAYWRIGHT_HTML_OPEN',
|
|
111
|
+
'PWDEBUG',
|
|
112
|
+
'PWTEST_CHILD_PROCESS_TIMEOUT',
|
|
113
|
+
'PWTEST_FORCE_EXIT_TIMEOUT',
|
|
114
|
+
'PWTEST_WATCH',
|
|
115
|
+
'PW_TEST_REPORTER',
|
|
116
|
+
'PW_TEST_REUSE_CONTEXT',
|
|
117
|
+
'PW_TEST_SOURCE_TRANSFORM',
|
|
118
|
+
'PW_TEST_HTML_REPORT_OPEN',
|
|
119
|
+
'PW_TEST_CONNECT_EXPOSE_NETWORK',
|
|
120
|
+
'PW_DISABLE_TS_ESM',
|
|
121
|
+
'PW_EXPERIMENTAL_SERVICE_WORKER_NETWORK_EVENTS',
|
|
122
|
+
'CYPRESS_VERSION',
|
|
123
|
+
'CYPRESS_INSTALL_BINARY',
|
|
124
|
+
'CYPRESS_CACHE_FOLDER',
|
|
125
|
+
'CYPRESS_RUN_BINARY',
|
|
126
|
+
'PUPPETEER_DISABLE_HEADLESS_WARNING',
|
|
127
|
+
'PUPPETEER_EXECUTABLE_PATH',
|
|
128
|
+
'PUPPETEER_SKIP_DOWNLOAD',
|
|
129
|
+
'SELENIUM_REMOTE_URL',
|
|
130
|
+
'SELENIUM_BROWSER',
|
|
131
|
+
'SELENIUM_SERVER_JAR',
|
|
132
|
+
];
|
|
133
|
+
// Remote-browser connect settings routinely embed cloud-grid credentials (tokens in the URL or headers).
|
|
134
|
+
const FRAMEWORK_SENSITIVE_VARS = ['PW_TEST_CONNECT_WS_ENDPOINT', 'PW_TEST_CONNECT_HEADERS'];
|
|
135
|
+
const KNOWN_APPLITOOLS_VARS = new Set([...APPLITOOLS_DIAGNOSTIC_VARS, ...APPLITOOLS_SENSITIVE_VARS]);
|
|
136
|
+
const SENSITIVE_NAME_PATTERN = /KEY|TOKEN|SECRET|PASS|AUTH|PROXY|CREDENTIAL/;
|
|
137
|
+
const MAX_VALUE_LENGTH = 10000;
|
|
138
|
+
function logEnvSnapshot({ logger, env = process.env }) {
|
|
139
|
+
if (hasLogged)
|
|
140
|
+
return;
|
|
141
|
+
hasLogged = true;
|
|
142
|
+
try {
|
|
143
|
+
// Force maskLog: true as defense-in-depth for the env-snapshot block, regardless of the consumer's logger setting.
|
|
144
|
+
const childLogger = logger.extend({ tags: ['env-snapshot'], maskLog: true });
|
|
145
|
+
const groups = [
|
|
146
|
+
{ label: 'applitools', names: APPLITOOLS_DIAGNOSTIC_VARS },
|
|
147
|
+
{ label: 'applitools-sensitive', names: APPLITOOLS_SENSITIVE_VARS, sensitive: true },
|
|
148
|
+
{ label: 'git-ci', names: GIT_CI_VARS },
|
|
149
|
+
{ label: 'ci-markers', names: CI_MARKER_VARS },
|
|
150
|
+
{ label: 'framework', names: FRAMEWORK_VARS },
|
|
151
|
+
{ label: 'framework-sensitive', names: FRAMEWORK_SENSITIVE_VARS, sensitive: true },
|
|
152
|
+
];
|
|
153
|
+
// With masking off the user already accepts raw values in the log, so widen to every
|
|
154
|
+
// APPLITOOLS_* var — this surfaces typos such as APPLITOOLS_LOGS_DIR.
|
|
155
|
+
if (isMaskLogDisabled(env)) {
|
|
156
|
+
const names = Object.keys(env)
|
|
157
|
+
.filter(name => name.startsWith('APPLITOOLS_') && !KNOWN_APPLITOOLS_VARS.has(name))
|
|
158
|
+
.sort();
|
|
159
|
+
groups.push({ label: 'applitools-other', names });
|
|
160
|
+
}
|
|
161
|
+
const isSensitive = (group, name) => group.sensitive || SENSITIVE_NAME_PATTERN.test(name);
|
|
162
|
+
// Two-pass: register every sensitive value with the logger mask set before
|
|
163
|
+
// emitting any line — masking only applies to values registered before the log call.
|
|
164
|
+
for (const group of groups) {
|
|
165
|
+
for (const name of group.names) {
|
|
166
|
+
if (!isSensitive(group, name))
|
|
167
|
+
continue;
|
|
168
|
+
const value = safeRead(env, name);
|
|
169
|
+
if (value)
|
|
170
|
+
childLogger.mask(value);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
for (const group of groups) {
|
|
174
|
+
const entries = [];
|
|
175
|
+
for (const name of group.names) {
|
|
176
|
+
const raw = safeRead(env, name);
|
|
177
|
+
if (raw === undefined || raw === '')
|
|
178
|
+
continue;
|
|
179
|
+
// Presence only for secrets, so the snapshot never carries one even when masking is off.
|
|
180
|
+
entries.push([name, isSensitive(group, name) ? '<set>' : trim(raw)]);
|
|
181
|
+
}
|
|
182
|
+
if (entries.length === 0)
|
|
183
|
+
continue;
|
|
184
|
+
childLogger.log(`[env-snapshot:${group.label}] ` + entries.map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(' '));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
// Best-effort diagnostics; never propagate. No re-log here — if `logger` is the
|
|
189
|
+
// source of the throw, calling it again just loops.
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
exports.logEnvSnapshot = logEnvSnapshot;
|
|
193
|
+
function safeRead(env, name) {
|
|
194
|
+
try {
|
|
195
|
+
const v = env[name];
|
|
196
|
+
return typeof v === 'string' ? v : undefined;
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
return undefined;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// Same rule the formatter applies via getEnvValue('MASK_LOG', 'boolean'): any value other than true/1 turns masking off.
|
|
203
|
+
function isMaskLogDisabled(env) {
|
|
204
|
+
const value = safeRead(env, 'APPLITOOLS_MASK_LOG');
|
|
205
|
+
return value !== undefined && value !== 'null' && !['true', '1'].includes(value);
|
|
206
|
+
}
|
|
207
|
+
function trim(value) {
|
|
208
|
+
return value.length <= MAX_VALUE_LENGTH ? value : value.slice(0, MAX_VALUE_LENGTH);
|
|
209
|
+
}
|
|
210
|
+
/** @internal */
|
|
211
|
+
function __resetLogEnvSnapshotForTests() {
|
|
212
|
+
hasLogged = false;
|
|
213
|
+
}
|
|
214
|
+
exports.__resetLogEnvSnapshotForTests = __resetLogEnvSnapshotForTests;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.74.0",
|
|
4
4
|
"homepage": "https://applitools.com",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": {
|
|
@@ -55,19 +55,19 @@
|
|
|
55
55
|
"test:ios-simulator": "MOCHA_ONLY_TAGS=ios-simulator MOCHA_GROUP=ios-simulator run --top-level mocha ./test/e2e/classic/webview.spec.ts --exit --require ./test/mocha-global-setup.js"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@applitools/core-base": "1.41.
|
|
59
|
-
"@applitools/dom-capture": "11.8.
|
|
60
|
-
"@applitools/dom-snapshot": "4.18.
|
|
61
|
-
"@applitools/driver": "1.26.
|
|
62
|
-
"@applitools/ec-client": "1.12.
|
|
58
|
+
"@applitools/core-base": "1.41.3",
|
|
59
|
+
"@applitools/dom-capture": "11.8.10",
|
|
60
|
+
"@applitools/dom-snapshot": "4.18.8",
|
|
61
|
+
"@applitools/driver": "1.26.14",
|
|
62
|
+
"@applitools/ec-client": "1.12.54",
|
|
63
63
|
"@applitools/image": "1.3.4",
|
|
64
64
|
"@applitools/logger": "2.3.2",
|
|
65
|
-
"@applitools/nml-client": "1.12.
|
|
66
|
-
"@applitools/req": "1.11.
|
|
67
|
-
"@applitools/screenshoter": "3.12.
|
|
68
|
-
"@applitools/snippets": "2.9.
|
|
65
|
+
"@applitools/nml-client": "1.12.10",
|
|
66
|
+
"@applitools/req": "1.11.6",
|
|
67
|
+
"@applitools/screenshoter": "3.12.36",
|
|
68
|
+
"@applitools/snippets": "2.9.10",
|
|
69
69
|
"@applitools/socket": "1.3.18",
|
|
70
|
-
"@applitools/ufg-client": "1.
|
|
70
|
+
"@applitools/ufg-client": "1.25.0",
|
|
71
71
|
"@applitools/utils": "1.15.3",
|
|
72
72
|
"abort-controller": "3.0.0",
|
|
73
73
|
"chalk": "4.1.2",
|
|
@@ -79,13 +79,13 @@
|
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@applitools/bongo": "^5.10.0",
|
|
82
|
-
"@applitools/spec-driver-playwright": "^1.9.
|
|
83
|
-
"@applitools/spec-driver-puppeteer": "^1.8.
|
|
84
|
-
"@applitools/spec-driver-selenium": "^1.8.
|
|
85
|
-
"@applitools/spec-driver-webdriver": "^1.6.
|
|
82
|
+
"@applitools/spec-driver-playwright": "^1.9.14",
|
|
83
|
+
"@applitools/spec-driver-puppeteer": "^1.8.14",
|
|
84
|
+
"@applitools/spec-driver-selenium": "^1.8.14",
|
|
85
|
+
"@applitools/spec-driver-webdriver": "^1.6.14",
|
|
86
86
|
"@applitools/test-server": "^1.4.8",
|
|
87
87
|
"@applitools/test-utils": "^1.5.17",
|
|
88
|
-
"@applitools/tunnel-client": "^1.12.
|
|
88
|
+
"@applitools/tunnel-client": "^1.12.8",
|
|
89
89
|
"@swc-node/register": "^1.6.8",
|
|
90
90
|
"@types/mocha": "^10.0.7",
|
|
91
91
|
"@types/node": "^12.20.55",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { type Logger } from '@applitools/logger';
|
|
3
|
+
export declare function logEnvSnapshot({ logger, env }: {
|
|
4
|
+
logger: Logger;
|
|
5
|
+
env?: NodeJS.ProcessEnv;
|
|
6
|
+
}): void;
|
|
7
|
+
/** @internal */
|
|
8
|
+
export declare function __resetLogEnvSnapshotForTests(): void;
|