@applitools/eyes-testcafe 2.0.0-beta.9 → 3.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 +540 -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 -77
- 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 -30
- package/lib/BordersAwareElementContentLocationProvider.js +0 -79
- package/lib/Eyes.js +0 -927
- package/lib/EyesFactory.js +0 -73
- package/lib/EyesTestCafe.js +0 -1277
- 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 -49
- 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 -335
- package/lib/wrappers/EyesWebDriver.js +0 -571
- package/lib/wrappers/EyesWebElement.js +0 -383
- package/lib/wrappers/EyesWebElementPromise.js +0 -68
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @ignore
|
|
5
|
-
*/
|
|
6
|
-
class FrameLocator {
|
|
7
|
-
constructor() {
|
|
8
|
-
/** @type {WebElement} */
|
|
9
|
-
this._frameElement = null
|
|
10
|
-
/** @type {By} */
|
|
11
|
-
this._frameSelector = null
|
|
12
|
-
/** @type {string} */
|
|
13
|
-
this._frameNameOrId = undefined
|
|
14
|
-
/** @type {number} */
|
|
15
|
-
this._frameIndex = undefined
|
|
16
|
-
/** @type {By} */
|
|
17
|
-
this._scrollRootSelector = undefined
|
|
18
|
-
/** @type {WebElement} */
|
|
19
|
-
this._scrollRootElement = undefined
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @return {number}
|
|
24
|
-
*/
|
|
25
|
-
getFrameIndex() {
|
|
26
|
-
return this._frameIndex
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @param {number} frameIndex
|
|
31
|
-
*/
|
|
32
|
-
setFrameIndex(frameIndex) {
|
|
33
|
-
this._frameIndex = frameIndex
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @return {string}
|
|
38
|
-
*/
|
|
39
|
-
getFrameNameOrId() {
|
|
40
|
-
return this._frameNameOrId
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @param {string} frameNameOrId
|
|
45
|
-
*/
|
|
46
|
-
setFrameNameOrId(frameNameOrId) {
|
|
47
|
-
this._frameNameOrId = frameNameOrId
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @return {By}
|
|
52
|
-
*/
|
|
53
|
-
getFrameSelector() {
|
|
54
|
-
return this._frameSelector
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @param {By} frameSelector
|
|
59
|
-
*/
|
|
60
|
-
setFrameSelector(frameSelector) {
|
|
61
|
-
this._frameSelector = frameSelector
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// noinspection JSUnusedGlobalSymbols
|
|
65
|
-
/**
|
|
66
|
-
* @return {WebElement}
|
|
67
|
-
*/
|
|
68
|
-
getFrameElement() {
|
|
69
|
-
return this._frameElement
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @param {WebElement} frameElement
|
|
74
|
-
*/
|
|
75
|
-
setFrameElement(frameElement) {
|
|
76
|
-
this._frameElement = frameElement
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// noinspection JSUnusedGlobalSymbols
|
|
80
|
-
/**
|
|
81
|
-
* @return {WebElement}
|
|
82
|
-
*/
|
|
83
|
-
getScrollRootElement() {
|
|
84
|
-
return this._scrollRootElement
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* @param {WebElement} scrollRootElement
|
|
89
|
-
*/
|
|
90
|
-
setScrollRootElement(scrollRootElement) {
|
|
91
|
-
this._scrollRootElement = scrollRootElement
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// noinspection JSUnusedGlobalSymbols
|
|
95
|
-
/**
|
|
96
|
-
* @return {By}
|
|
97
|
-
*/
|
|
98
|
-
getScrollRootSelector() {
|
|
99
|
-
return this._scrollRootSelector
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* @param {By} scrollRootSelector
|
|
104
|
-
*/
|
|
105
|
-
setScrollRootSelector(scrollRootSelector) {
|
|
106
|
-
this._scrollRootSelector = scrollRootSelector
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
exports.FrameLocator = FrameLocator
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const {Location, Region, CoordinatesType} = require('@applitools/eyes-common')
|
|
4
|
-
const {GetRegion} = require('@applitools/eyes-sdk-core')
|
|
5
|
-
|
|
6
|
-
const {SelectorByElement} = require('./SelectorByElement')
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @ignore
|
|
10
|
-
*/
|
|
11
|
-
class IgnoreRegionByElement extends GetRegion {
|
|
12
|
-
/**
|
|
13
|
-
* @param {WebElement} webElement
|
|
14
|
-
*/
|
|
15
|
-
constructor(webElement) {
|
|
16
|
-
super()
|
|
17
|
-
this._element = webElement
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// noinspection JSCheckFunctionSignatures
|
|
21
|
-
/**
|
|
22
|
-
* @override
|
|
23
|
-
* @param {Eyes} eyes
|
|
24
|
-
* @param {EyesScreenshot} screenshot
|
|
25
|
-
* @return {Promise<Region[]>}
|
|
26
|
-
*/
|
|
27
|
-
async getRegion(eyes, screenshot) {
|
|
28
|
-
// eslint-disable-line no-unused-vars
|
|
29
|
-
const rect = await this._element.getRect()
|
|
30
|
-
const lTag = screenshot.convertLocation(
|
|
31
|
-
new Location(rect),
|
|
32
|
-
CoordinatesType.CONTEXT_RELATIVE,
|
|
33
|
-
CoordinatesType.SCREENSHOT_AS_IS,
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
return [new Region(lTag.getX(), lTag.getY(), rect.width, rect.height)]
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// noinspection JSCheckFunctionSignatures
|
|
40
|
-
/**
|
|
41
|
-
* @inheritDoc
|
|
42
|
-
* @param {Eyes} eyes
|
|
43
|
-
* @return {Promise<string>}
|
|
44
|
-
*/
|
|
45
|
-
async getSelector(eyes) {
|
|
46
|
-
// eslint-disable-line no-unused-vars
|
|
47
|
-
return new SelectorByElement(this._element).getSelector(eyes)
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
exports.IgnoreRegionByElement = IgnoreRegionByElement
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const {GetRegion, CoordinatesType, Location, Region} = require('@applitools/eyes-sdk-core')
|
|
4
|
-
|
|
5
|
-
const {SelectorByLocator} = require('./SelectorByLocator')
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @ignore
|
|
9
|
-
*/
|
|
10
|
-
class IgnoreRegionBySelector extends GetRegion {
|
|
11
|
-
/**
|
|
12
|
-
* @param {By} regionSelector
|
|
13
|
-
*/
|
|
14
|
-
constructor(regionSelector) {
|
|
15
|
-
super()
|
|
16
|
-
this._selector = regionSelector
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// noinspection JSCheckFunctionSignatures
|
|
20
|
-
/**
|
|
21
|
-
* @inheritDoc
|
|
22
|
-
* @param {Eyes} eyes
|
|
23
|
-
* @param {EyesScreenshot} screenshot
|
|
24
|
-
* @return {Promise<Region[]>}
|
|
25
|
-
*/
|
|
26
|
-
async getRegion(eyes, screenshot) {
|
|
27
|
-
const elements = await eyes.getDriver().findElements(this._selector)
|
|
28
|
-
|
|
29
|
-
const values = []
|
|
30
|
-
if (elements && elements.length > 0) {
|
|
31
|
-
for (let i = 0; i < elements.length; i += 1) {
|
|
32
|
-
const rect = await elements[i].getRect()
|
|
33
|
-
const lTag = screenshot.convertLocation(
|
|
34
|
-
new Location(rect),
|
|
35
|
-
CoordinatesType.CONTEXT_RELATIVE,
|
|
36
|
-
CoordinatesType.SCREENSHOT_AS_IS,
|
|
37
|
-
)
|
|
38
|
-
values.push(new Region(lTag.getX(), lTag.getY(), rect.width, rect.height))
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return values
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// noinspection JSCheckFunctionSignatures
|
|
46
|
-
/**
|
|
47
|
-
* @inheritDoc
|
|
48
|
-
* @param {Eyes} eyes
|
|
49
|
-
* @return {Promise<string>}
|
|
50
|
-
*/
|
|
51
|
-
async getSelector(eyes) {
|
|
52
|
-
// eslint-disable-line no-unused-vars
|
|
53
|
-
return new SelectorByLocator(this._selector).getSelector(eyes)
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
exports.IgnoreRegionBySelector = IgnoreRegionBySelector
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const {GeneralUtils} = require('@applitools/eyes-common')
|
|
4
|
-
const {GetSelector} = require('@applitools/eyes-sdk-core')
|
|
5
|
-
|
|
6
|
-
const EYES_SELECTOR_TAG = 'data-eyes-selector'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @ignore
|
|
10
|
-
*/
|
|
11
|
-
class SelectorByElement extends GetSelector {
|
|
12
|
-
/**
|
|
13
|
-
* @param {WebElement} webElement
|
|
14
|
-
*/
|
|
15
|
-
constructor(webElement) {
|
|
16
|
-
super()
|
|
17
|
-
this._element = webElement
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// noinspection JSCheckFunctionSignatures
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
* @param {Eyes} eyes
|
|
24
|
-
* @return {Promise<string>}
|
|
25
|
-
*/
|
|
26
|
-
async getSelector(eyes) {
|
|
27
|
-
// eslint-disable-line no-unused-vars
|
|
28
|
-
const randId = GeneralUtils.randomAlphanumeric()
|
|
29
|
-
await eyes._driver.executeScript(
|
|
30
|
-
`arguments[0].setAttribute('${EYES_SELECTOR_TAG}', '${randId}');`,
|
|
31
|
-
this._element,
|
|
32
|
-
)
|
|
33
|
-
return `[${EYES_SELECTOR_TAG}="${randId}"]`
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
exports.SelectorByElement = SelectorByElement
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const {GeneralUtils} = require('@applitools/eyes-common')
|
|
4
|
-
const {GetSelector} = require('@applitools/eyes-sdk-core')
|
|
5
|
-
|
|
6
|
-
const EYES_SELECTOR_TAG = 'data-eyes-selector'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @ignore
|
|
10
|
-
*/
|
|
11
|
-
class SelectorByLocator extends GetSelector {
|
|
12
|
-
/**
|
|
13
|
-
* @param {By} regionLocator
|
|
14
|
-
*/
|
|
15
|
-
constructor(regionLocator) {
|
|
16
|
-
super()
|
|
17
|
-
this._selector = regionLocator
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// noinspection JSCheckFunctionSignatures
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
* @param {Eyes} eyes
|
|
24
|
-
* @return {Promise<string>}
|
|
25
|
-
*/
|
|
26
|
-
async getSelector(eyes) {
|
|
27
|
-
// eslint-disable-line no-unused-vars
|
|
28
|
-
if (this._selector.using === 'css selector') {
|
|
29
|
-
return this._selector.value
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const randId = GeneralUtils.randomAlphanumeric()
|
|
33
|
-
const elements = await eyes._driver.findElements(this._selector)
|
|
34
|
-
if (elements && elements.length > 0) {
|
|
35
|
-
for (let i = 0; i < elements.length; i += 1) {
|
|
36
|
-
await eyes._driver.executeScript(
|
|
37
|
-
`arguments[0].setAttribute('${EYES_SELECTOR_TAG}', '${randId}');`,
|
|
38
|
-
elements[i],
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return `[${EYES_SELECTOR_TAG}="${randId}"]`
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
exports.SelectorByLocator = SelectorByLocator
|
package/lib/fluent/Target.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const {TestcafeCheckSettings} = require('./TestcafeCheckSettings')
|
|
4
|
-
|
|
5
|
-
class Target {
|
|
6
|
-
/**
|
|
7
|
-
* Validate current window
|
|
8
|
-
*
|
|
9
|
-
* @return {TestcafeCheckSettings}
|
|
10
|
-
* @constructor
|
|
11
|
-
*/
|
|
12
|
-
static window() {
|
|
13
|
-
return new TestcafeCheckSettings()
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
exports.Target = Target
|
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const {TypeUtils, Region} = require('@applitools/eyes-common')
|
|
4
|
-
const {CheckSettings} = require('@applitools/eyes-sdk-core')
|
|
5
|
-
|
|
6
|
-
const {IgnoreRegionBySelector} = require('./IgnoreRegionBySelector')
|
|
7
|
-
// const {IgnoreRegionByElement} = require('./IgnoreRegionByElement')
|
|
8
|
-
const {FloatingRegionBySelector} = require('./FloatingRegionBySelector')
|
|
9
|
-
// const {FloatingRegionByElement} = require('./FloatingRegionByElement')
|
|
10
|
-
const {AccessibilityRegionBySelector} = require('./AccessibilityRegionBySelector')
|
|
11
|
-
// const {AccessibilityRegionByElement} = require('./AccessibilityRegionByElement')
|
|
12
|
-
const {SelectorByElement} = require('./SelectorByElement')
|
|
13
|
-
const {SelectorByLocator} = require('./SelectorByLocator')
|
|
14
|
-
const {FrameLocator} = require('./FrameLocator')
|
|
15
|
-
const {EyesWebElement} = require('../wrappers/EyesWebElement')
|
|
16
|
-
|
|
17
|
-
const BEFORE_CAPTURE_SCREENSHOT = 'beforeCaptureScreenshot'
|
|
18
|
-
|
|
19
|
-
class TestcafeCheckSettings extends CheckSettings {
|
|
20
|
-
/**
|
|
21
|
-
* @param {Region|RegionObject|By|WebElement|EyesWebElement|string} [region]
|
|
22
|
-
* @param {number|string|By|WebElement|EyesWebElement} [frame]
|
|
23
|
-
*/
|
|
24
|
-
constructor(region, frame) {
|
|
25
|
-
super()
|
|
26
|
-
|
|
27
|
-
this._targetSelector = null
|
|
28
|
-
this._targetElement = null
|
|
29
|
-
this._frameChain = []
|
|
30
|
-
|
|
31
|
-
/** @type {By} */
|
|
32
|
-
this._scrollRootSelector = undefined
|
|
33
|
-
/** @type {WebElement} */
|
|
34
|
-
this._scrollRootElement = undefined
|
|
35
|
-
|
|
36
|
-
if (region) {
|
|
37
|
-
this.region(region)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (frame) {
|
|
41
|
-
this.frame(frame)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** @type {Object<string, string>} */ this._scriptHooks = {}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @package
|
|
49
|
-
* @ignore
|
|
50
|
-
* @return {?GetSelector}
|
|
51
|
-
*/
|
|
52
|
-
getTargetProvider() {
|
|
53
|
-
if (this._targetSelector) {
|
|
54
|
-
return new SelectorByLocator(this._targetSelector)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (this._targetElement) {
|
|
58
|
-
return new SelectorByElement(this._targetElement)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return undefined
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @package
|
|
66
|
-
* @ignore
|
|
67
|
-
* @return {By}
|
|
68
|
-
*/
|
|
69
|
-
getTargetSelector() {
|
|
70
|
-
return this._targetSelector
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* @package
|
|
75
|
-
* @ignore
|
|
76
|
-
* @return {WebElement}
|
|
77
|
-
*/
|
|
78
|
-
getTargetElement() {
|
|
79
|
-
return this._targetElement
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @package
|
|
84
|
-
* @ignore
|
|
85
|
-
* @return {FrameLocator[]}
|
|
86
|
-
*/
|
|
87
|
-
getFrameChain() {
|
|
88
|
-
return this._frameChain
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @param {number|string|By|WebElement|EyesWebElement} frame - The frame to switch to.
|
|
93
|
-
* @return {this}
|
|
94
|
-
*/
|
|
95
|
-
frame(frame) {
|
|
96
|
-
const fl = new FrameLocator()
|
|
97
|
-
// noinspection IfStatementWithTooManyBranchesJS
|
|
98
|
-
if (TypeUtils.isInteger(frame)) {
|
|
99
|
-
fl.setFrameIndex(frame)
|
|
100
|
-
} else if (TypeUtils.isString(frame)) {
|
|
101
|
-
fl.setFrameNameOrId(frame)
|
|
102
|
-
} else if (EyesWebElement.isLocator(frame)) {
|
|
103
|
-
fl.setFrameSelector(frame)
|
|
104
|
-
} /* else if (frame instanceof WebElement) {
|
|
105
|
-
fl.setFrameElement(frame)
|
|
106
|
-
} */ else {
|
|
107
|
-
throw new TypeError('frame method called with argument of unknown type!')
|
|
108
|
-
}
|
|
109
|
-
this._frameChain.push(fl)
|
|
110
|
-
return this
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* @param {Region|RegionObject|By|WebElement|EyesWebElement|string} region - The region to validate.
|
|
115
|
-
* @return {this}
|
|
116
|
-
*/
|
|
117
|
-
region(region) {
|
|
118
|
-
// noinspection IfStatementWithTooManyBranchesJS
|
|
119
|
-
if (Region.isRegionCompatible(region)) {
|
|
120
|
-
super.updateTargetRegion(region)
|
|
121
|
-
} else if (TypeUtils.isString(region)) {
|
|
122
|
-
// this._targetSelector = By.css(region) // TODO: avoid converting to element for VisualGrid
|
|
123
|
-
} else if (EyesWebElement.isLocator(region)) {
|
|
124
|
-
this._targetSelector = region
|
|
125
|
-
} /* else if (region instanceof WebElement) {
|
|
126
|
-
this._targetElement = region
|
|
127
|
-
} */ else {
|
|
128
|
-
throw new TypeError('region method called with argument of unknown type!')
|
|
129
|
-
}
|
|
130
|
-
return this
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// noinspection JSMethodCanBeStatic
|
|
134
|
-
/**
|
|
135
|
-
* @inheritDoc
|
|
136
|
-
* @protected
|
|
137
|
-
* @param {By|WebElement|EyesWebElement|GetRegion|Region} region
|
|
138
|
-
*/
|
|
139
|
-
_regionToRegionProvider(region) {
|
|
140
|
-
if (EyesWebElement.isLocator(region)) {
|
|
141
|
-
return new IgnoreRegionBySelector(region)
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// if (region instanceof WebElement) {
|
|
145
|
-
// return new IgnoreRegionByElement(region)
|
|
146
|
-
// }
|
|
147
|
-
|
|
148
|
-
return super._regionToRegionProvider(region)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* @inheritDoc
|
|
153
|
-
* @param {...(By|WebElement|EyesWebElement|GetRegion|Region)} regions - A region to ignore when validating.
|
|
154
|
-
* @return {this}
|
|
155
|
-
*/
|
|
156
|
-
ignoreRegions(...regions) {
|
|
157
|
-
// noinspection JSValidateTypes
|
|
158
|
-
return super.ignoreRegions(...regions)
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* @inheritDoc
|
|
163
|
-
* @param {...(By|WebElement|EyesWebElement|GetRegion|Region)} regions - A region to match using the Layout method.
|
|
164
|
-
* @return {this}
|
|
165
|
-
*/
|
|
166
|
-
layoutRegions(...regions) {
|
|
167
|
-
// noinspection JSValidateTypes
|
|
168
|
-
return super.layoutRegions(...regions)
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* @inheritDoc
|
|
173
|
-
* @param {...(By|WebElement|EyesWebElement|GetRegion|Region)} regions - A region to match using the Strict method.
|
|
174
|
-
* @return {this}
|
|
175
|
-
*/
|
|
176
|
-
strictRegions(...regions) {
|
|
177
|
-
// noinspection JSValidateTypes
|
|
178
|
-
return super.strictRegions(...regions)
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* @inheritDoc
|
|
183
|
-
* @param {...(By|WebElement|EyesWebElement|GetRegion|Region)} regions - A region to match using the Content method.
|
|
184
|
-
* @return {this}
|
|
185
|
-
*/
|
|
186
|
-
contentRegions(...regions) {
|
|
187
|
-
// noinspection JSValidateTypes
|
|
188
|
-
return super.contentRegions(...regions)
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// noinspection JSCheckFunctionSignatures
|
|
192
|
-
/**
|
|
193
|
-
* @inheritDoc
|
|
194
|
-
* @param {GetFloatingRegion|Region|FloatingMatchSettings|By|WebElement|EyesWebElement} regionOrContainer - The content
|
|
195
|
-
* rectangle or region container
|
|
196
|
-
* @param {number} [maxUpOffset] - How much the content can move up.
|
|
197
|
-
* @param {number} [maxDownOffset] - How much the content can move down.
|
|
198
|
-
* @param {number} [maxLeftOffset] - How much the content can move to the left.
|
|
199
|
-
* @param {number} [maxRightOffset] - How much the content can move to the right.
|
|
200
|
-
* @return {this}
|
|
201
|
-
*/
|
|
202
|
-
floatingRegion(regionOrContainer, maxUpOffset, maxDownOffset, maxLeftOffset, maxRightOffset) {
|
|
203
|
-
if (EyesWebElement.isLocator(regionOrContainer)) {
|
|
204
|
-
const floatingRegion = new FloatingRegionBySelector(
|
|
205
|
-
regionOrContainer,
|
|
206
|
-
maxUpOffset,
|
|
207
|
-
maxDownOffset,
|
|
208
|
-
maxLeftOffset,
|
|
209
|
-
maxRightOffset,
|
|
210
|
-
)
|
|
211
|
-
this._floatingRegions.push(floatingRegion)
|
|
212
|
-
} /* else if (regionOrContainer instanceof WebElement) {
|
|
213
|
-
const floatingRegion = new FloatingRegionByElement(
|
|
214
|
-
regionOrContainer,
|
|
215
|
-
maxUpOffset,
|
|
216
|
-
maxDownOffset,
|
|
217
|
-
maxLeftOffset,
|
|
218
|
-
maxRightOffset,
|
|
219
|
-
)
|
|
220
|
-
this._floatingRegions.push(floatingRegion)
|
|
221
|
-
} */ else {
|
|
222
|
-
super.floatingRegion(
|
|
223
|
-
regionOrContainer,
|
|
224
|
-
maxUpOffset,
|
|
225
|
-
maxDownOffset,
|
|
226
|
-
maxLeftOffset,
|
|
227
|
-
maxRightOffset,
|
|
228
|
-
)
|
|
229
|
-
}
|
|
230
|
-
return this
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// noinspection JSCheckFunctionSignatures
|
|
234
|
-
/**
|
|
235
|
-
* @inheritDoc
|
|
236
|
-
* @param {number} maxOffset - How much each of the content rectangles can move in any direction.
|
|
237
|
-
* @param {...(GetFloatingRegion|Region|By|WebElement|EyesWebElement)} regionsOrContainers - One or more content
|
|
238
|
-
* rectangles or region containers
|
|
239
|
-
* @return {this}
|
|
240
|
-
*/
|
|
241
|
-
floatingRegions(maxOffset, ...regionsOrContainers) {
|
|
242
|
-
return super.floatingRegions(maxOffset, ...regionsOrContainers)
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// noinspection JSCheckFunctionSignatures
|
|
246
|
-
/**
|
|
247
|
-
* @inheritDoc
|
|
248
|
-
* @param {GetAccessibilityRegion|Region|AccessibilityMatchSettings|By|WebElement|EyesWebElement} regionOrContainer - The
|
|
249
|
-
* content rectangle or region container
|
|
250
|
-
* @param {AccessibilityRegionType} [regionType] - Type of accessibility.
|
|
251
|
-
* @return {this}
|
|
252
|
-
*/
|
|
253
|
-
accessibilityRegion(regionOrContainer, regionType) {
|
|
254
|
-
if (EyesWebElement.isLocator(regionOrContainer)) {
|
|
255
|
-
const accessibilityRegion = new AccessibilityRegionBySelector(regionOrContainer, regionType)
|
|
256
|
-
this._accessibilityRegions.push(accessibilityRegion)
|
|
257
|
-
} /* else if (regionOrContainer instanceof WebElement) {
|
|
258
|
-
const floatingRegion = new AccessibilityRegionByElement(regionOrContainer, regionType)
|
|
259
|
-
this._accessibilityRegions.push(floatingRegion)
|
|
260
|
-
} */ else {
|
|
261
|
-
super.accessibilityRegion(regionOrContainer, regionType)
|
|
262
|
-
}
|
|
263
|
-
return this
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* @ignore
|
|
268
|
-
* @return {string}
|
|
269
|
-
*/
|
|
270
|
-
getSizeMode() {
|
|
271
|
-
if (!this._targetRegion && !this._targetElement && !this._targetSelector) {
|
|
272
|
-
if (this.getStitchContent()) {
|
|
273
|
-
return 'full-page'
|
|
274
|
-
}
|
|
275
|
-
return 'viewport'
|
|
276
|
-
}
|
|
277
|
-
if (this._targetRegion) {
|
|
278
|
-
if (this.getStitchContent()) {
|
|
279
|
-
return 'region'
|
|
280
|
-
}
|
|
281
|
-
return 'region'
|
|
282
|
-
}
|
|
283
|
-
if (this.getStitchContent()) {
|
|
284
|
-
return 'selector'
|
|
285
|
-
}
|
|
286
|
-
return 'selector'
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* @param {By|WebElement|EyesWebElement} element
|
|
291
|
-
* @return {this}
|
|
292
|
-
*/
|
|
293
|
-
scrollRootElement(element) {
|
|
294
|
-
if (EyesWebElement.isLocator(element)) {
|
|
295
|
-
if (this._frameChain.length === 0) {
|
|
296
|
-
this._scrollRootSelector = element
|
|
297
|
-
} else {
|
|
298
|
-
this._frameChain[this._frameChain.length - 1].setScrollRootSelector(element)
|
|
299
|
-
}
|
|
300
|
-
} else if (this._frameChain.length === 0) {
|
|
301
|
-
this._scrollRootElement = element
|
|
302
|
-
} else {
|
|
303
|
-
this._frameChain[this._frameChain.length - 1].setScrollRootElement(element)
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
return this
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* @ignore
|
|
311
|
-
* @return {Promise<WebElement>}
|
|
312
|
-
*/
|
|
313
|
-
getScrollRootElement() {
|
|
314
|
-
return this._scrollRootElement
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* @ignore
|
|
319
|
-
* @return {By}
|
|
320
|
-
*/
|
|
321
|
-
getScrollRootSelector() {
|
|
322
|
-
return this._scrollRootSelector
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* @deprecated
|
|
327
|
-
* @param {String} hook
|
|
328
|
-
* @return {this}
|
|
329
|
-
*/
|
|
330
|
-
webHook(hook) {
|
|
331
|
-
return this.beforeRenderScreenshotHook(hook)
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* @param {String} hook
|
|
336
|
-
* @return {this}
|
|
337
|
-
*/
|
|
338
|
-
beforeRenderScreenshotHook(hook) {
|
|
339
|
-
this._scriptHooks[BEFORE_CAPTURE_SCREENSHOT] = hook
|
|
340
|
-
return this
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* @ignore
|
|
345
|
-
* @return {Object<string, string>}
|
|
346
|
-
*/
|
|
347
|
-
getScriptHooks() {
|
|
348
|
-
return this._scriptHooks
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
exports.TestcafeCheckSettings = TestcafeCheckSettings
|