@applitools/core 4.39.3 → 4.41.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 +168 -0
- package/dist/offline/run-offline-snapshots.js +13 -0
- package/dist/open-eyes.js +2 -1
- package/dist/ufg/open-eyes.js +4 -0
- package/dist/ufg/utils/register-default-scripts.js +29 -0
- package/dist/universal/spec-driver.js +3 -0
- package/dist/utils/capture-canvas-image-always.js +82 -0
- package/package.json +27 -28
- package/types/automation/types.d.ts +4 -0
- package/types/open-eyes.d.ts +4 -0
- package/types/ufg/utils/register-default-scripts.d.ts +7 -0
- package/types/universal/types.d.ts +4 -0
- package/types/utils/capture-canvas-image-always.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,173 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.41.0](https://github.com/Applitools-Dev/sdk/compare/js/core@4.40.0...js/core@4.41.0) (2025-07-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* canvas webgl without preserveDrawingBuffer=1 | FLD-3144 ([#3040](https://github.com/Applitools-Dev/sdk/issues/3040)) ([f82d8f1](https://github.com/Applitools-Dev/sdk/commit/f82d8f148f913098752ec7bef8635a46b453d6fa))
|
|
9
|
+
* support https_proxy and http_proxy env variables | FLD-2702 ([#3046](https://github.com/Applitools-Dev/sdk/issues/3046)) ([0633809](https://github.com/Applitools-Dev/sdk/commit/06338099f44bfb149a5829f62c2f9b19e2392850))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* add retries for ConnectEnomem errors | FLD-3015 ([#3052](https://github.com/Applitools-Dev/sdk/issues/3052)) ([92caa45](https://github.com/Applitools-Dev/sdk/commit/92caa452b4a6d6f86c903548b40f8207a0ed11d0))
|
|
15
|
+
* determine storybook 9 version | AD-10406 ([#3054](https://github.com/Applitools-Dev/sdk/issues/3054)) ([23486bf](https://github.com/Applitools-Dev/sdk/commit/23486bf1c9dc905d243239214e0e838d54c0b3c2))
|
|
16
|
+
* support for programmatically added nested css rules | FLD-3212 ([#3049](https://github.com/Applitools-Dev/sdk/issues/3049)) ([5abb0f7](https://github.com/Applitools-Dev/sdk/commit/5abb0f7904c4d9e4b716291abecad54554b9ca01))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Dependencies
|
|
20
|
+
|
|
21
|
+
* @applitools/utils bumped to 1.9.0
|
|
22
|
+
#### Features
|
|
23
|
+
|
|
24
|
+
* support https_proxy and http_proxy env variables | FLD-2702 ([#3046](https://github.com/Applitools-Dev/sdk/issues/3046)) ([0633809](https://github.com/Applitools-Dev/sdk/commit/06338099f44bfb149a5829f62c2f9b19e2392850))
|
|
25
|
+
* @applitools/dom-snapshot bumped to 4.12.0
|
|
26
|
+
#### Features
|
|
27
|
+
|
|
28
|
+
* canvas webgl without preserveDrawingBuffer=1 | FLD-3144 ([#3040](https://github.com/Applitools-Dev/sdk/issues/3040)) ([f82d8f1](https://github.com/Applitools-Dev/sdk/commit/f82d8f148f913098752ec7bef8635a46b453d6fa))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
#### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* support for programmatically added nested css rules | FLD-3212 ([#3049](https://github.com/Applitools-Dev/sdk/issues/3049)) ([5abb0f7](https://github.com/Applitools-Dev/sdk/commit/5abb0f7904c4d9e4b716291abecad54554b9ca01))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
* @applitools/driver bumped to 1.22.0
|
|
38
|
+
#### Features
|
|
39
|
+
|
|
40
|
+
* canvas webgl without preserveDrawingBuffer=1 | FLD-3144 ([#3040](https://github.com/Applitools-Dev/sdk/issues/3040)) ([f82d8f1](https://github.com/Applitools-Dev/sdk/commit/f82d8f148f913098752ec7bef8635a46b453d6fa))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
* @applitools/spec-driver-webdriver bumped to 1.3.0
|
|
45
|
+
#### Features
|
|
46
|
+
|
|
47
|
+
* canvas webgl without preserveDrawingBuffer=1 | FLD-3144 ([#3040](https://github.com/Applitools-Dev/sdk/issues/3040)) ([f82d8f1](https://github.com/Applitools-Dev/sdk/commit/f82d8f148f913098752ec7bef8635a46b453d6fa))
|
|
48
|
+
* support https_proxy and http_proxy env variables | FLD-2702 ([#3046](https://github.com/Applitools-Dev/sdk/issues/3046)) ([0633809](https://github.com/Applitools-Dev/sdk/commit/06338099f44bfb149a5829f62c2f9b19e2392850))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
* @applitools/spec-driver-selenium bumped to 1.6.0
|
|
53
|
+
#### Features
|
|
54
|
+
|
|
55
|
+
* canvas webgl without preserveDrawingBuffer=1 | FLD-3144 ([#3040](https://github.com/Applitools-Dev/sdk/issues/3040)) ([f82d8f1](https://github.com/Applitools-Dev/sdk/commit/f82d8f148f913098752ec7bef8635a46b453d6fa))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
* @applitools/spec-driver-puppeteer bumped to 1.5.0
|
|
60
|
+
#### Features
|
|
61
|
+
|
|
62
|
+
* canvas webgl without preserveDrawingBuffer=1 | FLD-3144 ([#3040](https://github.com/Applitools-Dev/sdk/issues/3040)) ([f82d8f1](https://github.com/Applitools-Dev/sdk/commit/f82d8f148f913098752ec7bef8635a46b453d6fa))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
* @applitools/nml-client bumped to 1.9.6
|
|
67
|
+
#### Bug Fixes
|
|
68
|
+
|
|
69
|
+
* add retries for ConnectEnomem errors | FLD-3015 ([#3052](https://github.com/Applitools-Dev/sdk/issues/3052)) ([92caa45](https://github.com/Applitools-Dev/sdk/commit/92caa452b4a6d6f86c903548b40f8207a0ed11d0))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
* @applitools/logger bumped to 2.1.5
|
|
74
|
+
|
|
75
|
+
* @applitools/socket bumped to 1.2.6
|
|
76
|
+
|
|
77
|
+
* @applitools/req bumped to 1.7.14
|
|
78
|
+
|
|
79
|
+
* @applitools/image bumped to 1.1.21
|
|
80
|
+
|
|
81
|
+
* @applitools/screenshoter bumped to 3.11.6
|
|
82
|
+
|
|
83
|
+
* @applitools/tunnel-client bumped to 1.8.1
|
|
84
|
+
|
|
85
|
+
* @applitools/ufg-client bumped to 1.16.13
|
|
86
|
+
|
|
87
|
+
* @applitools/core-base bumped to 1.25.5
|
|
88
|
+
#### Bug Fixes
|
|
89
|
+
|
|
90
|
+
* add retries for ConnectEnomem errors | FLD-3015 ([#3052](https://github.com/Applitools-Dev/sdk/issues/3052)) ([92caa45](https://github.com/Applitools-Dev/sdk/commit/92caa452b4a6d6f86c903548b40f8207a0ed11d0))
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
* @applitools/ec-client bumped to 1.10.16
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
## [4.40.0](https://github.com/Applitools-Dev/sdk/compare/js/core@4.39.3...js/core@4.40.0) (2025-06-15)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
### Features
|
|
101
|
+
|
|
102
|
+
* update build script to include individual zip creation ([#3008](https://github.com/Applitools-Dev/sdk/issues/3008)) ([46a0cfc](https://github.com/Applitools-Dev/sdk/commit/46a0cfcc472ab69384560095d90a7fa58b4b9186))
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
### Bug Fixes
|
|
106
|
+
|
|
107
|
+
* css media query group conditions | FLD-3151 ([#3023](https://github.com/Applitools-Dev/sdk/issues/3023)) ([56ec107](https://github.com/Applitools-Dev/sdk/commit/56ec107bcda6a5a330d19c278267d73de5d86d8b))
|
|
108
|
+
* export issues for ts js with legacy solution ([#3016](https://github.com/Applitools-Dev/sdk/issues/3016)) ([a3a9daf](https://github.com/Applitools-Dev/sdk/commit/a3a9daf9c3361bb1f253499c1335a1434ec520d1))
|
|
109
|
+
* extractLatestCommitInfo | FLD-3217 ([#3039](https://github.com/Applitools-Dev/sdk/issues/3039)) ([3f72a23](https://github.com/Applitools-Dev/sdk/commit/3f72a230fa0166046ea85ae004cfb544de86e628))
|
|
110
|
+
* handle error when sending started message in tunnel manager server ([#3019](https://github.com/Applitools-Dev/sdk/issues/3019)) ([2cdaad8](https://github.com/Applitools-Dev/sdk/commit/2cdaad896fd679187449b69abe529b006f6255ee))
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
### Dependencies
|
|
114
|
+
|
|
115
|
+
* @applitools/dom-snapshot bumped to 4.11.22
|
|
116
|
+
#### Bug Fixes
|
|
117
|
+
|
|
118
|
+
* css media query group conditions | FLD-3151 ([#3023](https://github.com/Applitools-Dev/sdk/issues/3023)) ([56ec107](https://github.com/Applitools-Dev/sdk/commit/56ec107bcda6a5a330d19c278267d73de5d86d8b))
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
* @applitools/nml-client bumped to 1.9.5
|
|
123
|
+
#### Bug Fixes
|
|
124
|
+
|
|
125
|
+
* nml-client depends on core-base ([#2995](https://github.com/Applitools-Dev/sdk/issues/2995)) ([1f7cf69](https://github.com/Applitools-Dev/sdk/commit/1f7cf6930709a40a498dd1f525132648aa593af0))
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
* @applitools/tunnel-client bumped to 1.8.0
|
|
130
|
+
#### Features
|
|
131
|
+
|
|
132
|
+
* update build script to include individual zip creation ([#3008](https://github.com/Applitools-Dev/sdk/issues/3008)) ([46a0cfc](https://github.com/Applitools-Dev/sdk/commit/46a0cfcc472ab69384560095d90a7fa58b4b9186))
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
* @applitools/ufg-client bumped to 1.16.12
|
|
137
|
+
#### Bug Fixes
|
|
138
|
+
|
|
139
|
+
* remove safari-early-access browser version for js sdks | AD-10226 ([#3034](https://github.com/Applitools-Dev/sdk/issues/3034)) ([7ca09f5](https://github.com/Applitools-Dev/sdk/commit/7ca09f5c0c271570142058ea766533b86434dc2e))
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
* @applitools/req bumped to 1.7.13
|
|
144
|
+
|
|
145
|
+
* @applitools/dom-capture bumped to 11.5.6
|
|
146
|
+
|
|
147
|
+
* @applitools/spec-driver-webdriver bumped to 1.2.6
|
|
148
|
+
|
|
149
|
+
* @applitools/screenshoter bumped to 3.11.5
|
|
150
|
+
|
|
151
|
+
* @applitools/core-base bumped to 1.25.4
|
|
152
|
+
#### Bug Fixes
|
|
153
|
+
|
|
154
|
+
* Differentiate Between Invalid and Missing API Key Errors ([6ac17d4](https://github.com/Applitools-Dev/sdk/commit/6ac17d40d7aff45b3de5c949dc7d4673b9739bfd))
|
|
155
|
+
* export issues for ts js with legacy solution ([#3016](https://github.com/Applitools-Dev/sdk/issues/3016)) ([a3a9daf](https://github.com/Applitools-Dev/sdk/commit/a3a9daf9c3361bb1f253499c1335a1434ec520d1))
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
* @applitools/ec-client bumped to 1.10.15
|
|
160
|
+
|
|
161
|
+
* @applitools/test-server bumped to 1.2.3
|
|
162
|
+
#### Bug Fixes
|
|
163
|
+
|
|
164
|
+
* basic auth protected resources | FLD-2761 | FMRI-120 ([#2444](https://github.com/Applitools-Dev/sdk/issues/2444)) ([b48cf49](https://github.com/Applitools-Dev/sdk/commit/b48cf49dec50bbf1ed2ba111608a48cf09962565))
|
|
165
|
+
* export issues for ts js with legacy solution ([#3016](https://github.com/Applitools-Dev/sdk/issues/3016)) ([a3a9daf](https://github.com/Applitools-Dev/sdk/commit/a3a9daf9c3361bb1f253499c1335a1434ec520d1))
|
|
166
|
+
* storybook navigation timeouts ([#2701](https://github.com/Applitools-Dev/sdk/issues/2701)) ([64e3a40](https://github.com/Applitools-Dev/sdk/commit/64e3a40a524ae76ec457ae9c2d1170fbaea5e982))
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
3
171
|
## [4.39.3](https://github.com/Applitools-Dev/sdk/compare/js/core@4.39.2...js/core@4.39.3) (2025-05-20)
|
|
4
172
|
|
|
5
173
|
|
|
@@ -39,6 +39,8 @@ const merge_configs_1 = require("./merge-configs");
|
|
|
39
39
|
const format_results_1 = require("../utils/format-results");
|
|
40
40
|
const throat_1 = __importDefault(require("throat"));
|
|
41
41
|
const os_1 = __importDefault(require("os"));
|
|
42
|
+
const extract_git_info_1 = require("../utils/extract-git-info");
|
|
43
|
+
const open_eyes_1 = require("../open-eyes");
|
|
42
44
|
const throttledReadFile = (0, throat_1.default)(Number(process.env.APPLITOOLS_FILE_READING_CONCURRENCY) || 1000, fs_1.default.promises.readFile);
|
|
43
45
|
function getConsoleLogLimit() {
|
|
44
46
|
var _a;
|
|
@@ -238,6 +240,7 @@ async function runOfflineSnapshots(options) {
|
|
|
238
240
|
async function openEyes(settings, environment, logger) {
|
|
239
241
|
const eyes = await core.base.openEyes({
|
|
240
242
|
settings: {
|
|
243
|
+
latestCommitInfo: await getLatestCommitInfo({ logger, execOptions: { cwd: offlineLocationPath } }),
|
|
241
244
|
...settings,
|
|
242
245
|
environment: {
|
|
243
246
|
...settings.environment,
|
|
@@ -327,6 +330,7 @@ async function runOfflineSnapshots(options) {
|
|
|
327
330
|
target: { ...baseTarget, isTransformed: true },
|
|
328
331
|
settings: {
|
|
329
332
|
...settings,
|
|
333
|
+
latestCommitInfo: await getLatestCommitInfo({ logger, execOptions: { cwd: offlineLocationPath } }),
|
|
330
334
|
environment: {
|
|
331
335
|
...settings.environment,
|
|
332
336
|
...actualEnvironment,
|
|
@@ -573,3 +577,12 @@ function formatEnvironment(environment) {
|
|
|
573
577
|
return env.androidDeviceInfo;
|
|
574
578
|
}
|
|
575
579
|
}
|
|
580
|
+
async function getLatestCommitInfo({ logger, execOptions = { cwd: process.cwd() }, }) {
|
|
581
|
+
var _a;
|
|
582
|
+
const result = (_a = (0, open_eyes_1.getLatestCommitInfoFromEnvVars)(logger)) !== null && _a !== void 0 ? _a : (await (0, extract_git_info_1.extractLatestCommitInfo)({ execOptions, logger }));
|
|
583
|
+
if (result && !(0, extract_git_info_1.isISODate)(result.timestamp)) {
|
|
584
|
+
logger.warn(`latestCommitInfo.timestamp is an invalid ISO date string: ${result.timestamp} - ignoring`);
|
|
585
|
+
}
|
|
586
|
+
else
|
|
587
|
+
return result;
|
|
588
|
+
}
|
package/dist/open-eyes.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.makeOpenEyes = void 0;
|
|
26
|
+
exports.getLatestCommitInfoFromEnvVars = exports.makeOpenEyes = void 0;
|
|
27
27
|
const driver_1 = require("@applitools/driver");
|
|
28
28
|
const core_1 = require("./classic/core");
|
|
29
29
|
const core_2 = require("./ufg/core");
|
|
@@ -253,6 +253,7 @@ function getLatestCommitInfoFromEnvVars(logger) {
|
|
|
253
253
|
logger.warn(`APPLITOOLS_GIT_LATEST_COMMIT_SHA was provided without APPLITOOLS_GIT_LATEST_COMMIT_TIMESTAMP. Not populating latestCommitInfo with the provided sha ${sha}.`);
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
+
exports.getLatestCommitInfoFromEnvVars = getLatestCommitInfoFromEnvVars;
|
|
256
257
|
function isRealBatchId(batchId) {
|
|
257
258
|
return !!batchId && !batchId.startsWith('generated');
|
|
258
259
|
}
|
package/dist/ufg/open-eyes.js
CHANGED
|
@@ -35,6 +35,7 @@ const extract_default_environment_1 = require("./utils/extract-default-environme
|
|
|
35
35
|
const verify_environment_info_1 = require("./utils/verify-environment-info");
|
|
36
36
|
const abort_controller_1 = require("abort-controller");
|
|
37
37
|
const utils = __importStar(require("@applitools/utils"));
|
|
38
|
+
const register_default_scripts_1 = require("./utils/register-default-scripts");
|
|
38
39
|
function makeOpenEyes({ core, spec, logger: mainLogger }) {
|
|
39
40
|
return async function openEyes({ target, settings, storage = new Map(), logger = mainLogger, }) {
|
|
40
41
|
var _a, _b, _c, _d;
|
|
@@ -52,6 +53,9 @@ function makeOpenEyes({ core, spec, logger: mainLogger }) {
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
const environments = await (0, extract_default_environment_1.extractDefaultEnvironments)({ driver });
|
|
56
|
+
if (utils.general.getEnvValue('REGISTER_SCRIPTS_ON_NEW_DOCUMENT', 'boolean') === true) {
|
|
57
|
+
await (0, register_default_scripts_1.registerDefaultScripts)({ driver, logger });
|
|
58
|
+
}
|
|
55
59
|
const controller = new abort_controller_1.AbortController();
|
|
56
60
|
const { signal } = controller;
|
|
57
61
|
const account = await core.getAccountInfo({ settings, logger });
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerDefaultScripts = void 0;
|
|
4
|
+
const capture_canvas_image_always_1 = require("../../utils/capture-canvas-image-always");
|
|
5
|
+
const utils_1 = require("@applitools/utils");
|
|
6
|
+
function wrapFunctionAsIIFE(fn) {
|
|
7
|
+
return `(()=>{ ${fn.toString()} return ${fn.name}.call()})()`;
|
|
8
|
+
}
|
|
9
|
+
async function registerDefaultScripts({ driver, logger, }) {
|
|
10
|
+
if (!driver)
|
|
11
|
+
return [];
|
|
12
|
+
try {
|
|
13
|
+
const captureImagesScript = wrapFunctionAsIIFE(capture_canvas_image_always_1.captureImagesFunc);
|
|
14
|
+
const scripts = [];
|
|
15
|
+
if (utils_1.general.getEnvValue('CAPTURE_CANVAS_WITH_WEBGL', 'boolean') === true) {
|
|
16
|
+
scripts.push({ name: 'captureImagesScript', code: captureImagesScript });
|
|
17
|
+
}
|
|
18
|
+
await scripts.forEach(async (script) => {
|
|
19
|
+
logger.info('running user script', script.name);
|
|
20
|
+
await driver.addScriptToEvaluateOnNewDocument(script.code);
|
|
21
|
+
});
|
|
22
|
+
return scripts;
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
logger.error(error);
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.registerDefaultScripts = registerDefaultScripts;
|
|
@@ -157,6 +157,9 @@ function makeSpec({ socket, spec, }) {
|
|
|
157
157
|
async executeUserFunction(userFunction) {
|
|
158
158
|
return socket.request('Driver.executeUserFunction', userFunction);
|
|
159
159
|
},
|
|
160
|
+
async executeBrowserCommands(driver, commands) {
|
|
161
|
+
return socket.request('Driver.executeBrowserCommands', { driver, commands });
|
|
162
|
+
},
|
|
160
163
|
};
|
|
161
164
|
// add default commands to spec (if not already there) such as `isUserFunction`
|
|
162
165
|
spec = addDefaultCommands(spec);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.captureImagesFunc = void 0;
|
|
4
|
+
function captureImagesFunc() {
|
|
5
|
+
async function isNonBlackImage(dataUrl) {
|
|
6
|
+
const img = new Image();
|
|
7
|
+
img.src = dataUrl;
|
|
8
|
+
await new Promise((resolve, reject) => {
|
|
9
|
+
img.onload = () => resolve();
|
|
10
|
+
img.onerror = () => reject();
|
|
11
|
+
});
|
|
12
|
+
const canvas = document.createElement('canvas');
|
|
13
|
+
canvas.width = img.width;
|
|
14
|
+
canvas.height = img.height;
|
|
15
|
+
const ctx = canvas.getContext('2d');
|
|
16
|
+
if (!ctx)
|
|
17
|
+
return false;
|
|
18
|
+
ctx.drawImage(img, 0, 0);
|
|
19
|
+
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height).data;
|
|
20
|
+
for (let i = 0; i < imageData.length; i += 4) {
|
|
21
|
+
if (imageData[i] !== 0 || imageData[i + 1] !== 0 || imageData[i + 2] !== 0) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
function processWebGLCanvases(win) {
|
|
28
|
+
Array.from(win.document.getElementsByTagName('canvas')).forEach((canvas) => {
|
|
29
|
+
const gl = canvas.getContext('webgl') || canvas.getContext('webgl2');
|
|
30
|
+
if (!gl)
|
|
31
|
+
return;
|
|
32
|
+
const attrs = gl.getContextAttributes();
|
|
33
|
+
if (!attrs)
|
|
34
|
+
return;
|
|
35
|
+
const { preserveDrawingBuffer } = attrs;
|
|
36
|
+
if (!preserveDrawingBuffer && canvas.width > 0 && canvas.height > 0) {
|
|
37
|
+
const dataUrl = canvas.toDataURL('image/png');
|
|
38
|
+
if ((canvas.dataset.dataUrl || '') === dataUrl)
|
|
39
|
+
return;
|
|
40
|
+
isNonBlackImage(dataUrl).then(result => {
|
|
41
|
+
if (result) {
|
|
42
|
+
canvas.dataset.dataUrl = dataUrl;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function patchRequestAnimationFrame(win) {
|
|
49
|
+
var _a;
|
|
50
|
+
if (win.__rafPatched) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const HTMLCanvasElementCtor = win.HTMLCanvasElement ||
|
|
54
|
+
(win.constructor && win.constructor.HTMLCanvasElement) ||
|
|
55
|
+
(win.document && ((_a = win.document.defaultView) === null || _a === void 0 ? void 0 : _a.HTMLCanvasElement));
|
|
56
|
+
const origGetContext = (HTMLCanvasElementCtor && HTMLCanvasElementCtor.prototype.getContext);
|
|
57
|
+
if (!origGetContext) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const originalRAF = win.requestAnimationFrame;
|
|
61
|
+
win.requestAnimationFrame = function (callback) {
|
|
62
|
+
const rafId = originalRAF.call(this, (time) => {
|
|
63
|
+
callback.call(win, time);
|
|
64
|
+
processWebGLCanvases(win);
|
|
65
|
+
});
|
|
66
|
+
return rafId;
|
|
67
|
+
};
|
|
68
|
+
win.__rafPatched = true;
|
|
69
|
+
}
|
|
70
|
+
function takeCanvasScreenshots(win = window) {
|
|
71
|
+
if (win.__rafPatched) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
patchRequestAnimationFrame(win);
|
|
76
|
+
}
|
|
77
|
+
catch (e) { }
|
|
78
|
+
}
|
|
79
|
+
Object.assign(window, { takeCanvasScreenshots });
|
|
80
|
+
takeCanvasScreenshots();
|
|
81
|
+
}
|
|
82
|
+
exports.captureImagesFunc = captureImagesFunc;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.41.0",
|
|
4
4
|
"homepage": "https://applitools.com",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
|
|
@@ -42,20 +42,19 @@
|
|
|
42
42
|
],
|
|
43
43
|
"scripts": {
|
|
44
44
|
"lint": "run --top-level eslint '**/*.ts'",
|
|
45
|
-
"build": "yarn build:dist
|
|
46
|
-
"build:short": "yarn build:dist",
|
|
45
|
+
"build": "yarn build:dist",
|
|
47
46
|
"build:dist": "run --top-level tsc --project ./tsconfig.build.json",
|
|
48
|
-
"build:bin": "sea",
|
|
47
|
+
"build:bin": "yarn build && sea",
|
|
49
48
|
"build:bin:zip": "zip -j ./bin/core.zip $(find ./bin -type f -not -name '*.zip' -not -name '*.tar.gz' | xargs)",
|
|
50
49
|
"build:bin:tgz": "tar -czf ./bin/core.tar.gz $(find ./bin -type f -not -name '*.zip' -not -name '*.tar.gz' | xargs)",
|
|
51
|
-
"test": "run --top-level mocha './test/**/*.spec.ts' --exclude './test/bin/**' --parallel --jobs ${MOCHA_JOBS:-15} --exit",
|
|
50
|
+
"test": "run --top-level mocha './test/**/*.spec.ts' --exclude './test/bin/**' --parallel --jobs ${MOCHA_JOBS:-15} --exit --require ./test/mocha-global-setup.js",
|
|
52
51
|
"test:local": "MOCHA_OMIT_TAGS=sauce,browserstack run test",
|
|
53
52
|
"test:sauce": "MOCHA_ONLY_TAGS=sauce,browserstack run test",
|
|
54
|
-
"test:bin": "MOCHA_GROUP=bin run --top-level mocha './test/bin/**/*.spec.ts' --parallel --jobs ${MOCHA_JOBS:-15}",
|
|
55
|
-
"test:e2e": "MOCHA_GROUP=e2e run --top-level mocha './test/e2e/**/*.spec.ts' --parallel --jobs ${MOCHA_JOBS:-15} --exit",
|
|
56
|
-
"test:it": "MOCHA_GROUP=it run --top-level mocha './test/it/**/*.spec.ts'",
|
|
57
|
-
"test:unit": "MOCHA_GROUP=unit run --top-level mocha './test/unit/**/*.spec.ts'",
|
|
58
|
-
"setup": "run --top-level browsers:setup",
|
|
53
|
+
"test:bin": "MOCHA_GROUP=bin run --top-level mocha './test/bin/**/*.spec.ts' --parallel --jobs ${MOCHA_JOBS:-15} --require ./test/mocha-global-setup.js",
|
|
54
|
+
"test:e2e": "MOCHA_GROUP=e2e run --top-level mocha './test/e2e/**/*.spec.ts' --parallel --jobs ${MOCHA_JOBS:-15} --exit --require ./test/mocha-global-setup.js",
|
|
55
|
+
"test:it": "MOCHA_GROUP=it run --top-level mocha './test/it/**/*.spec.ts' --require ./test/mocha-global-setup.js",
|
|
56
|
+
"test:unit": "MOCHA_GROUP=unit run --top-level mocha './test/unit/**/*.spec.ts' --require ./test/mocha-global-setup.js",
|
|
57
|
+
"setup": "run --top-level browsers:setup && run --top-level xvfb:setup",
|
|
59
58
|
"setup:standalone": "sh -c 'yarn chromedriver --port=4444 --verbose &'"
|
|
60
59
|
},
|
|
61
60
|
"sea": {
|
|
@@ -76,20 +75,20 @@
|
|
|
76
75
|
}
|
|
77
76
|
},
|
|
78
77
|
"dependencies": {
|
|
79
|
-
"@applitools/core-base": "1.25.
|
|
80
|
-
"@applitools/dom-capture": "11.5.
|
|
81
|
-
"@applitools/dom-snapshot": "4.
|
|
82
|
-
"@applitools/driver": "1.
|
|
83
|
-
"@applitools/ec-client": "1.10.
|
|
84
|
-
"@applitools/logger": "2.1.
|
|
85
|
-
"@applitools/nml-client": "1.9.
|
|
86
|
-
"@applitools/req": "1.7.
|
|
87
|
-
"@applitools/screenshoter": "3.11.
|
|
78
|
+
"@applitools/core-base": "1.25.5",
|
|
79
|
+
"@applitools/dom-capture": "11.5.6",
|
|
80
|
+
"@applitools/dom-snapshot": "4.12.0",
|
|
81
|
+
"@applitools/driver": "1.22.0",
|
|
82
|
+
"@applitools/ec-client": "1.10.16",
|
|
83
|
+
"@applitools/logger": "2.1.5",
|
|
84
|
+
"@applitools/nml-client": "1.9.6",
|
|
85
|
+
"@applitools/req": "1.7.14",
|
|
86
|
+
"@applitools/screenshoter": "3.11.6",
|
|
88
87
|
"@applitools/snippets": "2.6.5",
|
|
89
|
-
"@applitools/socket": "1.2.
|
|
90
|
-
"@applitools/spec-driver-webdriver": "1.
|
|
91
|
-
"@applitools/ufg-client": "1.16.
|
|
92
|
-
"@applitools/utils": "1.
|
|
88
|
+
"@applitools/socket": "1.2.6",
|
|
89
|
+
"@applitools/spec-driver-webdriver": "1.3.0",
|
|
90
|
+
"@applitools/ufg-client": "1.16.13",
|
|
91
|
+
"@applitools/utils": "1.9.0",
|
|
93
92
|
"@types/ws": "8.5.5",
|
|
94
93
|
"abort-controller": "3.0.0",
|
|
95
94
|
"chalk": "4.1.2",
|
|
@@ -103,11 +102,11 @@
|
|
|
103
102
|
"devDependencies": {
|
|
104
103
|
"@applitools/bongo": "^5.10.0",
|
|
105
104
|
"@applitools/sea": "^1.0.0",
|
|
106
|
-
"@applitools/spec-driver-puppeteer": "^1.
|
|
107
|
-
"@applitools/spec-driver-selenium": "^1.
|
|
108
|
-
"@applitools/test-server": "^1.2.
|
|
105
|
+
"@applitools/spec-driver-puppeteer": "^1.5.0",
|
|
106
|
+
"@applitools/spec-driver-selenium": "^1.6.0",
|
|
107
|
+
"@applitools/test-server": "^1.2.3",
|
|
109
108
|
"@applitools/test-utils": "^1.5.17",
|
|
110
|
-
"@applitools/tunnel-client": "^1.
|
|
109
|
+
"@applitools/tunnel-client": "^1.8.1",
|
|
111
110
|
"@types/mocha": "^10.0.7",
|
|
112
111
|
"@types/node": "^12.20.55",
|
|
113
112
|
"@types/selenium-webdriver": "^4.1.2",
|
|
@@ -117,7 +116,7 @@
|
|
|
117
116
|
"crypto": "^1.0.1",
|
|
118
117
|
"nock": "^13.3.2",
|
|
119
118
|
"png-async": "^0.9.4",
|
|
120
|
-
"puppeteer": "^
|
|
119
|
+
"puppeteer": "^24.11.1",
|
|
121
120
|
"selenium-webdriver": "^4.15.0"
|
|
122
121
|
},
|
|
123
122
|
"engines": {
|
|
@@ -46,6 +46,10 @@ export type ExactEnvironment = BaseCore.Environment & {
|
|
|
46
46
|
fallbackBaselineId?: string;
|
|
47
47
|
};
|
|
48
48
|
export type Environment = RenderEnvironment | ExactEnvironment;
|
|
49
|
+
export type Script = {
|
|
50
|
+
name: string;
|
|
51
|
+
code: string;
|
|
52
|
+
};
|
|
49
53
|
export interface Core<TSpec extends SpecType> extends Omit<BaseCore.Core, 'openEyes'> {
|
|
50
54
|
readonly base: BaseCore.Core;
|
|
51
55
|
getViewportSize?(options: {
|
package/types/open-eyes.d.ts
CHANGED
|
@@ -28,4 +28,8 @@ export declare function makeOpenEyes<TSpec extends SpecType, TDefaultType extend
|
|
|
28
28
|
target?: DriverTarget<TSpec> | undefined;
|
|
29
29
|
logger?: Logger | undefined;
|
|
30
30
|
}) => Promise<Eyes<TSpec, TType>>;
|
|
31
|
+
export declare function getLatestCommitInfoFromEnvVars(logger: Logger): {
|
|
32
|
+
timestamp: string;
|
|
33
|
+
sha: string;
|
|
34
|
+
} | undefined;
|
|
31
35
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Script } from '../types';
|
|
2
|
+
import { type SpecType, type Driver } from '@applitools/driver';
|
|
3
|
+
import { type Logger } from '@applitools/logger';
|
|
4
|
+
export declare function registerDefaultScripts<TSpec extends SpecType>({ driver, logger, }: {
|
|
5
|
+
driver?: Driver<TSpec>;
|
|
6
|
+
logger: Logger;
|
|
7
|
+
}): Promise<Script[]>;
|
|
@@ -194,5 +194,9 @@ export interface UniversalSpecDriver<T extends SpecType> {
|
|
|
194
194
|
}): Promise<void>;
|
|
195
195
|
isUserFunction(ref: any): Promise<boolean>;
|
|
196
196
|
executeUserFunction(userFunction: Ref): Promise<any>;
|
|
197
|
+
executeBrowserCommands(options: {
|
|
198
|
+
driver?: T['driver'];
|
|
199
|
+
commands: any[];
|
|
200
|
+
}): Promise<any>;
|
|
197
201
|
}
|
|
198
202
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function captureImagesFunc(): void;
|