@applitools/eyes-testcafe 2.0.0-beta.8 → 2.0.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 +467 -0
- package/LICENSE +1 -1
- package/README.md +7 -531
- package/dist/api.js +51 -0
- package/dist/extract-environment.js +15 -0
- package/dist/index-legacy.js +5 -0
- package/dist/index.js +19 -0
- package/dist/legacy.js +225 -0
- package/dist/spec-driver.js +245 -0
- package/package.json +73 -76
- package/types/index-legacy.d.ts +2 -0
- package/types/index.d.ts +1833 -0
- package/dist/captureFrameAndPoll.js +0 -1468
- package/dist/captureFrameAndPollForIE.js +0 -12569
- package/index.js +0 -29
- package/lib/BordersAwareElementContentLocationProvider.js +0 -79
- package/lib/Eyes.js +0 -927
- package/lib/EyesFactory.js +0 -73
- package/lib/EyesTestCafe.js +0 -1270
- package/lib/EyesTestcafeUtils.js +0 -440
- package/lib/EyesVisualGrid.js +0 -345
- package/lib/ImageOrientationHandler.js +0 -31
- package/lib/JavascriptHandler.js +0 -20
- package/lib/TestCafeExecutor.js +0 -57
- package/lib/capture/EyesWebDriverScreenshot.js +0 -650
- package/lib/capture/EyesWebDriverScreenshotFactory.js +0 -32
- package/lib/capture/FirefoxScreenshotImageProvider.js +0 -63
- package/lib/capture/ImageProviderFactory.js +0 -38
- package/lib/capture/SafariScreenshotImageProvider.js +0 -254
- package/lib/capture/TakesScreenshotImageProvider.js +0 -35
- package/lib/errors/EyesDriverOperationError.js +0 -10
- package/lib/errors/NoFramesError.js +0 -7
- package/lib/fluent/AccessibilityRegionByElement.js +0 -46
- package/lib/fluent/AccessibilityRegionBySelector.js +0 -58
- package/lib/fluent/FloatingRegionByElement.js +0 -56
- package/lib/fluent/FloatingRegionBySelector.js +0 -63
- package/lib/fluent/FrameLocator.js +0 -110
- package/lib/fluent/IgnoreRegionByElement.js +0 -51
- package/lib/fluent/IgnoreRegionBySelector.js +0 -57
- package/lib/fluent/SelectorByElement.js +0 -37
- package/lib/fluent/SelectorByLocator.js +0 -47
- package/lib/fluent/Target.js +0 -17
- package/lib/fluent/TestcafeCheckSettings.js +0 -352
- package/lib/frames/Frame.js +0 -149
- package/lib/frames/FrameChain.js +0 -175
- package/lib/getCaptureDomScript.js +0 -14
- package/lib/hash.js +0 -15
- package/lib/isTestcafeSelector.js +0 -7
- package/lib/makeClientFunctionWrapper.js +0 -61
- package/lib/positioning/CssTranslatePositionMemento.js +0 -39
- package/lib/positioning/CssTranslatePositionProvider.js +0 -130
- package/lib/positioning/ElementPositionMemento.js +0 -36
- package/lib/positioning/ElementPositionProvider.js +0 -88
- package/lib/positioning/FirefoxRegionPositionCompensation.js +0 -45
- package/lib/positioning/ImageRotation.js +0 -22
- package/lib/positioning/OverflowAwareCssTranslatePositionProvider.js +0 -17
- package/lib/positioning/OverflowAwareScrollPositionProvider.js +0 -17
- package/lib/positioning/RegionPositionCompensationFactory.js +0 -37
- package/lib/positioning/SafariRegionPositionCompensation.js +0 -26
- package/lib/positioning/ScrollPositionMemento.js +0 -36
- package/lib/positioning/ScrollPositionProvider.js +0 -118
- package/lib/positioning/fixImageMarkPosition.js +0 -36
- package/lib/regionVisibility/MoveToRegionVisibilityStrategy.js +0 -55
- package/lib/regionVisibility/NopRegionVisibilityStrategy.js +0 -35
- package/lib/regionVisibility/RegionVisibilityStrategy.js +0 -30
- package/lib/runner/ClassicRunner.js +0 -31
- package/lib/runner/EyesRunner.js +0 -41
- package/lib/runner/TestResultContainer.js +0 -38
- package/lib/runner/TestResultsSummary.js +0 -112
- package/lib/runner/VisualGridRunner.js +0 -57
- package/lib/safeExecuteFunction.js +0 -28
- package/lib/wrappers/EyesTargetLocator.js +0 -329
- package/lib/wrappers/EyesWebDriver.js +0 -560
- package/lib/wrappers/EyesWebElement.js +0 -383
- package/lib/wrappers/EyesWebElementPromise.js +0 -68
package/lib/Eyes.js
DELETED
|
@@ -1,927 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const {URL} = require('url')
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
Logger,
|
|
7
|
-
ReadOnlyPropertyHandler,
|
|
8
|
-
Region,
|
|
9
|
-
Location,
|
|
10
|
-
RectangleSize,
|
|
11
|
-
ArgumentGuard,
|
|
12
|
-
Configuration,
|
|
13
|
-
} = require('@applitools/eyes-common')
|
|
14
|
-
|
|
15
|
-
const {EyesBase, TestFailedError, CorsIframeHandle} = require('@applitools/eyes-sdk-core')
|
|
16
|
-
|
|
17
|
-
const {ClassicRunner} = require('./runner/ClassicRunner')
|
|
18
|
-
const {FrameChain} = require('./frames/FrameChain')
|
|
19
|
-
const {EyesTestcafeUtils} = require('./EyesTestcafeUtils')
|
|
20
|
-
const {ImageRotation} = require('./positioning/ImageRotation')
|
|
21
|
-
|
|
22
|
-
const {
|
|
23
|
-
MoveToRegionVisibilityStrategy,
|
|
24
|
-
} = require('./regionVisibility/MoveToRegionVisibilityStrategy')
|
|
25
|
-
const {NopRegionVisibilityStrategy} = require('./regionVisibility/NopRegionVisibilityStrategy')
|
|
26
|
-
const {JavascriptHandler} = require('./JavascriptHandler')
|
|
27
|
-
const {EyesWebDriver} = require('./wrappers/EyesWebDriver')
|
|
28
|
-
const {Target} = require('./fluent/Target')
|
|
29
|
-
const {TestCafeExecutor} = require('./TestCafeExecutor')
|
|
30
|
-
|
|
31
|
-
const VERSION = require('../package.json').version
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* The main API gateway for the SDK.
|
|
35
|
-
*
|
|
36
|
-
* @abstract
|
|
37
|
-
*/
|
|
38
|
-
class Eyes extends EyesBase {
|
|
39
|
-
/** @var {Logger} Eyes#_logger */
|
|
40
|
-
/** @var {Configuration} Eyes#_configuration */
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Creates a new (possibly disabled) Eyes instance that interacts with the Eyes Server at the specified url.
|
|
44
|
-
*
|
|
45
|
-
* @signature `new Eyes()`
|
|
46
|
-
*
|
|
47
|
-
* @signature `new Eyes(runner)`
|
|
48
|
-
* @sigparam {EyesRunner} [runner] - Set {@code EyesRunner} to use, default is ClassicRunner.
|
|
49
|
-
*
|
|
50
|
-
* @signature `new Eyes(serverUrl, isDisabled, runner)`
|
|
51
|
-
* @sigparam {string} [serverUrl] - The Eyes server URL.
|
|
52
|
-
* @sigparam {boolean} [isDisabled=false] - Set {@code true} to disable Applitools Eyes and use the WebDriver directly.
|
|
53
|
-
* @sigparam {EyesRunner} [runner=false] - Set {@code EyesRunner} to use, default is ClassicRunner.
|
|
54
|
-
*
|
|
55
|
-
* @param {string|boolean|EyesRunner} [serverUrl] - The Eyes server URL or set {@code true} if you want to use VisualGrid service.
|
|
56
|
-
* @param {boolean} [isDisabled=false] - Set {@code true} to disable Applitools Eyes and use the webdriver directly.
|
|
57
|
-
* @param {EyesRunner} [runner=false] - Set {@code EyesRunner} to use, default is ClassicRunner.
|
|
58
|
-
*/
|
|
59
|
-
constructor(serverUrl, isDisabled, runner = new ClassicRunner()) {
|
|
60
|
-
if (new.target === Eyes) {
|
|
61
|
-
throw new TypeError(
|
|
62
|
-
'Cannot construct `Eyes` instances directly. ' +
|
|
63
|
-
'Please use `EyesTestcafe`, `EyesVisualGrid` or `EyesFactory` instead.',
|
|
64
|
-
)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
super(serverUrl, isDisabled, new Configuration())
|
|
68
|
-
|
|
69
|
-
/** @type {EyesRunner} */ this._runner = runner
|
|
70
|
-
this._runner._eyesInstances.push(this)
|
|
71
|
-
|
|
72
|
-
/** @type {EyesWebDriver} */
|
|
73
|
-
this._driver = undefined
|
|
74
|
-
/** @type {TestCafeExecutor} */
|
|
75
|
-
this._jsExecutor = undefined
|
|
76
|
-
|
|
77
|
-
/** @type {string} */
|
|
78
|
-
this._domUrl = undefined
|
|
79
|
-
/** @type {Region} */
|
|
80
|
-
this._regionToCheck = undefined
|
|
81
|
-
/** @type {WebElement} */
|
|
82
|
-
this._scrollRootElement = undefined
|
|
83
|
-
/** @type {ImageRotation} */
|
|
84
|
-
this._rotation = undefined
|
|
85
|
-
/** @type {number} */
|
|
86
|
-
this._devicePixelRatio = Eyes.UNKNOWN_DEVICE_PIXEL_RATIO
|
|
87
|
-
/** @type {RegionVisibilityStrategy} */
|
|
88
|
-
this._regionVisibilityStrategy = new MoveToRegionVisibilityStrategy(this._logger)
|
|
89
|
-
/** @type {ElementPositionProvider} */
|
|
90
|
-
this._elementPositionProvider = undefined
|
|
91
|
-
/** @type {boolean} */
|
|
92
|
-
this._stitchContent = false
|
|
93
|
-
/** @type {boolean} */
|
|
94
|
-
this._dontGetTitle = false
|
|
95
|
-
/** @type {CorsIframeHandle} */
|
|
96
|
-
this._corsIframeHandle = CorsIframeHandle.KEEP
|
|
97
|
-
|
|
98
|
-
EyesTestcafeUtils.setJavascriptHandler(new JavascriptHandler())
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* @return {Configuration}
|
|
103
|
-
*/
|
|
104
|
-
getConfiguration() {
|
|
105
|
-
return this._configuration.cloneConfig()
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* @override
|
|
110
|
-
* @param {Configuration|object} configuration
|
|
111
|
-
*/
|
|
112
|
-
setConfiguration(configuration) {
|
|
113
|
-
if (!(configuration instanceof Configuration)) {
|
|
114
|
-
configuration = new Configuration(configuration)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
this._configuration = configuration
|
|
118
|
-
this._serverConnector._configuration = this._configuration
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// noinspection JSMethodCanBeStatic
|
|
122
|
-
/**
|
|
123
|
-
* @override
|
|
124
|
-
* @protected
|
|
125
|
-
* @return {string} - The base agent id of the SDK.
|
|
126
|
-
*/
|
|
127
|
-
getBaseAgentId() {
|
|
128
|
-
return `eyes-testcafe-classic/${VERSION}`
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// noinspection JSMethodCanBeStatic
|
|
132
|
-
/**
|
|
133
|
-
* Starts a test.
|
|
134
|
-
*
|
|
135
|
-
* @abstract
|
|
136
|
-
* @param {WebDriver} driver - The web driver that controls the browser hosting the application under test.
|
|
137
|
-
* @param {string} [appName] - The of the application under the test.
|
|
138
|
-
* @param {string} [testName] - The test name.
|
|
139
|
-
* @param {RectangleSize|RectangleSizeObject} [viewportSize] - The required browser's viewport size (i.e., the visible part of the document's body) or to use the current window's viewport.
|
|
140
|
-
* @param {SessionType} [sessionType] - The type of test (e.g., standard test / visual performance test).
|
|
141
|
-
* @return {Promise<EyesWebDriver>} - A wrapped WebDriver which enables Eyes trigger recording and frame handling.
|
|
142
|
-
*/
|
|
143
|
-
async open(_driver, _appName, _testName, _viewportSize, _sessionType) {
|
|
144
|
-
// eslint-disable-line no-unused-vars
|
|
145
|
-
throw new TypeError('The method is not implemented!')
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* @protected
|
|
150
|
-
*/
|
|
151
|
-
_initDriver(driver) {
|
|
152
|
-
if (driver instanceof EyesWebDriver) {
|
|
153
|
-
// noinspection JSValidateTypes
|
|
154
|
-
this._driver = driver
|
|
155
|
-
} else {
|
|
156
|
-
this._driver = new EyesWebDriver(this._logger, this, driver)
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
this._jsExecutor = new TestCafeExecutor(this._driver._driver)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// noinspection JSMethodCanBeStatic
|
|
163
|
-
/**
|
|
164
|
-
* Perform visual validation
|
|
165
|
-
*
|
|
166
|
-
* @abstract
|
|
167
|
-
* @param {string} name - A name to be associated with the match
|
|
168
|
-
* @param {TestcafeCheckSettings} checkSettings - Target instance which describes whether we want a window/region/frame
|
|
169
|
-
* @return {Promise<MatchResult>} - A promise which is resolved when the validation is finished.
|
|
170
|
-
*/
|
|
171
|
-
async check(_name, _checkSettings) {
|
|
172
|
-
// eslint-disable-line no-unused-vars
|
|
173
|
-
throw new TypeError('The method is not implemented!')
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// noinspection JSUnusedGlobalSymbols
|
|
177
|
-
/**
|
|
178
|
-
* Takes a snapshot of the application under test and matches it with the expected output.
|
|
179
|
-
*
|
|
180
|
-
* @param {string} [tag] - An optional tag to be associated with the snapshot.
|
|
181
|
-
* @param {number} [matchTimeout] - The amount of time to retry matching (Milliseconds).
|
|
182
|
-
* @return {Promise<MatchResult>} - A promise which is resolved when the validation is finished.
|
|
183
|
-
*/
|
|
184
|
-
async checkWindow(tag, matchTimeout) {
|
|
185
|
-
return this.check(tag, Target.window().timeout(matchTimeout))
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// noinspection JSUnusedGlobalSymbols
|
|
189
|
-
/**
|
|
190
|
-
* Matches the frame given as parameter, by switching into the frame and using stitching to get an image of the frame.
|
|
191
|
-
*
|
|
192
|
-
* @param {number|string|By|WebElement|EyesWebElement} element - The element which is the frame to switch to.
|
|
193
|
-
* @param {number} [matchTimeout] - The amount of time to retry matching (milliseconds).
|
|
194
|
-
* @param {string} [tag] - An optional tag to be associated with the match.
|
|
195
|
-
* @return {Promise<MatchResult>} - A promise which is resolved when the validation is finished.
|
|
196
|
-
*/
|
|
197
|
-
async checkFrame(element, matchTimeout, tag) {
|
|
198
|
-
return this.check(
|
|
199
|
-
tag,
|
|
200
|
-
Target.frame(element)
|
|
201
|
-
.timeout(matchTimeout)
|
|
202
|
-
.fully(),
|
|
203
|
-
)
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
// noinspection JSUnusedGlobalSymbols
|
|
207
|
-
/**
|
|
208
|
-
* Takes a snapshot of the application under test and matches a specific element with the expected region output.
|
|
209
|
-
*
|
|
210
|
-
* @param {WebElement|EyesWebElement} element - The element to check.
|
|
211
|
-
* @param {?number} [matchTimeout] - The amount of time to retry matching (milliseconds).
|
|
212
|
-
* @param {string} [tag] - An optional tag to be associated with the match.
|
|
213
|
-
* @return {Promise<MatchResult>} - A promise which is resolved when the validation is finished.
|
|
214
|
-
*/
|
|
215
|
-
async checkElement(element, matchTimeout, tag) {
|
|
216
|
-
return this.check(
|
|
217
|
-
tag,
|
|
218
|
-
Target.region(element)
|
|
219
|
-
.timeout(matchTimeout)
|
|
220
|
-
.fully(),
|
|
221
|
-
)
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// noinspection JSUnusedGlobalSymbols
|
|
225
|
-
/**
|
|
226
|
-
* Takes a snapshot of the application under test and matches a specific element with the expected region output.
|
|
227
|
-
*
|
|
228
|
-
* @param {By} locator - The element to check.
|
|
229
|
-
* @param {?number} [matchTimeout] - The amount of time to retry matching (milliseconds).
|
|
230
|
-
* @param {string} [tag] - An optional tag to be associated with the match.
|
|
231
|
-
* @return {Promise<MatchResult>} - A promise which is resolved when the validation is finished.
|
|
232
|
-
*/
|
|
233
|
-
async checkElementBy(locator, matchTimeout, tag) {
|
|
234
|
-
return this.check(
|
|
235
|
-
tag,
|
|
236
|
-
Target.region(locator)
|
|
237
|
-
.timeout(matchTimeout)
|
|
238
|
-
.fully(),
|
|
239
|
-
)
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// noinspection JSUnusedGlobalSymbols
|
|
243
|
-
/**
|
|
244
|
-
* Visually validates a region in the screenshot.
|
|
245
|
-
*
|
|
246
|
-
* @param {Region} region - The region to validate (in screenshot coordinates).
|
|
247
|
-
* @param {string} [tag] - An optional tag to be associated with the screenshot.
|
|
248
|
-
* @param {number} [matchTimeout] - The amount of time to retry matching.
|
|
249
|
-
* @return {Promise<MatchResult>} - A promise which is resolved when the validation is finished.
|
|
250
|
-
*/
|
|
251
|
-
async checkRegion(region, tag, matchTimeout) {
|
|
252
|
-
return this.check(tag, Target.region(region).timeout(matchTimeout))
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// noinspection JSUnusedGlobalSymbols
|
|
256
|
-
/**
|
|
257
|
-
* Visually validates a region in the screenshot.
|
|
258
|
-
*
|
|
259
|
-
* @param {WebElement|EyesWebElement} element - The element defining the region to validate.
|
|
260
|
-
* @param {string} [tag] - An optional tag to be associated with the screenshot.
|
|
261
|
-
* @param {number} [matchTimeout] - The amount of time to retry matching.
|
|
262
|
-
* @return {Promise<MatchResult>} - A promise which is resolved when the validation is finished.
|
|
263
|
-
*/
|
|
264
|
-
async checkRegionByElement(element, tag, matchTimeout) {
|
|
265
|
-
return this.check(tag, Target.region(element).timeout(matchTimeout))
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// noinspection JSUnusedGlobalSymbols
|
|
269
|
-
/**
|
|
270
|
-
* Visually validates a region in the screenshot.
|
|
271
|
-
*
|
|
272
|
-
* @param {By} by - The WebDriver selector used for finding the region to validate.
|
|
273
|
-
* @param {string} [tag] - An optional tag to be associated with the screenshot.
|
|
274
|
-
* @param {number} [matchTimeout] - The amount of time to retry matching.
|
|
275
|
-
* @param {boolean} [stitchContent] - If {@code true}, stitch the internal content of the region (i.e., perform
|
|
276
|
-
* {@link #checkElement(By, number, string)} on the region.
|
|
277
|
-
* @return {Promise<MatchResult>} - A promise which is resolved when the validation is finished.
|
|
278
|
-
*/
|
|
279
|
-
async checkRegionBy(by, tag, matchTimeout, stitchContent = false) {
|
|
280
|
-
return this.check(
|
|
281
|
-
tag,
|
|
282
|
-
Target.region(by)
|
|
283
|
-
.timeout(matchTimeout)
|
|
284
|
-
.stitchContent(stitchContent),
|
|
285
|
-
)
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// noinspection JSUnusedGlobalSymbols
|
|
289
|
-
/**
|
|
290
|
-
* Switches into the given frame, takes a snapshot of the application under test and matches a region specified by
|
|
291
|
-
* the given selector.
|
|
292
|
-
*
|
|
293
|
-
* @param {string} frameNameOrId - The name or id of the frame to switch to. (as would be used in a call to
|
|
294
|
-
* driver.switchTo().frame()).
|
|
295
|
-
* @param {By} locator - A Selector specifying the region to check.
|
|
296
|
-
* @param {?number} [matchTimeout] - The amount of time to retry matching. (Milliseconds)
|
|
297
|
-
* @param {string} [tag] - An optional tag to be associated with the snapshot.
|
|
298
|
-
* @param {boolean} [stitchContent] - If {@code true}, stitch the internal content of the region (i.e., perform
|
|
299
|
-
* {@link #checkElement(By, number, string)} on the region.
|
|
300
|
-
* @return {Promise<MatchResult>} - A promise which is resolved when the validation is finished.
|
|
301
|
-
*/
|
|
302
|
-
async checkRegionInFrame(frameNameOrId, locator, matchTimeout, tag, stitchContent = false) {
|
|
303
|
-
return this.check(
|
|
304
|
-
tag,
|
|
305
|
-
Target.region(locator, frameNameOrId)
|
|
306
|
-
.timeout(matchTimeout)
|
|
307
|
-
.stitchContent(stitchContent),
|
|
308
|
-
)
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// noinspection JSUnusedGlobalSymbols
|
|
312
|
-
/**
|
|
313
|
-
* Adds a mouse trigger.
|
|
314
|
-
*
|
|
315
|
-
* @param {MouseTrigger.MouseAction} action - Mouse action.
|
|
316
|
-
* @param {Region} control - The control on which the trigger is activated (context relative coordinates).
|
|
317
|
-
* @param {Location} cursor - The cursor's position relative to the control.
|
|
318
|
-
*/
|
|
319
|
-
addMouseTrigger(action, control, cursor) {
|
|
320
|
-
if (this.getIsDisabled()) {
|
|
321
|
-
this._logger.verbose(`Ignoring ${action} (disabled)`)
|
|
322
|
-
return
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
// Triggers are actually performed on the previous window.
|
|
326
|
-
if (!this._lastScreenshot) {
|
|
327
|
-
this._logger.verbose(`Ignoring ${action} (no screenshot)`)
|
|
328
|
-
return
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
if (
|
|
332
|
-
!FrameChain.isSameFrameChain(
|
|
333
|
-
this._driver.getFrameChain(),
|
|
334
|
-
this._lastScreenshot.getFrameChain(),
|
|
335
|
-
)
|
|
336
|
-
) {
|
|
337
|
-
this._logger.verbose(`Ignoring ${action} (different frame)`)
|
|
338
|
-
return
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
this.addMouseTriggerBase(action, control, cursor)
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// noinspection JSUnusedGlobalSymbols
|
|
345
|
-
/**
|
|
346
|
-
* Adds a mouse trigger.
|
|
347
|
-
*
|
|
348
|
-
* @param {MouseTrigger.MouseAction} action - Mouse action.
|
|
349
|
-
* @param {EyesWebElement} element - The WebElement on which the click was called.
|
|
350
|
-
* @return {Promise}
|
|
351
|
-
*/
|
|
352
|
-
async addMouseTriggerForElement(action, element) {
|
|
353
|
-
if (this.getIsDisabled()) {
|
|
354
|
-
this._logger.verbose(`Ignoring ${action} (disabled)`)
|
|
355
|
-
return
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
// Triggers are actually performed on the previous window.
|
|
359
|
-
if (!this._lastScreenshot) {
|
|
360
|
-
this._logger.verbose(`Ignoring ${action} (no screenshot)`)
|
|
361
|
-
return
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
if (
|
|
365
|
-
!FrameChain.isSameFrameChain(
|
|
366
|
-
this._driver.getFrameChain(),
|
|
367
|
-
this._lastScreenshot.getFrameChain(),
|
|
368
|
-
)
|
|
369
|
-
) {
|
|
370
|
-
this._logger.verbose(`Ignoring ${action} (different frame)`)
|
|
371
|
-
return
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
ArgumentGuard.notNull(element, 'element')
|
|
375
|
-
|
|
376
|
-
const rect = await element.getRect()
|
|
377
|
-
const elementRegion = new Region(rect.x, rect.y, rect.width, rect.height)
|
|
378
|
-
|
|
379
|
-
this.addMouseTriggerBase(action, elementRegion, elementRegion.getMiddleOffset())
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Adds a keyboard trigger.
|
|
384
|
-
*
|
|
385
|
-
* @param {Region} control - The control on which the trigger is activated (context relative coordinates).
|
|
386
|
-
* @param {string} text - The trigger's text.
|
|
387
|
-
*/
|
|
388
|
-
addTextTrigger(control, text) {
|
|
389
|
-
if (this.getIsDisabled()) {
|
|
390
|
-
this._logger.verbose(`Ignoring ${text} (disabled)`)
|
|
391
|
-
return
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
// Triggers are actually performed on the previous window.
|
|
395
|
-
if (!this._lastScreenshot) {
|
|
396
|
-
this._logger.verbose(`Ignoring ${text} (no screenshot)`)
|
|
397
|
-
return
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
if (
|
|
401
|
-
!FrameChain.isSameFrameChain(
|
|
402
|
-
this._driver.getFrameChain(),
|
|
403
|
-
this._lastScreenshot.getFrameChain(),
|
|
404
|
-
)
|
|
405
|
-
) {
|
|
406
|
-
this._logger.verbose(`Ignoring ${text} (different frame)`)
|
|
407
|
-
return
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
this.addTextTriggerBase(control, text)
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* Adds a keyboard trigger.
|
|
415
|
-
*
|
|
416
|
-
* @param {EyesWebElement} element - The element for which we sent keys.
|
|
417
|
-
* @param {string} text - The trigger's text.
|
|
418
|
-
* @return {Promise}
|
|
419
|
-
*/
|
|
420
|
-
async addTextTriggerForElement(element, text) {
|
|
421
|
-
if (this.getIsDisabled()) {
|
|
422
|
-
this._logger.verbose(`Ignoring ${text} (disabled)`)
|
|
423
|
-
return
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
// Triggers are actually performed on the previous window.
|
|
427
|
-
if (!this._lastScreenshot) {
|
|
428
|
-
this._logger.verbose(`Ignoring ${text} (no screenshot)`)
|
|
429
|
-
return
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
if (
|
|
433
|
-
!FrameChain.isSameFrameChain(
|
|
434
|
-
this._driver.getFrameChain(),
|
|
435
|
-
this._lastScreenshot.getFrameChain(),
|
|
436
|
-
)
|
|
437
|
-
) {
|
|
438
|
-
this._logger.verbose(`Ignoring ${text} (different frame)`)
|
|
439
|
-
return
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
ArgumentGuard.notNull(element, 'element')
|
|
443
|
-
|
|
444
|
-
const rect = element.getRect()
|
|
445
|
-
// noinspection JSSuspiciousNameCombination
|
|
446
|
-
const elementRegion = new Region(Math.ceil(rect.x), Math.ceil(rect.y), rect.width, rect.height)
|
|
447
|
-
|
|
448
|
-
this.addTextTrigger(elementRegion, text)
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
// noinspection JSMethodCanBeStatic,JSUnusedGlobalSymbols
|
|
452
|
-
/**
|
|
453
|
-
* @return {Promise}
|
|
454
|
-
*/
|
|
455
|
-
async closeAsync() {
|
|
456
|
-
await this.close(false)
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
// noinspection JSMethodCanBeStatic,JSUnusedGlobalSymbols
|
|
460
|
-
/**
|
|
461
|
-
* @return {Promise}
|
|
462
|
-
*/
|
|
463
|
-
async abortAsync() {
|
|
464
|
-
await this.abort()
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
* @return {Promise<RectangleSize>} - The viewport size of the AUT.
|
|
469
|
-
*/
|
|
470
|
-
async getViewportSize() {
|
|
471
|
-
return this._configuration.getViewportSize()
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
// noinspection JSUnusedGlobalSymbols
|
|
475
|
-
/**
|
|
476
|
-
* Use this method only if you made a previous call to {@link #open(WebDriver, string, string)}.
|
|
477
|
-
*
|
|
478
|
-
* @override
|
|
479
|
-
* @protected
|
|
480
|
-
* @param {RectangleSize} size - The required viewport size.
|
|
481
|
-
* @return {Promise}
|
|
482
|
-
*/
|
|
483
|
-
async setViewportSize(size) {
|
|
484
|
-
if (this._viewportSizeHandler instanceof ReadOnlyPropertyHandler) {
|
|
485
|
-
this._logger.verbose('Ignored (viewport size given explicitly)')
|
|
486
|
-
return
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
ArgumentGuard.notNull(size, 'size')
|
|
490
|
-
size = new RectangleSize(size)
|
|
491
|
-
this._configuration.setViewportSize(size)
|
|
492
|
-
|
|
493
|
-
if (this._driver) {
|
|
494
|
-
const originalFrame = this._driver.getFrameChain()
|
|
495
|
-
await this._driver.switchTo().defaultContent()
|
|
496
|
-
|
|
497
|
-
try {
|
|
498
|
-
await EyesTestcafeUtils.setViewportSize(this._logger, this._driver, size)
|
|
499
|
-
this._effectiveViewport = new Region(Location.ZERO, size)
|
|
500
|
-
} catch (err) {
|
|
501
|
-
this._logger.verbose('Failed to set viewport size', err)
|
|
502
|
-
await this._driver.switchTo().frames(originalFrame) // Just in case the user catches that error
|
|
503
|
-
throw new TestFailedError('Failed to set the viewport size', err)
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
await this._driver.switchTo().frames(originalFrame)
|
|
507
|
-
this._viewportSizeHandler.set(new RectangleSize(size))
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
// noinspection JSUnusedGlobalSymbols, JSCheckFunctionSignatures
|
|
512
|
-
/**
|
|
513
|
-
* Call this method if for some reason you don't want to call {@link #open(WebDriver, string, string)} (or one of its
|
|
514
|
-
* variants) yet.
|
|
515
|
-
*
|
|
516
|
-
* @param {EyesWebDriver} driver - The driver to use for getting the viewport.
|
|
517
|
-
* @return {Promise<RectangleSize>} - The viewport size of the current context.
|
|
518
|
-
*/
|
|
519
|
-
static async getViewportSize(driver) {
|
|
520
|
-
ArgumentGuard.notNull(driver, 'driver')
|
|
521
|
-
return EyesTestcafeUtils.getViewportSizeOrDisplaySize(new Logger(), driver)
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
// noinspection JSUnusedGlobalSymbols, JSCheckFunctionSignatures
|
|
525
|
-
/**
|
|
526
|
-
* Set the viewport size using the driver. Call this method if for some reason you don't want to call
|
|
527
|
-
* {@link #open(WebDriver, string, string)} (or one of its variants) yet.
|
|
528
|
-
*
|
|
529
|
-
* @param {EyesWebDriver} driver - The driver to use for setting the viewport.
|
|
530
|
-
* @param {RectangleSize} viewportSize - The required viewport size.
|
|
531
|
-
* @return {Promise}
|
|
532
|
-
*/
|
|
533
|
-
static async setViewportSize(driver, viewportSize) {
|
|
534
|
-
ArgumentGuard.notNull(driver, 'driver')
|
|
535
|
-
ArgumentGuard.notNull(viewportSize, 'viewportSize')
|
|
536
|
-
|
|
537
|
-
await EyesTestcafeUtils.setViewportSize(new Logger(), driver, new RectangleSize(viewportSize))
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
// noinspection JSUnusedGlobalSymbols
|
|
541
|
-
/**
|
|
542
|
-
* @return {number} - The device pixel ratio, or {@link Eyes.UNKNOWN_DEVICE_PIXEL_RATIO} if the DPR is not known yet or if
|
|
543
|
-
* it wasn't possible to extract it.
|
|
544
|
-
*/
|
|
545
|
-
getDevicePixelRatio() {
|
|
546
|
-
return this._devicePixelRatio
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
/**
|
|
550
|
-
* The inferred string is in the format "source:info" where source is either "useragent" or "pos".
|
|
551
|
-
* Information associated with a "useragent" source is a valid browser user agent string. Information associated with
|
|
552
|
-
* a "pos" source is a string of the format "process-name;os-name" where "process-name" is the name of the main
|
|
553
|
-
* module of the executed process and "os-name" is the OS name.
|
|
554
|
-
*
|
|
555
|
-
* @override
|
|
556
|
-
* @protected
|
|
557
|
-
* @return {Promise<string>} - The inferred environment string or {@code null} if none is available.
|
|
558
|
-
*/
|
|
559
|
-
async getInferredEnvironment() {
|
|
560
|
-
try {
|
|
561
|
-
const userAgent = await this._driver.getUserAgent()
|
|
562
|
-
return `useragent:${userAgent}`
|
|
563
|
-
} catch (ignored) {
|
|
564
|
-
return undefined
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
* An updated screenshot.
|
|
570
|
-
*
|
|
571
|
-
* @override
|
|
572
|
-
* @protected
|
|
573
|
-
* @return {Promise<EyesScreenshot>}
|
|
574
|
-
*/
|
|
575
|
-
async getScreenshot() {
|
|
576
|
-
return undefined
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
/**
|
|
580
|
-
* The current title of of the AUT.
|
|
581
|
-
*
|
|
582
|
-
* @override
|
|
583
|
-
* @protected
|
|
584
|
-
* @return {Promise<string>}
|
|
585
|
-
*/
|
|
586
|
-
async getTitle() {
|
|
587
|
-
if (!this._dontGetTitle) {
|
|
588
|
-
try {
|
|
589
|
-
return await this._driver.getTitle()
|
|
590
|
-
} catch (err) {
|
|
591
|
-
this._logger.verbose(`failed (${JSON.stringify(err)})`)
|
|
592
|
-
this._dontGetTitle = true
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
return ''
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
/**
|
|
600
|
-
* @override
|
|
601
|
-
* @protected
|
|
602
|
-
* @return {Promise<?string>}
|
|
603
|
-
*/
|
|
604
|
-
async getOrigin() {
|
|
605
|
-
const currentUrl = await this.getDriver().getCurrentUrl()
|
|
606
|
-
return new URL(currentUrl).origin
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
// noinspection JSUnusedGlobalSymbols
|
|
610
|
-
/**
|
|
611
|
-
* Get the session id.
|
|
612
|
-
* @return {Promise<string>} - A promise which resolves to the webdriver's session ID.
|
|
613
|
-
*/
|
|
614
|
-
async getAUTSessionId() {
|
|
615
|
-
if (!this._driver) {
|
|
616
|
-
return undefined
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
return this._driver.getSessionId()
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
/* ------------ Getters/Setters ------------ */
|
|
623
|
-
|
|
624
|
-
/**
|
|
625
|
-
* @return {?EyesWebDriver}
|
|
626
|
-
*/
|
|
627
|
-
getDriver() {
|
|
628
|
-
return this._driver
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* @return {EyesRunner}
|
|
633
|
-
*/
|
|
634
|
-
getRunner() {
|
|
635
|
-
return this._runner
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
// noinspection JSUnusedGlobalSymbols
|
|
639
|
-
/**
|
|
640
|
-
* @return {Region}
|
|
641
|
-
*/
|
|
642
|
-
getRegionToCheck() {
|
|
643
|
-
return this._regionToCheck
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
// noinspection JSUnusedGlobalSymbols
|
|
647
|
-
/**
|
|
648
|
-
* @param {Region} regionToCheck
|
|
649
|
-
*/
|
|
650
|
-
setRegionToCheck(regionToCheck) {
|
|
651
|
-
this._regionToCheck = regionToCheck
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
// noinspection JSUnusedGlobalSymbols
|
|
655
|
-
/**
|
|
656
|
-
* @return {boolean}
|
|
657
|
-
*/
|
|
658
|
-
shouldStitchContent() {
|
|
659
|
-
return this._stitchContent
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
// noinspection JSUnusedGlobalSymbols
|
|
663
|
-
/**
|
|
664
|
-
* Turns on/off the automatic scrolling to a region being checked by {@code checkRegion}.
|
|
665
|
-
*
|
|
666
|
-
* @param {boolean} shouldScroll - Whether to automatically scroll to a region being validated.
|
|
667
|
-
*/
|
|
668
|
-
setScrollToRegion(shouldScroll) {
|
|
669
|
-
if (shouldScroll) {
|
|
670
|
-
this._regionVisibilityStrategy = new MoveToRegionVisibilityStrategy(this._logger)
|
|
671
|
-
} else {
|
|
672
|
-
this._regionVisibilityStrategy = new NopRegionVisibilityStrategy(this._logger)
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
// noinspection JSUnusedGlobalSymbols
|
|
677
|
-
/**
|
|
678
|
-
* @return {boolean} - Whether to automatically scroll to a region being validated.
|
|
679
|
-
*/
|
|
680
|
-
getScrollToRegion() {
|
|
681
|
-
return !(this._regionVisibilityStrategy instanceof NopRegionVisibilityStrategy)
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
// noinspection JSUnusedGlobalSymbols
|
|
685
|
-
/**
|
|
686
|
-
* @param {By} element
|
|
687
|
-
*/
|
|
688
|
-
setScrollRootElement(element) {
|
|
689
|
-
this._scrollRootElement = this._driver.findElement(element)
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
/**
|
|
693
|
-
* Gets original fc.
|
|
694
|
-
*
|
|
695
|
-
* @return {FrameChain} the original fc
|
|
696
|
-
*/
|
|
697
|
-
getOriginalFC() {
|
|
698
|
-
return this._originalFC
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
/**
|
|
702
|
-
* Gets current frame position provider.
|
|
703
|
-
*
|
|
704
|
-
* @return {PositionProvider} - the current frame position provider
|
|
705
|
-
*/
|
|
706
|
-
getCurrentFramePositionProvider() {
|
|
707
|
-
return this._currentFramePositionProvider
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
/**
|
|
711
|
-
* Gets current frame scroll root element.
|
|
712
|
-
*
|
|
713
|
-
* @ignore
|
|
714
|
-
* @return {Promise<WebElement>} - the current frame scroll root element
|
|
715
|
-
*/
|
|
716
|
-
async getCurrentFrameScrollRootElement() {
|
|
717
|
-
const currentFrame = this._driver.getFrameChain().peek()
|
|
718
|
-
|
|
719
|
-
let scrollRootElement = null
|
|
720
|
-
if (currentFrame) {
|
|
721
|
-
scrollRootElement = await currentFrame.getForceScrollRootElement(this._driver)
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
if (!scrollRootElement) {
|
|
725
|
-
scrollRootElement = await this.getScrollRootElement()
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
return scrollRootElement
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
// noinspection JSUnusedGlobalSymbols
|
|
732
|
-
/**
|
|
733
|
-
* @return {Promise<WebElement>}
|
|
734
|
-
*/
|
|
735
|
-
async getScrollRootElement() {
|
|
736
|
-
return this._scrollRootElement
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
// noinspection JSUnusedGlobalSymbols
|
|
740
|
-
/**
|
|
741
|
-
* @param {ImageRotation} rotation - The image rotation data.
|
|
742
|
-
*/
|
|
743
|
-
setRotation(rotation) {
|
|
744
|
-
this._rotation = rotation
|
|
745
|
-
|
|
746
|
-
if (this._driver) {
|
|
747
|
-
this._driver.setRotation(rotation)
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
// noinspection JSUnusedGlobalSymbols
|
|
752
|
-
/**
|
|
753
|
-
* @return {ImageRotation} - The image rotation data.
|
|
754
|
-
*/
|
|
755
|
-
getRotation() {
|
|
756
|
-
return this._rotation
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
// noinspection JSUnusedGlobalSymbols
|
|
760
|
-
/**
|
|
761
|
-
* Set the image rotation degrees.
|
|
762
|
-
* @param {number} degrees - The amount of degrees to set the rotation to.
|
|
763
|
-
* @deprecated use {@link setRotation} instead
|
|
764
|
-
*/
|
|
765
|
-
setForcedImageRotation(degrees) {
|
|
766
|
-
this.setRotation(new ImageRotation(degrees))
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
// noinspection JSUnusedGlobalSymbols
|
|
770
|
-
/**
|
|
771
|
-
* Get the rotation degrees.
|
|
772
|
-
* @return {number} - The rotation degrees.
|
|
773
|
-
* @deprecated use {@link getRotation} instead
|
|
774
|
-
*/
|
|
775
|
-
getForcedImageRotation() {
|
|
776
|
-
return this.getRotation().getRotation()
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
/**
|
|
780
|
-
* A url pointing to a DOM capture of the AUT at the time of screenshot
|
|
781
|
-
*
|
|
782
|
-
* @override
|
|
783
|
-
* @protected
|
|
784
|
-
* @return {Promise<?string>}
|
|
785
|
-
*/
|
|
786
|
-
async getDomUrl() {
|
|
787
|
-
return this._domUrl
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
// noinspection JSUnusedGlobalSymbols
|
|
791
|
-
/**
|
|
792
|
-
* @param {string} domUrl
|
|
793
|
-
*/
|
|
794
|
-
setDomUrl(domUrl) {
|
|
795
|
-
this._domUrl = domUrl
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
/**
|
|
799
|
-
* @param {CorsIframeHandle} corsIframeHandle
|
|
800
|
-
*/
|
|
801
|
-
setCorsIframeHandle(corsIframeHandle) {
|
|
802
|
-
this._corsIframeHandle = corsIframeHandle
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
/**
|
|
806
|
-
* @return {CorsIframeHandle}
|
|
807
|
-
*/
|
|
808
|
-
getCorsIframeHandle() {
|
|
809
|
-
return this._corsIframeHandle
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
/* ------------ Getters/Setters from Configuration ------------ */
|
|
813
|
-
|
|
814
|
-
// noinspection JSUnusedGlobalSymbols
|
|
815
|
-
/**
|
|
816
|
-
* @return {boolean}
|
|
817
|
-
*/
|
|
818
|
-
getHideCaret() {
|
|
819
|
-
return this._configuration.getHideCaret()
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
// noinspection JSUnusedGlobalSymbols
|
|
823
|
-
/**
|
|
824
|
-
* @param {boolean} hideCaret
|
|
825
|
-
*/
|
|
826
|
-
setHideCaret(hideCaret) {
|
|
827
|
-
this._configuration.setHideCaret(hideCaret)
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
// noinspection JSUnusedGlobalSymbols
|
|
831
|
-
/**
|
|
832
|
-
* Forces a full page screenshot (by scrolling and stitching) if the browser only supports viewport screenshots).
|
|
833
|
-
*
|
|
834
|
-
* @param {boolean} shouldForce - Whether to force a full page screenshot or not.
|
|
835
|
-
*/
|
|
836
|
-
setForceFullPageScreenshot(shouldForce) {
|
|
837
|
-
this._configuration.setForceFullPageScreenshot(shouldForce)
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
// noinspection JSUnusedGlobalSymbols
|
|
841
|
-
/**
|
|
842
|
-
* @return {boolean} - Whether Eyes should force a full page screenshot.
|
|
843
|
-
*/
|
|
844
|
-
getForceFullPageScreenshot() {
|
|
845
|
-
return this._configuration.getForceFullPageScreenshot()
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
// noinspection JSUnusedGlobalSymbols
|
|
849
|
-
/**
|
|
850
|
-
* Sets the time to wait just before taking a screenshot (e.g., to allow positioning to stabilize when performing a
|
|
851
|
-
* full page stitching).
|
|
852
|
-
*
|
|
853
|
-
* @param {number} waitBeforeScreenshots - The time to wait (Milliseconds). Values smaller or equal to 0, will cause the
|
|
854
|
-
* default value to be used.
|
|
855
|
-
*/
|
|
856
|
-
setWaitBeforeScreenshots(waitBeforeScreenshots) {
|
|
857
|
-
this._configuration.setWaitBeforeScreenshots(waitBeforeScreenshots)
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
// noinspection JSUnusedGlobalSymbols
|
|
861
|
-
/**
|
|
862
|
-
* @return {number} - The time to wait just before taking a screenshot.
|
|
863
|
-
*/
|
|
864
|
-
getWaitBeforeScreenshots() {
|
|
865
|
-
return this._configuration.getWaitBeforeScreenshots()
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
// noinspection JSUnusedGlobalSymbols
|
|
869
|
-
/**
|
|
870
|
-
* Hide the scrollbars when taking screenshots.
|
|
871
|
-
*
|
|
872
|
-
* @param {boolean} shouldHide - Whether to hide the scrollbars or not.
|
|
873
|
-
*/
|
|
874
|
-
setHideScrollbars(shouldHide) {
|
|
875
|
-
this._configuration.setHideScrollbars(shouldHide)
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
// noinspection JSUnusedGlobalSymbols
|
|
879
|
-
/**
|
|
880
|
-
* @return {boolean} - Whether or not scrollbars are hidden when taking screenshots.
|
|
881
|
-
*/
|
|
882
|
-
getHideScrollbars() {
|
|
883
|
-
return this._configuration.getHideScrollbars()
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
// noinspection JSUnusedGlobalSymbols
|
|
887
|
-
/**
|
|
888
|
-
* Set the type of stitching used for full page screenshots. When the page includes fixed position header/sidebar,
|
|
889
|
-
* use {@link StitchMode#CSS}. Default is {@link StitchMode#SCROLL}.
|
|
890
|
-
*
|
|
891
|
-
* @param {StitchMode} mode - The stitch mode to set.
|
|
892
|
-
*/
|
|
893
|
-
setStitchMode(mode) {
|
|
894
|
-
this._logger.verbose(`setting stitch mode to ${mode}`)
|
|
895
|
-
this._configuration.setStitchMode(mode)
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
// noinspection JSUnusedGlobalSymbols
|
|
899
|
-
/**
|
|
900
|
-
* @return {StitchMode} - The current stitch mode settings.
|
|
901
|
-
*/
|
|
902
|
-
getStitchMode() {
|
|
903
|
-
return this._configuration.getStitchMode()
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
// noinspection JSUnusedGlobalSymbols
|
|
907
|
-
/**
|
|
908
|
-
* Sets the stitching overlap in pixels.
|
|
909
|
-
*
|
|
910
|
-
* @param {number} stitchOverlap - The width (in pixels) of the overlap.
|
|
911
|
-
*/
|
|
912
|
-
setStitchOverlap(stitchOverlap) {
|
|
913
|
-
this._configuration.setStitchOverlap(stitchOverlap)
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
// noinspection JSUnusedGlobalSymbols
|
|
917
|
-
/**
|
|
918
|
-
* @return {number} - Returns the stitching overlap in pixels.
|
|
919
|
-
*/
|
|
920
|
-
getStitchOverlap() {
|
|
921
|
-
return this._configuration.getStitchOverlap()
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
Eyes.UNKNOWN_DEVICE_PIXEL_RATIO = 0
|
|
926
|
-
Eyes.DEFAULT_DEVICE_PIXEL_RATIO = 1
|
|
927
|
-
exports.Eyes = Eyes
|