@applitools/eyes 1.33.3 → 1.33.4
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/dist/BatchClose.js +84 -0
- package/dist/Eyes.js +750 -0
- package/dist/Logger.js +122 -0
- package/dist/Runners.js +130 -0
- package/dist/SDK.js +45 -0
- package/dist/SessionEventHandlers.js +193 -0
- package/dist/cli/cli.js +56 -0
- package/dist/cli/load-config.js +73 -0
- package/dist/enums/AccessibilityGuidelinesVersion.js +9 -0
- package/dist/enums/AccessibilityLevel.js +9 -0
- package/dist/enums/AccessibilityRegionType.js +12 -0
- package/dist/enums/AccessibilityStatus.js +9 -0
- package/dist/enums/BrowserType.js +23 -0
- package/dist/enums/CorsIframeHandle.js +10 -0
- package/dist/enums/DeviceName.js +105 -0
- package/dist/enums/DynamicTextType.js +13 -0
- package/dist/enums/FailureReport.js +8 -0
- package/dist/enums/IosDeviceName.js +47 -0
- package/dist/enums/IosMultiDeviceTarget.js +30 -0
- package/dist/enums/IosVersion.js +10 -0
- package/dist/enums/MatchLevel.js +15 -0
- package/dist/enums/ScreenOrientation.js +8 -0
- package/dist/enums/SessionType.js +8 -0
- package/dist/enums/StitchMode.js +11 -0
- package/dist/enums/TestResultsStatus.js +9 -0
- package/dist/errors/DiffsFoundError.js +38 -0
- package/dist/errors/EyesError.js +6 -0
- package/dist/errors/NewTestError.js +38 -0
- package/dist/errors/TestFailedError.js +47 -0
- package/dist/index.js +128 -0
- package/dist/input/AUTProxySettings.js +2 -0
- package/dist/input/AccessibilityMatchSettings.js +109 -0
- package/dist/input/AccessibilitySettings.js +2 -0
- package/dist/input/BatchInfo.js +153 -0
- package/dist/input/CheckSettings.js +663 -0
- package/dist/input/Configuration.js +1179 -0
- package/dist/input/CutProvider.js +132 -0
- package/dist/input/DebugScreenshotProvider.js +2 -0
- package/dist/input/DensityMetrics.js +2 -0
- package/dist/input/ExactMatchSettings.js +102 -0
- package/dist/input/EyesSelector.js +2 -0
- package/dist/input/FloatingMatchSettings.js +152 -0
- package/dist/input/Image.js +2 -0
- package/dist/input/ImageMatchSettings.js +271 -0
- package/dist/input/ImageRotation.js +59 -0
- package/dist/input/LatestCommitInfo.js +2 -0
- package/dist/input/LazyLoadOptions.js +2 -0
- package/dist/input/Location.js +74 -0
- package/dist/input/LogHandler.js +90 -0
- package/dist/input/OCRRegion.js +2 -0
- package/dist/input/OCRSettings.js +2 -0
- package/dist/input/PropertyData.js +76 -0
- package/dist/input/ProxySettings.js +77 -0
- package/dist/input/RectangleSize.js +74 -0
- package/dist/input/Region.js +135 -0
- package/dist/input/RenderInfo.js +2 -0
- package/dist/input/RunnerOptions.js +56 -0
- package/dist/input/VisualLocatorSettings.js +2 -0
- package/dist/output/ApiUrls.js +102 -0
- package/dist/output/AppUrls.js +66 -0
- package/dist/output/MatchResult.js +66 -0
- package/dist/output/SessionUrls.js +66 -0
- package/dist/output/StepInfo.js +118 -0
- package/dist/output/TestAccessibilityStatus.js +2 -0
- package/dist/output/TestResultContainer.js +49 -0
- package/dist/output/TestResults.js +378 -0
- package/dist/output/TestResultsSummary.js +49 -0
- package/dist/output/TextRegion.js +2 -0
- package/dist/output/ValidationInfo.js +60 -0
- package/dist/output/ValidationResult.js +53 -0
- package/package.json +1 -1
- package/types/BatchClose.d.ts +23 -0
- package/types/Eyes.d.ts +255 -0
- package/types/Logger.d.ts +30 -0
- package/types/Runners.d.ts +41 -0
- package/types/SDK.d.ts +20 -0
- package/types/SessionEventHandlers.d.ts +78 -0
- package/types/cli/cli.d.ts +2 -0
- package/types/cli/load-config.d.ts +1 -0
- package/types/enums/AccessibilityGuidelinesVersion.d.ts +5 -0
- package/types/enums/AccessibilityLevel.d.ts +5 -0
- package/types/enums/AccessibilityRegionType.d.ts +8 -0
- package/types/enums/AccessibilityStatus.d.ts +5 -0
- package/types/enums/BrowserType.d.ts +20 -0
- package/types/enums/CorsIframeHandle.d.ts +7 -0
- package/types/enums/DeviceName.d.ts +101 -0
- package/types/enums/DynamicTextType.d.ts +9 -0
- package/types/enums/FailureReport.d.ts +5 -0
- package/types/enums/IosDeviceName.d.ts +43 -0
- package/types/enums/IosMultiDeviceTarget.d.ts +26 -0
- package/types/enums/IosVersion.d.ts +7 -0
- package/types/enums/MatchLevel.d.ts +12 -0
- package/types/enums/ScreenOrientation.d.ts +5 -0
- package/types/enums/SessionType.d.ts +5 -0
- package/types/enums/StitchMode.d.ts +8 -0
- package/types/enums/TestResultsStatus.d.ts +6 -0
- package/types/errors/DiffsFoundError.d.ts +6 -0
- package/types/errors/EyesError.d.ts +2 -0
- package/types/errors/NewTestError.d.ts +6 -0
- package/types/errors/TestFailedError.d.ts +9 -0
- package/types/index.d.ts +60 -0
- package/types/input/AUTProxySettings.d.ts +5 -0
- package/types/input/AccessibilityMatchSettings.d.ts +34 -0
- package/types/input/AccessibilitySettings.d.ts +6 -0
- package/types/input/BatchInfo.d.ts +47 -0
- package/types/input/CheckSettings.d.ts +266 -0
- package/types/input/Configuration.d.ts +437 -0
- package/types/input/CutProvider.d.ts +44 -0
- package/types/input/DebugScreenshotProvider.d.ts +5 -0
- package/types/input/DensityMetrics.d.ts +5 -0
- package/types/input/ExactMatchSettings.d.ts +34 -0
- package/types/input/EyesSelector.d.ts +6 -0
- package/types/input/FloatingMatchSettings.d.ts +50 -0
- package/types/input/Image.d.ts +11 -0
- package/types/input/ImageMatchSettings.d.ts +95 -0
- package/types/input/ImageRotation.d.ts +15 -0
- package/types/input/LatestCommitInfo.d.ts +4 -0
- package/types/input/LazyLoadOptions.d.ts +5 -0
- package/types/input/Location.d.ts +23 -0
- package/types/input/LogHandler.d.ts +45 -0
- package/types/input/OCRRegion.d.ts +9 -0
- package/types/input/OCRSettings.d.ts +6 -0
- package/types/input/PropertyData.d.ts +23 -0
- package/types/input/ProxySettings.d.ts +25 -0
- package/types/input/RectangleSize.d.ts +23 -0
- package/types/input/Region.d.ts +46 -0
- package/types/input/RenderInfo.d.ts +47 -0
- package/types/input/RunnerOptions.d.ts +21 -0
- package/types/input/VisualLocatorSettings.d.ts +4 -0
- package/types/output/ApiUrls.d.ts +41 -0
- package/types/output/AppUrls.d.ts +23 -0
- package/types/output/MatchResult.d.ts +23 -0
- package/types/output/SessionUrls.d.ts +23 -0
- package/types/output/StepInfo.d.ts +50 -0
- package/types/output/TestAccessibilityStatus.d.ts +8 -0
- package/types/output/TestResultContainer.d.ts +31 -0
- package/types/output/TestResults.d.ts +186 -0
- package/types/output/TestResultsSummary.d.ts +18 -0
- package/types/output/TextRegion.d.ts +7 -0
- package/types/output/ValidationInfo.d.ts +21 -0
- package/types/output/ValidationResult.d.ts +18 -0
|
@@ -0,0 +1,663 @@
|
|
|
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.Target = exports.TargetAutomation = exports.TargetImage = exports.CheckSettingsAutomationFluent = exports.CheckSettingsImageFluent = exports.CheckSettingsBaseFluent = void 0;
|
|
27
|
+
const AccessibilityRegionType_1 = require("../enums/AccessibilityRegionType");
|
|
28
|
+
const MatchLevel_1 = require("../enums/MatchLevel");
|
|
29
|
+
const utils = __importStar(require("@applitools/utils"));
|
|
30
|
+
class CheckSettingsBaseFluent {
|
|
31
|
+
constructor(settings, parent) {
|
|
32
|
+
var _a;
|
|
33
|
+
this._settings = {};
|
|
34
|
+
this.childs = [];
|
|
35
|
+
this._settings = utils.types.instanceOf(settings, CheckSettingsBaseFluent) ? settings.toObject() : settings !== null && settings !== void 0 ? settings : {};
|
|
36
|
+
this.parent = (parent !== null && parent !== void 0 ? parent : settings === null || settings === void 0 ? void 0 : settings.parent);
|
|
37
|
+
if (parent) {
|
|
38
|
+
(_a = parent.childs) !== null && _a !== void 0 ? _a : (parent.childs = []);
|
|
39
|
+
parent.childs.push(this);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this._settings = utils.types.instanceOf(settings, CheckSettingsBaseFluent) ? settings.toObject() : settings !== null && settings !== void 0 ? settings : {};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
region(region) {
|
|
46
|
+
this._settings.region = region;
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
name(name) {
|
|
50
|
+
this._settings.name = name;
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
withName(name) {
|
|
54
|
+
return this.name(name);
|
|
55
|
+
}
|
|
56
|
+
ignoreRegion(region) {
|
|
57
|
+
if (!this._settings.ignoreRegions)
|
|
58
|
+
this._settings.ignoreRegions = [];
|
|
59
|
+
this._settings.ignoreRegions.push(region);
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
ignoreRegions(...regions) {
|
|
63
|
+
regions.forEach(region => this.ignoreRegion(region));
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
/** @deprecated */
|
|
67
|
+
ignore(region) {
|
|
68
|
+
return this.ignoreRegion(region);
|
|
69
|
+
}
|
|
70
|
+
/** @deprecated */
|
|
71
|
+
ignores(...regions) {
|
|
72
|
+
return this.ignoreRegions(...regions);
|
|
73
|
+
}
|
|
74
|
+
layoutRegion(region) {
|
|
75
|
+
if (!this._settings.layoutRegions)
|
|
76
|
+
this._settings.layoutRegions = [];
|
|
77
|
+
this._settings.layoutRegions.push(region);
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
layoutRegions(...regions) {
|
|
81
|
+
regions.forEach(region => this.layoutRegion(region));
|
|
82
|
+
return this;
|
|
83
|
+
}
|
|
84
|
+
strictRegion(region) {
|
|
85
|
+
if (!this._settings.strictRegions)
|
|
86
|
+
this._settings.strictRegions = [];
|
|
87
|
+
this._settings.strictRegions.push(region);
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
strictRegions(...regions) {
|
|
91
|
+
regions.forEach(region => this.strictRegion(region));
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
contentRegion(region) {
|
|
95
|
+
if (!this._settings.contentRegions)
|
|
96
|
+
this._settings.contentRegions = [];
|
|
97
|
+
this._settings.contentRegions.push(region);
|
|
98
|
+
return this;
|
|
99
|
+
}
|
|
100
|
+
contentRegions(...regions) {
|
|
101
|
+
regions.forEach(region => this.contentRegion(region));
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
floatingRegion(region, maxUpOffset, maxDownOffset, maxLeftOffset, maxRightOffset) {
|
|
105
|
+
let floatingRegion;
|
|
106
|
+
if (utils.types.has(region, 'region')) {
|
|
107
|
+
const { maxUpOffset, maxDownOffset, maxLeftOffset, maxRightOffset, ...rest } = region;
|
|
108
|
+
floatingRegion = {
|
|
109
|
+
offset: { top: maxUpOffset, bottom: maxDownOffset, left: maxLeftOffset, right: maxRightOffset },
|
|
110
|
+
...rest,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
floatingRegion = {
|
|
115
|
+
region,
|
|
116
|
+
offset: { top: maxUpOffset, bottom: maxDownOffset, left: maxLeftOffset, right: maxRightOffset },
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
if (!this._settings.floatingRegions)
|
|
120
|
+
this._settings.floatingRegions = [];
|
|
121
|
+
this._settings.floatingRegions.push(floatingRegion);
|
|
122
|
+
return this;
|
|
123
|
+
}
|
|
124
|
+
floatingRegions(regionOrMaxOffset, ...regions) {
|
|
125
|
+
let maxOffset;
|
|
126
|
+
if (utils.types.isNumber(regionOrMaxOffset)) {
|
|
127
|
+
maxOffset = regionOrMaxOffset;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
this.floatingRegion(regionOrMaxOffset);
|
|
131
|
+
}
|
|
132
|
+
regions.forEach(region => {
|
|
133
|
+
if (utils.types.has(region, 'region'))
|
|
134
|
+
this.floatingRegion(region);
|
|
135
|
+
else
|
|
136
|
+
this.floatingRegion(region, maxOffset, maxOffset, maxOffset, maxOffset);
|
|
137
|
+
});
|
|
138
|
+
return this;
|
|
139
|
+
}
|
|
140
|
+
floating(region, maxUpOffset, maxDownOffset, maxLeftOffset, maxRightOffset) {
|
|
141
|
+
if (utils.types.has(region, 'region'))
|
|
142
|
+
return this.floatingRegion(region);
|
|
143
|
+
else
|
|
144
|
+
return this.floatingRegion(region, maxUpOffset, maxDownOffset, maxLeftOffset, maxRightOffset);
|
|
145
|
+
}
|
|
146
|
+
floatings(regionOrMaxOffset, ...regions) {
|
|
147
|
+
return this.floatingRegions(regionOrMaxOffset, ...regions);
|
|
148
|
+
}
|
|
149
|
+
accessibilityRegion(region, type) {
|
|
150
|
+
const accessibilityRegion = utils.types.has(region, 'region') ? region : { region, type };
|
|
151
|
+
if (!this._settings.accessibilityRegions)
|
|
152
|
+
this._settings.accessibilityRegions = [];
|
|
153
|
+
this._settings.accessibilityRegions.push(accessibilityRegion);
|
|
154
|
+
return this;
|
|
155
|
+
}
|
|
156
|
+
accessibilityRegions(regionOrType, ...regions) {
|
|
157
|
+
let type;
|
|
158
|
+
if (utils.types.isEnumValue(regionOrType, AccessibilityRegionType_1.AccessibilityRegionTypeEnum)) {
|
|
159
|
+
type = regionOrType;
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
this.accessibilityRegion(regionOrType);
|
|
163
|
+
}
|
|
164
|
+
regions.forEach(region => {
|
|
165
|
+
if (utils.types.has(region, 'region'))
|
|
166
|
+
this.accessibilityRegion(region);
|
|
167
|
+
else
|
|
168
|
+
this.accessibilityRegion(region, type);
|
|
169
|
+
});
|
|
170
|
+
return this;
|
|
171
|
+
}
|
|
172
|
+
dynamicRegion(region, type) {
|
|
173
|
+
const dynamicRegion = utils.types.has(region, 'region') ? region : { region, type };
|
|
174
|
+
if (!this._settings.dynamicRegions)
|
|
175
|
+
this._settings.dynamicRegions = [];
|
|
176
|
+
this._settings.dynamicRegions.push(dynamicRegion);
|
|
177
|
+
return this;
|
|
178
|
+
}
|
|
179
|
+
dynamicRegions(regionOrTypes, ...regions) {
|
|
180
|
+
let types;
|
|
181
|
+
if (utils.types.isArray(regionOrTypes) || utils.types.isString(regionOrTypes)) {
|
|
182
|
+
types = regionOrTypes;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
this.dynamicRegions(regionOrTypes);
|
|
186
|
+
}
|
|
187
|
+
regions.forEach(region => {
|
|
188
|
+
if (utils.types.has(region, 'region'))
|
|
189
|
+
this.dynamicRegion(region);
|
|
190
|
+
else
|
|
191
|
+
this.dynamicRegion(region, types);
|
|
192
|
+
});
|
|
193
|
+
return this;
|
|
194
|
+
}
|
|
195
|
+
matchLevel(matchLevel) {
|
|
196
|
+
this._settings.matchLevel = matchLevel;
|
|
197
|
+
return this;
|
|
198
|
+
}
|
|
199
|
+
layout() {
|
|
200
|
+
this._settings.matchLevel = MatchLevel_1.MatchLevelEnum.Layout;
|
|
201
|
+
return this;
|
|
202
|
+
}
|
|
203
|
+
exact() {
|
|
204
|
+
this._settings.matchLevel = MatchLevel_1.MatchLevelEnum.Exact;
|
|
205
|
+
return this;
|
|
206
|
+
}
|
|
207
|
+
strict() {
|
|
208
|
+
this._settings.matchLevel = MatchLevel_1.MatchLevelEnum.Strict;
|
|
209
|
+
return this;
|
|
210
|
+
}
|
|
211
|
+
ignoreColors() {
|
|
212
|
+
this._settings.matchLevel = MatchLevel_1.MatchLevelEnum.IgnoreColors;
|
|
213
|
+
return this;
|
|
214
|
+
}
|
|
215
|
+
dynamic() {
|
|
216
|
+
this._settings.matchLevel = MatchLevel_1.MatchLevelEnum.Dynamic;
|
|
217
|
+
return this;
|
|
218
|
+
}
|
|
219
|
+
/** @deprecated */
|
|
220
|
+
content() {
|
|
221
|
+
this._settings.matchLevel = MatchLevel_1.MatchLevelEnum.Content;
|
|
222
|
+
return this;
|
|
223
|
+
}
|
|
224
|
+
enablePatterns(enablePatterns = true) {
|
|
225
|
+
this._settings.enablePatterns = enablePatterns;
|
|
226
|
+
return this;
|
|
227
|
+
}
|
|
228
|
+
ignoreDisplacements(ignoreDisplacements = true) {
|
|
229
|
+
this._settings.ignoreDisplacements = ignoreDisplacements;
|
|
230
|
+
return this;
|
|
231
|
+
}
|
|
232
|
+
ignoreCaret(ignoreCaret = true) {
|
|
233
|
+
this._settings.ignoreCaret = ignoreCaret;
|
|
234
|
+
return this;
|
|
235
|
+
}
|
|
236
|
+
useDom(useDom = true) {
|
|
237
|
+
this._settings.useDom = useDom;
|
|
238
|
+
return this;
|
|
239
|
+
}
|
|
240
|
+
sendDom(sendDom = true) {
|
|
241
|
+
this._settings.sendDom = sendDom;
|
|
242
|
+
return this;
|
|
243
|
+
}
|
|
244
|
+
pageId(pageId) {
|
|
245
|
+
this._settings.pageId = pageId;
|
|
246
|
+
return this;
|
|
247
|
+
}
|
|
248
|
+
variationGroupId(variationGroupId) {
|
|
249
|
+
this._settings.variationGroupId = variationGroupId;
|
|
250
|
+
return this;
|
|
251
|
+
}
|
|
252
|
+
/** @internal */
|
|
253
|
+
toObject() {
|
|
254
|
+
return this._settings;
|
|
255
|
+
}
|
|
256
|
+
/** @internal */
|
|
257
|
+
toString() {
|
|
258
|
+
return utils.general.toString(this);
|
|
259
|
+
}
|
|
260
|
+
/** @internal */
|
|
261
|
+
assumesMutability() {
|
|
262
|
+
// if this is a leaf of a linked list (i.e., has no children and all ancestors have exactly one child), them making the CheckSettings mutable is safe
|
|
263
|
+
if (this.childs.length)
|
|
264
|
+
return true;
|
|
265
|
+
for (let parent = this.parent; parent; parent = parent.parent) {
|
|
266
|
+
if (parent.childs.length !== 1)
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
return undefined;
|
|
270
|
+
}
|
|
271
|
+
static makeMutableTreeProxy(self, ctor) {
|
|
272
|
+
const shouldNotBeProxied = ['assumesMutability', 'childs', 'parent']; // these properties should not be proxied as they are used to determine if the tree is mutable
|
|
273
|
+
const shouldNotCreateChild = ['toObject', 'toJSON', 'toString']; // these properties should not create a child
|
|
274
|
+
return new Proxy(self, {
|
|
275
|
+
get(target, prop, receiver) {
|
|
276
|
+
if (shouldNotBeProxied.includes(String(prop)))
|
|
277
|
+
return Reflect.get(target, prop, receiver);
|
|
278
|
+
let rootTarget = target;
|
|
279
|
+
while (rootTarget.parent)
|
|
280
|
+
rootTarget = rootTarget.parent;
|
|
281
|
+
const origProp = Reflect.get(rootTarget, prop, receiver);
|
|
282
|
+
if (typeof origProp !== 'function')
|
|
283
|
+
return origProp;
|
|
284
|
+
if (shouldNotCreateChild.includes(String(prop)))
|
|
285
|
+
return origProp;
|
|
286
|
+
return function (...args) {
|
|
287
|
+
// @ts-ignore
|
|
288
|
+
const result = origProp.call(rootTarget, ...args);
|
|
289
|
+
if (result instanceof CheckSettingsBaseFluent) {
|
|
290
|
+
if (result instanceof CheckSettingsImageFluent || result instanceof CheckSettingsAutomationFluent) {
|
|
291
|
+
return new ctor(null, null, target);
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
// should not happen - the only known types to be proxied are CheckSettingsImageFluent and CheckSettingsAutomationFluent
|
|
295
|
+
throw new Error('Unknown CheckSettings type');
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return result;
|
|
299
|
+
};
|
|
300
|
+
},
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
// protected toCoreCodedRegion(region: CodedRegion<TRegion>): Core.CodedRegion<TRegion | utils.Region>
|
|
304
|
+
// protected toCoreCodedRegion(region: Region | LegacyRegion | TRegion): utils.Region | TRegion
|
|
305
|
+
toCoreCodedRegion(region) {
|
|
306
|
+
if (utils.types.has(region, ['region'])) {
|
|
307
|
+
return { ...region, region: this.toCoreRegion(region.region) };
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
return this.toCoreRegion(region);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
toCoreCodedFloatingRegion(region) {
|
|
314
|
+
if (utils.types.has(region, 'region')) {
|
|
315
|
+
const { maxUpOffset, maxDownOffset, maxLeftOffset, maxRightOffset, ...rest } = region;
|
|
316
|
+
return {
|
|
317
|
+
offset: { top: maxUpOffset, bottom: maxDownOffset, left: maxLeftOffset, right: maxRightOffset },
|
|
318
|
+
...this.toCoreCodedRegion(rest),
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
return this.toCoreRegion(region);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
toCoreRegion(region) {
|
|
326
|
+
if (utils.types.has(region, ['left', 'top', 'width', 'height'])) {
|
|
327
|
+
return { x: region.left, y: region.top, width: region.width, height: region.height };
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
return region;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
exports.CheckSettingsBaseFluent = CheckSettingsBaseFluent;
|
|
335
|
+
class CheckSettingsImageFluent extends CheckSettingsBaseFluent {
|
|
336
|
+
constructor(settings, target, parent) {
|
|
337
|
+
super(undefined, parent);
|
|
338
|
+
const self = CheckSettingsBaseFluent.makeMutableTreeProxy(this, CheckSettingsImageFluent);
|
|
339
|
+
this._target = null;
|
|
340
|
+
self._target = target !== null && target !== void 0 ? target : settings === null || settings === void 0 ? void 0 : settings._target;
|
|
341
|
+
self._settings = utils.types.instanceOf(settings, CheckSettingsImageFluent) ? settings.toObject() : settings !== null && settings !== void 0 ? settings : {};
|
|
342
|
+
if (settings instanceof CheckSettingsImageFluent) {
|
|
343
|
+
parent !== null && parent !== void 0 ? parent : (parent = settings.parent);
|
|
344
|
+
// copy constructor does not considered as a new child
|
|
345
|
+
parent === null || parent === void 0 ? void 0 : parent.childs.pop();
|
|
346
|
+
}
|
|
347
|
+
return self;
|
|
348
|
+
}
|
|
349
|
+
image(image) {
|
|
350
|
+
var _a;
|
|
351
|
+
(_a = this._target) !== null && _a !== void 0 ? _a : (this._target = {});
|
|
352
|
+
this._target.image = image;
|
|
353
|
+
return this;
|
|
354
|
+
}
|
|
355
|
+
buffer(imageBuffer) {
|
|
356
|
+
return this.image(imageBuffer);
|
|
357
|
+
}
|
|
358
|
+
base64(imageBase64) {
|
|
359
|
+
return this.image(imageBase64);
|
|
360
|
+
}
|
|
361
|
+
path(imagePath) {
|
|
362
|
+
return this.image(imagePath);
|
|
363
|
+
}
|
|
364
|
+
url(imageUrl) {
|
|
365
|
+
return this.image(imageUrl);
|
|
366
|
+
}
|
|
367
|
+
name(name) {
|
|
368
|
+
this._target.name = name;
|
|
369
|
+
return super.name(name);
|
|
370
|
+
}
|
|
371
|
+
withDom(dom) {
|
|
372
|
+
this._settings.sendDom = true;
|
|
373
|
+
this._target.dom = dom;
|
|
374
|
+
return this;
|
|
375
|
+
}
|
|
376
|
+
withLocation(locationInViewport) {
|
|
377
|
+
this._target.locationInViewport = locationInViewport;
|
|
378
|
+
return this;
|
|
379
|
+
}
|
|
380
|
+
/** @internal */
|
|
381
|
+
toJSON() {
|
|
382
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
383
|
+
return {
|
|
384
|
+
target: this._target,
|
|
385
|
+
settings: utils.general.removeUndefinedProps({
|
|
386
|
+
name: this._settings.name,
|
|
387
|
+
region: this._settings.region ? this.toCoreRegion(this._settings.region) : this._settings.region,
|
|
388
|
+
matchLevel: this._settings.matchLevel,
|
|
389
|
+
useDom: this._settings.useDom,
|
|
390
|
+
sendDom: this._settings.sendDom,
|
|
391
|
+
enablePatterns: this._settings.enablePatterns,
|
|
392
|
+
ignoreDisplacements: this._settings.ignoreDisplacements,
|
|
393
|
+
ignoreCaret: this._settings.ignoreCaret,
|
|
394
|
+
ignoreRegions: (_a = this._settings.ignoreRegions) === null || _a === void 0 ? void 0 : _a.map(this.toCoreCodedRegion),
|
|
395
|
+
layoutRegions: (_b = this._settings.layoutRegions) === null || _b === void 0 ? void 0 : _b.map(this.toCoreCodedRegion),
|
|
396
|
+
strictRegions: (_c = this._settings.strictRegions) === null || _c === void 0 ? void 0 : _c.map(this.toCoreCodedRegion),
|
|
397
|
+
contentRegions: (_d = this._settings.contentRegions) === null || _d === void 0 ? void 0 : _d.map(this.toCoreCodedRegion),
|
|
398
|
+
floatingRegions: (_e = this._settings.floatingRegions) === null || _e === void 0 ? void 0 : _e.map(this.toCoreCodedFloatingRegion),
|
|
399
|
+
accessibilityRegions: (_f = this._settings.accessibilityRegions) === null || _f === void 0 ? void 0 : _f.map(this.toCoreCodedRegion),
|
|
400
|
+
dynamicRegions: (_g = this._settings.dynamicRegions) === null || _g === void 0 ? void 0 : _g.map(this.toCoreCodedRegion),
|
|
401
|
+
pageId: this._settings.pageId,
|
|
402
|
+
userCommandId: this._settings.variationGroupId,
|
|
403
|
+
assumesMutability: this.assumesMutability(),
|
|
404
|
+
}),
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
exports.CheckSettingsImageFluent = CheckSettingsImageFluent;
|
|
409
|
+
class CheckSettingsAutomationFluent extends CheckSettingsBaseFluent {
|
|
410
|
+
_isElementReference(value) {
|
|
411
|
+
var _a, _b, _c;
|
|
412
|
+
const spec = (_a = this._spec) !== null && _a !== void 0 ? _a : this.constructor._spec;
|
|
413
|
+
return !!((_b = spec.isElement) === null || _b === void 0 ? void 0 : _b.call(spec, value)) || !!((_c = spec.isSecondaryElement) === null || _c === void 0 ? void 0 : _c.call(spec, value)) || this._isSelectorReference(value);
|
|
414
|
+
}
|
|
415
|
+
_isSelectorReference(selector) {
|
|
416
|
+
var _a, _b, _c, _d, _e;
|
|
417
|
+
const spec = (_a = this._spec) !== null && _a !== void 0 ? _a : this.constructor._spec;
|
|
418
|
+
return (!!((_b = spec.isSelector) === null || _b === void 0 ? void 0 : _b.call(spec, selector)) ||
|
|
419
|
+
!!((_c = spec.isSecondarySelector) === null || _c === void 0 ? void 0 : _c.call(spec, selector)) ||
|
|
420
|
+
utils.types.isString(selector) ||
|
|
421
|
+
(utils.types.isPlainObject(selector) &&
|
|
422
|
+
utils.types.has(selector, 'selector') &&
|
|
423
|
+
(utils.types.isString(selector.selector) ||
|
|
424
|
+
!!((_d = spec.isSelector) === null || _d === void 0 ? void 0 : _d.call(spec, selector.selector)) ||
|
|
425
|
+
!!((_e = spec.isSecondarySelector) === null || _e === void 0 ? void 0 : _e.call(spec, selector)))));
|
|
426
|
+
}
|
|
427
|
+
_isFrameReference(value) {
|
|
428
|
+
return utils.types.isNumber(value) || utils.types.isString(value) || this._isElementReference(value);
|
|
429
|
+
}
|
|
430
|
+
constructor(settings, spec, parent) {
|
|
431
|
+
super(undefined, parent !== null && parent !== void 0 ? parent : settings === null || settings === void 0 ? void 0 : settings.parent);
|
|
432
|
+
this._settings = null;
|
|
433
|
+
this._spec = null;
|
|
434
|
+
const self = CheckSettingsBaseFluent.makeMutableTreeProxy(this, (CheckSettingsAutomationFluent));
|
|
435
|
+
self._spec = spec;
|
|
436
|
+
self._settings = utils.types.instanceOf(settings, CheckSettingsAutomationFluent)
|
|
437
|
+
? settings.toObject()
|
|
438
|
+
: settings !== null && settings !== void 0 ? settings : {};
|
|
439
|
+
if (settings instanceof CheckSettingsAutomationFluent) {
|
|
440
|
+
parent !== null && parent !== void 0 ? parent : (parent = settings.parent);
|
|
441
|
+
// copy constructor does not considered as a new child
|
|
442
|
+
parent === null || parent === void 0 ? void 0 : parent.childs.pop();
|
|
443
|
+
}
|
|
444
|
+
return self;
|
|
445
|
+
}
|
|
446
|
+
region(region) {
|
|
447
|
+
if (this._isSelectorReference(region) &&
|
|
448
|
+
this._isSelectorReference(this._settings.region) &&
|
|
449
|
+
utils.types.has(this._settings.region, 'selector')) {
|
|
450
|
+
let lastSelector = this._settings.region;
|
|
451
|
+
while (lastSelector.shadow)
|
|
452
|
+
lastSelector = lastSelector.shadow;
|
|
453
|
+
lastSelector.shadow = region;
|
|
454
|
+
return this;
|
|
455
|
+
}
|
|
456
|
+
return super.region(region);
|
|
457
|
+
}
|
|
458
|
+
shadow(selector) {
|
|
459
|
+
selector = utils.types.has(selector, 'selector') ? selector : { selector };
|
|
460
|
+
if (!this._settings.region) {
|
|
461
|
+
this._settings.region = selector;
|
|
462
|
+
}
|
|
463
|
+
else if (this._isSelectorReference(this._settings.region)) {
|
|
464
|
+
let lastSelector;
|
|
465
|
+
if (utils.types.has(this._settings.region, 'selector')) {
|
|
466
|
+
lastSelector = this._settings.region;
|
|
467
|
+
while (lastSelector.shadow)
|
|
468
|
+
lastSelector = lastSelector.shadow;
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
lastSelector = { selector: this._settings.region };
|
|
472
|
+
}
|
|
473
|
+
lastSelector.shadow = selector;
|
|
474
|
+
}
|
|
475
|
+
return this;
|
|
476
|
+
}
|
|
477
|
+
frame(contextOrFrame, scrollRootElement) {
|
|
478
|
+
const context = this._isFrameReference(contextOrFrame) || this._isSelectorReference(contextOrFrame)
|
|
479
|
+
? { frame: contextOrFrame, scrollRootElement }
|
|
480
|
+
: contextOrFrame;
|
|
481
|
+
if (!this._settings.frames)
|
|
482
|
+
this._settings.frames = [];
|
|
483
|
+
this._settings.frames.push(context);
|
|
484
|
+
return this;
|
|
485
|
+
}
|
|
486
|
+
webview(webview) {
|
|
487
|
+
this._settings.webview = webview !== null && webview !== void 0 ? webview : true;
|
|
488
|
+
return this;
|
|
489
|
+
}
|
|
490
|
+
scrollRootElement(scrollRootElement) {
|
|
491
|
+
if (this._settings.frames && this._settings.frames.length > 0) {
|
|
492
|
+
const context = this._settings.frames[this._settings.frames.length - 1];
|
|
493
|
+
context.scrollRootElement = scrollRootElement;
|
|
494
|
+
}
|
|
495
|
+
this._settings.scrollRootElement = scrollRootElement;
|
|
496
|
+
return this;
|
|
497
|
+
}
|
|
498
|
+
fully(fully = true) {
|
|
499
|
+
this._settings.fully = fully;
|
|
500
|
+
return this;
|
|
501
|
+
}
|
|
502
|
+
/** @deprecated */
|
|
503
|
+
stitchContent(stitchContent = true) {
|
|
504
|
+
return this.fully(stitchContent);
|
|
505
|
+
}
|
|
506
|
+
disableBrowserFetching(disableBrowserFetching) {
|
|
507
|
+
this._settings.disableBrowserFetching = disableBrowserFetching;
|
|
508
|
+
return this;
|
|
509
|
+
}
|
|
510
|
+
layoutBreakpoints(breakpoints = true, settings) {
|
|
511
|
+
this._settings.layoutBreakpoints = {
|
|
512
|
+
breakpoints: utils.types.isArray(breakpoints)
|
|
513
|
+
? Array.from(new Set(breakpoints)).sort((a, b) => (a < b ? 1 : -1))
|
|
514
|
+
: breakpoints,
|
|
515
|
+
reload: settings === null || settings === void 0 ? void 0 : settings.reload,
|
|
516
|
+
};
|
|
517
|
+
return this;
|
|
518
|
+
}
|
|
519
|
+
hook(name, script) {
|
|
520
|
+
this._settings.hooks = { ...this._settings.hooks, [name]: script };
|
|
521
|
+
return this;
|
|
522
|
+
}
|
|
523
|
+
beforeRenderScreenshotHook(script) {
|
|
524
|
+
return this.hook('beforeCaptureScreenshot', script);
|
|
525
|
+
}
|
|
526
|
+
/** @deprecated */
|
|
527
|
+
webHook(script) {
|
|
528
|
+
return this.beforeRenderScreenshotHook(script);
|
|
529
|
+
}
|
|
530
|
+
ufgOption(key, value) {
|
|
531
|
+
this._settings.ufgOptions = { ...this._settings.ufgOptions, [key]: value };
|
|
532
|
+
return this;
|
|
533
|
+
}
|
|
534
|
+
ufgOptions(options) {
|
|
535
|
+
this._settings.ufgOptions = options;
|
|
536
|
+
return this;
|
|
537
|
+
}
|
|
538
|
+
/** @deprecated */
|
|
539
|
+
nmgOption(key, value) {
|
|
540
|
+
this._settings.nmgOptions = { ...this._settings.nmgOptions, [key]: value };
|
|
541
|
+
return this;
|
|
542
|
+
}
|
|
543
|
+
/** @deprecated */
|
|
544
|
+
nmgOptions(options) {
|
|
545
|
+
this._settings.nmgOptions = options;
|
|
546
|
+
return this;
|
|
547
|
+
}
|
|
548
|
+
/** @deprecated */
|
|
549
|
+
visualGridOption(key, value) {
|
|
550
|
+
return this.ufgOption(key, value);
|
|
551
|
+
}
|
|
552
|
+
/** @deprecated */
|
|
553
|
+
visualGridOptions(options) {
|
|
554
|
+
return this.ufgOptions(options);
|
|
555
|
+
}
|
|
556
|
+
useSystemScreenshot(useSystemScreenshot = true) {
|
|
557
|
+
this._settings.useSystemScreenshot = useSystemScreenshot;
|
|
558
|
+
return this;
|
|
559
|
+
}
|
|
560
|
+
timeout(timeout) {
|
|
561
|
+
this._settings.timeout = timeout;
|
|
562
|
+
return this;
|
|
563
|
+
}
|
|
564
|
+
waitBeforeCapture(waitBeforeCapture) {
|
|
565
|
+
this._settings.waitBeforeCapture = waitBeforeCapture;
|
|
566
|
+
return this;
|
|
567
|
+
}
|
|
568
|
+
lazyLoad(options) {
|
|
569
|
+
this._settings.lazyLoad = options !== null && options !== void 0 ? options : true;
|
|
570
|
+
return this;
|
|
571
|
+
}
|
|
572
|
+
densityMetrics(options) {
|
|
573
|
+
this._settings.densityMetrics = options;
|
|
574
|
+
return this;
|
|
575
|
+
}
|
|
576
|
+
stitchMode(stitchMode) {
|
|
577
|
+
this._settings.stitchMode = stitchMode;
|
|
578
|
+
return this;
|
|
579
|
+
}
|
|
580
|
+
/** @internal */
|
|
581
|
+
toJSON() {
|
|
582
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
583
|
+
return {
|
|
584
|
+
target: undefined,
|
|
585
|
+
settings: utils.general.removeUndefinedProps({
|
|
586
|
+
name: this._settings.name,
|
|
587
|
+
region: this._settings.region ? this.toCoreRegion(this._settings.region) : this._settings.region,
|
|
588
|
+
frames: this._settings.frames,
|
|
589
|
+
webview: this._settings.webview,
|
|
590
|
+
scrollRootElement: this._settings.scrollRootElement,
|
|
591
|
+
fully: this._settings.fully,
|
|
592
|
+
matchLevel: this._settings.matchLevel,
|
|
593
|
+
useDom: this._settings.useDom,
|
|
594
|
+
sendDom: this._settings.sendDom,
|
|
595
|
+
enablePatterns: this._settings.enablePatterns,
|
|
596
|
+
ignoreDisplacements: this._settings.ignoreDisplacements,
|
|
597
|
+
ignoreCaret: this._settings.ignoreCaret,
|
|
598
|
+
ignoreRegions: (_a = this._settings.ignoreRegions) === null || _a === void 0 ? void 0 : _a.map(this.toCoreCodedRegion),
|
|
599
|
+
layoutRegions: (_b = this._settings.layoutRegions) === null || _b === void 0 ? void 0 : _b.map(this.toCoreCodedRegion),
|
|
600
|
+
strictRegions: (_c = this._settings.strictRegions) === null || _c === void 0 ? void 0 : _c.map(this.toCoreCodedRegion),
|
|
601
|
+
contentRegions: (_d = this._settings.contentRegions) === null || _d === void 0 ? void 0 : _d.map(this.toCoreCodedRegion),
|
|
602
|
+
floatingRegions: (_e = this._settings.floatingRegions) === null || _e === void 0 ? void 0 : _e.map(this.toCoreCodedFloatingRegion),
|
|
603
|
+
accessibilityRegions: (_f = this._settings.accessibilityRegions) === null || _f === void 0 ? void 0 : _f.map(this.toCoreCodedRegion),
|
|
604
|
+
dynamicRegions: (_g = this._settings.dynamicRegions) === null || _g === void 0 ? void 0 : _g.map(this.toCoreCodedRegion),
|
|
605
|
+
disableBrowserFetching: this._settings.disableBrowserFetching,
|
|
606
|
+
layoutBreakpoints: utils.types.isDefined(this._settings.layoutBreakpoints)
|
|
607
|
+
? utils.types.has(this._settings.layoutBreakpoints, 'breakpoints')
|
|
608
|
+
? this._settings.layoutBreakpoints
|
|
609
|
+
: { breakpoints: (_h = this._settings.layoutBreakpoints) !== null && _h !== void 0 ? _h : false }
|
|
610
|
+
: undefined,
|
|
611
|
+
ufgOptions: (_j = this._settings.ufgOptions) !== null && _j !== void 0 ? _j : this._settings.visualGridOptions,
|
|
612
|
+
nmgOptions: this._settings.nmgOptions,
|
|
613
|
+
screenshotMode: this._settings.useSystemScreenshot ? 'default' : undefined,
|
|
614
|
+
hooks: this._settings.hooks,
|
|
615
|
+
pageId: this._settings.pageId,
|
|
616
|
+
lazyLoad: this._settings.lazyLoad,
|
|
617
|
+
waitBeforeCapture: this._settings.waitBeforeCapture,
|
|
618
|
+
retryTimeout: this._settings.timeout,
|
|
619
|
+
userCommandId: this._settings.variationGroupId,
|
|
620
|
+
densityMetrics: this._settings.densityMetrics,
|
|
621
|
+
assumesMutability: this.assumesMutability(),
|
|
622
|
+
stitchMode: this._settings.stitchMode,
|
|
623
|
+
}),
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
exports.CheckSettingsAutomationFluent = CheckSettingsAutomationFluent;
|
|
628
|
+
exports.TargetImage = {
|
|
629
|
+
image(image) {
|
|
630
|
+
return new CheckSettingsImageFluent().image(image);
|
|
631
|
+
},
|
|
632
|
+
buffer(imageBuffer) {
|
|
633
|
+
return new CheckSettingsImageFluent().image(imageBuffer);
|
|
634
|
+
},
|
|
635
|
+
base64(imageBase64) {
|
|
636
|
+
return new CheckSettingsImageFluent().image(imageBase64);
|
|
637
|
+
},
|
|
638
|
+
path(imagePath) {
|
|
639
|
+
return new CheckSettingsImageFluent().image(imagePath);
|
|
640
|
+
},
|
|
641
|
+
url(imageUrl) {
|
|
642
|
+
return new CheckSettingsImageFluent().image(imageUrl);
|
|
643
|
+
},
|
|
644
|
+
};
|
|
645
|
+
exports.TargetAutomation = {
|
|
646
|
+
spec: null,
|
|
647
|
+
window() {
|
|
648
|
+
return new CheckSettingsAutomationFluent({}, this.spec);
|
|
649
|
+
},
|
|
650
|
+
region(region) {
|
|
651
|
+
return new CheckSettingsAutomationFluent({}, this.spec).region(region);
|
|
652
|
+
},
|
|
653
|
+
frame(contextOrFrame, scrollRootElement) {
|
|
654
|
+
return new CheckSettingsAutomationFluent({}, this.spec).frame(contextOrFrame, scrollRootElement);
|
|
655
|
+
},
|
|
656
|
+
shadow(selector) {
|
|
657
|
+
return new CheckSettingsAutomationFluent({}, this.spec).shadow(selector);
|
|
658
|
+
},
|
|
659
|
+
webview(webview) {
|
|
660
|
+
return new CheckSettingsAutomationFluent({}, this.spec).webview(webview);
|
|
661
|
+
},
|
|
662
|
+
};
|
|
663
|
+
exports.Target = { ...exports.TargetImage, ...exports.TargetAutomation };
|