webdriverio 8.23.3 → 8.23.5
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/build/commands/element/isDisplayed.d.ts +7 -0
- package/build/commands/element/isDisplayed.d.ts.map +1 -1
- package/build/commands/element/isDisplayed.js +15 -0
- package/build/scripts/isElementDisplayed.d.ts.map +1 -1
- package/build/scripts/isElementDisplayed.js +8 -6
- package/build/scripts/resq.d.ts.map +1 -1
- package/build/scripts/resq.js +5 -6
- package/package.json +2 -2
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
*
|
|
11
11
|
* :::
|
|
12
12
|
*
|
|
13
|
+
* WebdriverIO, when conducting browser tests, utilizes a [custom script](https://github.com/webdriverio/webdriverio/blob/59d349ca847950354d02b9e548f60cc50e7871f0/packages/webdriverio/src/scripts/isElementDisplayed.ts)
|
|
14
|
+
* specifically designed to assess the visibility of elements. This script is key in determining whether an
|
|
15
|
+
* element is displayed on the page. Conversely, for native mobile testing scenarios with Appium, WebdriverIO
|
|
16
|
+
* defers to the [`isElementDisplayed`](https://appium.io/docs/en/2.1/reference/interfaces/appium_types.ExternalDriver/#elementdisplayed)
|
|
17
|
+
* command provided by Appium. This command evaluates the visibility of elements using criteria established by the
|
|
18
|
+
* underlying Appium driver, ensuring accurate and driver-specific assessments for mobile applications.
|
|
19
|
+
*
|
|
13
20
|
* <example>
|
|
14
21
|
:index.html
|
|
15
22
|
<div id="noSize"></div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isDisplayed.d.ts","sourceRoot":"","sources":["../../../src/commands/element/isDisplayed.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"isDisplayed.d.ts","sourceRoot":"","sources":["../../../src/commands/element/isDisplayed.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,wBAAsB,WAAW,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,oBAoB3D"}
|
|
@@ -13,6 +13,13 @@ import isElementDisplayedScript from '../../scripts/isElementDisplayed.js';
|
|
|
13
13
|
*
|
|
14
14
|
* :::
|
|
15
15
|
*
|
|
16
|
+
* WebdriverIO, when conducting browser tests, utilizes a [custom script](https://github.com/webdriverio/webdriverio/blob/59d349ca847950354d02b9e548f60cc50e7871f0/packages/webdriverio/src/scripts/isElementDisplayed.ts)
|
|
17
|
+
* specifically designed to assess the visibility of elements. This script is key in determining whether an
|
|
18
|
+
* element is displayed on the page. Conversely, for native mobile testing scenarios with Appium, WebdriverIO
|
|
19
|
+
* defers to the [`isElementDisplayed`](https://appium.io/docs/en/2.1/reference/interfaces/appium_types.ExternalDriver/#elementdisplayed)
|
|
20
|
+
* command provided by Appium. This command evaluates the visibility of elements using criteria established by the
|
|
21
|
+
* underlying Appium driver, ensuring accurate and driver-specific assessments for mobile applications.
|
|
22
|
+
*
|
|
16
23
|
* <example>
|
|
17
24
|
:index.html
|
|
18
25
|
<div id="noSize"></div>
|
|
@@ -64,6 +71,14 @@ export async function isDisplayed() {
|
|
|
64
71
|
if (!await hasElementId(this)) {
|
|
65
72
|
return false;
|
|
66
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* For mobile sessions with Appium we continue to use the elementDisplayed command
|
|
76
|
+
* as we can't run JS in native apps
|
|
77
|
+
*/
|
|
78
|
+
const isNativeApplication = !browser.capabilities.browserName;
|
|
79
|
+
if (browser.isMobile && isNativeApplication) {
|
|
80
|
+
return await this.isElementDisplayed(this.elementId);
|
|
81
|
+
}
|
|
67
82
|
return await browser.execute(isElementDisplayedScript, {
|
|
68
83
|
[ELEMENT_KEY]: this.elementId,
|
|
69
84
|
ELEMENT: this.elementId // jsonwp compatible
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isElementDisplayed.d.ts","sourceRoot":"","sources":["../../src/scripts/isElementDisplayed.ts"],"names":[],"mappings":"AAyBA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAE,OAAO,EAAE,OAAO,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"isElementDisplayed.d.ts","sourceRoot":"","sources":["../../src/scripts/isElementDisplayed.ts"],"names":[],"mappings":"AAyBA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CA0OrE"}
|
|
@@ -105,7 +105,7 @@ export default function isElementDisplayed(element) {
|
|
|
105
105
|
}
|
|
106
106
|
// If the container's overflow is not hidden and it has zero size, consider the
|
|
107
107
|
// container to have non-zero dimensions if a child node has non-zero dimensions.
|
|
108
|
-
return Array.from(element.childNodes).some((childNode)
|
|
108
|
+
return Array.from(element.childNodes).some(function (childNode) {
|
|
109
109
|
if (childNode.nodeType === Node.TEXT_NODE) {
|
|
110
110
|
return true;
|
|
111
111
|
}
|
|
@@ -136,7 +136,7 @@ export default function isElementDisplayed(element) {
|
|
|
136
136
|
return false;
|
|
137
137
|
}
|
|
138
138
|
// This element's subtree is hidden by overflow if all child subtrees are as well.
|
|
139
|
-
return Array.from(element.childNodes).every((childNode)
|
|
139
|
+
return Array.from(element.childNodes).every(function (childNode) {
|
|
140
140
|
// Returns true if the child node is overflowed or otherwise hidden.
|
|
141
141
|
// Base case: not an element, has zero size, scrolled out, or doesn't overflow container.
|
|
142
142
|
// Visibility of text nodes is controlled by parent
|
|
@@ -166,7 +166,7 @@ export default function isElementDisplayed(element) {
|
|
|
166
166
|
// This is a partial reimplementation of Selenium's "element is displayed" algorithm.
|
|
167
167
|
// When the W3C specification's algorithm stabilizes, we should implement that.
|
|
168
168
|
// If this command is misdirected to the wrong document (and is NOT inside a shadow root), treat it as not shown.
|
|
169
|
-
if (!isElementInsideShadowRoot(element) && !document.contains(element)) {
|
|
169
|
+
if (!isElementInsideShadowRoot(element) && !document.body.contains(element)) {
|
|
170
170
|
return false;
|
|
171
171
|
}
|
|
172
172
|
// Special cases for specific tag names.
|
|
@@ -179,7 +179,9 @@ export default function isElementDisplayed(element) {
|
|
|
179
179
|
case 'OPTGROUP':
|
|
180
180
|
case 'OPTION': {
|
|
181
181
|
// Option/optgroup are considered shown if the containing <select> is shown.
|
|
182
|
-
const enclosingSelectElement = enclosingNodeOrSelfMatchingPredicate(element, (e)
|
|
182
|
+
const enclosingSelectElement = enclosingNodeOrSelfMatchingPredicate(element, function (e) {
|
|
183
|
+
return e.tagName.toUpperCase() === 'SELECT';
|
|
184
|
+
});
|
|
183
185
|
return isElementDisplayed(enclosingSelectElement);
|
|
184
186
|
}
|
|
185
187
|
case 'INPUT':
|
|
@@ -196,10 +198,10 @@ export default function isElementDisplayed(element) {
|
|
|
196
198
|
if (cascadedStylePropertyForElement(element, 'visibility') !== 'visible') {
|
|
197
199
|
return false;
|
|
198
200
|
}
|
|
199
|
-
const hasAncestorWithZeroOpacity = !!enclosingElementOrSelfMatchingPredicate(element, (e)
|
|
201
|
+
const hasAncestorWithZeroOpacity = !!enclosingElementOrSelfMatchingPredicate(element, function (e) {
|
|
200
202
|
return Number(cascadedStylePropertyForElement(e, 'opacity')) === 0;
|
|
201
203
|
});
|
|
202
|
-
const hasAncestorWithDisplayNone = !!enclosingElementOrSelfMatchingPredicate(element, (e)
|
|
204
|
+
const hasAncestorWithDisplayNone = !!enclosingElementOrSelfMatchingPredicate(element, function (e) {
|
|
203
205
|
return cascadedStylePropertyForElement(e, 'display') === 'none';
|
|
204
206
|
});
|
|
205
207
|
if (hasAncestorWithZeroOpacity || hasAncestorWithDisplayNone) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resq.d.ts","sourceRoot":"","sources":["../../src/scripts/resq.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,YAE3B,CAAA;AAED,eAAO,MAAM,MAAM,aACL,MAAM,SACT,GAAG,EAAE,SACL,OAAO,MAAM,EAAE,GAAG,CAAC,gBACZ,WAAW;;QA0B5B,CAAA;AAED,eAAO,MAAM,OAAO,aACN,MAAM,SACT,GAAG,EAAE,SACL,OAAO,MAAM,EAAE,MAAM,CAAC,gBACf,WAAW,
|
|
1
|
+
{"version":3,"file":"resq.d.ts","sourceRoot":"","sources":["../../src/scripts/resq.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,YAE3B,CAAA;AAED,eAAO,MAAM,MAAM,aACL,MAAM,SACT,GAAG,EAAE,SACL,OAAO,MAAM,EAAE,GAAG,CAAC,gBACZ,WAAW;;QA0B5B,CAAA;AAED,eAAO,MAAM,OAAO,aACN,MAAM,SACT,GAAG,EAAE,SACL,OAAO,MAAM,EAAE,MAAM,CAAC,gBACf,WAAW,kBAgC5B,CAAA"}
|
package/build/scripts/resq.js
CHANGED
|
@@ -39,13 +39,12 @@ export const react$$ = function react$$(selector, props, state, reactElement) {
|
|
|
39
39
|
// this avoids having nested arrays of nodes which the driver does not understand
|
|
40
40
|
// [[div, div], [div, div]] => [div, div, div, div]
|
|
41
41
|
let nodes = [];
|
|
42
|
-
elements.forEach(element
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
nodes = nodes.concat(node || []);
|
|
42
|
+
elements.forEach(function (element) {
|
|
43
|
+
if (element.isFragment) {
|
|
44
|
+
nodes = nodes.concat(element.node || []);
|
|
46
45
|
}
|
|
47
|
-
else if (node) {
|
|
48
|
-
nodes.push(node);
|
|
46
|
+
else if (element.node) {
|
|
47
|
+
nodes.push(element.node);
|
|
49
48
|
}
|
|
50
49
|
});
|
|
51
50
|
return [...nodes];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webdriverio",
|
|
3
3
|
"description": "Next-gen browser and mobile automation test framework for Node.js",
|
|
4
|
-
"version": "8.23.
|
|
4
|
+
"version": "8.23.5",
|
|
5
5
|
"homepage": "https://webdriver.io",
|
|
6
6
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"optional": true
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "45ccc7c221e24335f7e54bbabf7942d389d7d4cc"
|
|
104
104
|
}
|