webdriverio 9.18.1 → 9.18.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.
@@ -1,4 +1,26 @@
1
1
  import type { WaitForOptions } from '../../types.js';
2
+ interface WaitForDisplayedParams extends WaitForOptions {
3
+ /**
4
+ * `true` to check if the element is within the viewport. false by default.
5
+ */
6
+ withinViewport?: boolean;
7
+ /**
8
+ * `true` to check if the element content-visibility property has (or inherits) the value auto,
9
+ * and it is currently skipping its rendering. `true` by default.
10
+ * @default true
11
+ */
12
+ contentVisibilityAuto?: boolean;
13
+ /**
14
+ * `true` to check if the element opacity property has (or inherits) a value of 0. `true` by default.
15
+ * @default true
16
+ */
17
+ opacityProperty?: boolean;
18
+ /**
19
+ * `true` to check if the element is invisible due to the value of its visibility property. `true` by default.
20
+ * @default true
21
+ */
22
+ visibilityProperty?: boolean;
23
+ }
2
24
  /**
3
25
  *
4
26
  * Wait for an element for the provided amount of milliseconds to be displayed or not displayed.
@@ -17,11 +39,15 @@ import type { WaitForOptions } from '../../types.js';
17
39
  * @param {String=} options.timeoutMsg if exists it overrides the default error message
18
40
  * @param {Number=} options.interval interval between checks (default: `waitforInterval`)
19
41
  * @param {Boolean=} options.withinViewport set to `true` to wait until element is displayed within viewport (default: `false`)
42
+ * @param {Boolean=} options.contentVisibilityAuto set to `true` to check if the element content-visibility property has (or inherits) the value auto, and it is currently skipping its rendering. `true` by default.
43
+ * @param {Boolean=} options.opacityProperty set to `true` to check if the element opacity property has (or inherits) a value of 0. `true` by default.
44
+ * @param {Boolean=} options.visibilityProperty set to `true` to check if the element is invisible due to the value of its visibility property. `true` by default.
20
45
  * @return {Boolean} true if element is displayed (or doesn't if flag is set)
21
46
  * @uses utility/waitUntil, state/isDisplayed
22
47
  * @example https://github.com/webdriverio/example-recipes/blob/0bfb2b8d212b627a2659b10f4449184b657e1d59/waitForDisplayed/index.html#L3-L8
23
48
  * @example https://github.com/webdriverio/example-recipes/blob/9ac16b4d4cf4bc8ec87f6369439a2d0bcaae4483/waitForDisplayed/waitForDisplayedExample.js#L6-L14
24
49
  * @type utility
25
50
  */
26
- export declare function waitForDisplayed(this: WebdriverIO.Element, { timeout, interval, reverse, withinViewport, timeoutMsg, }?: WaitForOptions): Promise<true>;
51
+ export declare function waitForDisplayed(this: WebdriverIO.Element, { timeout, interval, reverse, withinViewport, contentVisibilityAuto, opacityProperty, visibilityProperty, timeoutMsg, }?: WaitForDisplayedParams): Promise<true>;
52
+ export {};
27
53
  //# sourceMappingURL=waitForDisplayed.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"waitForDisplayed.d.ts","sourceRoot":"","sources":["../../../src/commands/element/waitForDisplayed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EACI,OAAqC,EACrC,QAAuC,EACvC,OAAe,EACf,cAAsB,EACtB,UAAiJ,GACpJ,GAAE,cAAmB,iBAMzB"}
1
+ {"version":3,"file":"waitForDisplayed.d.ts","sourceRoot":"","sources":["../../../src/commands/element/waitForDisplayed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,UAAU,sBAAuB,SAAQ,cAAc;IACnD;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EACI,OAAqC,EACrC,QAAuC,EACvC,OAAe,EACf,cAAsB,EACtB,qBAA4B,EAC5B,eAAsB,EACtB,kBAAyB,EACzB,UAAiJ,GACpJ,GAAE,sBAA2B,iBAOjC"}
package/build/index.js CHANGED
@@ -7946,10 +7946,13 @@ function waitForDisplayed({
7946
7946
  interval = this.options.waitforInterval,
7947
7947
  reverse = false,
7948
7948
  withinViewport = false,
7949
+ contentVisibilityAuto = true,
7950
+ opacityProperty = true,
7951
+ visibilityProperty = true,
7949
7952
  timeoutMsg = 'element ("'.concat(this.selector, '") still ').concat(reverse ? "" : "not ", "displayed").concat(withinViewport ? " within viewport" : "", " after ").concat(timeout, "ms")
7950
7953
  } = {}) {
7951
7954
  return this.waitUntil(
7952
- async () => reverse !== await this.isDisplayed({ withinViewport }),
7955
+ async () => reverse !== await this.isDisplayed({ withinViewport, contentVisibilityAuto, opacityProperty, visibilityProperty }),
7953
7956
  { timeout, interval, timeoutMsg }
7954
7957
  );
7955
7958
  }
@@ -8469,9 +8472,6 @@ async function findDeepElement(selector) {
8469
8472
  log26.warn("Failed to execute browser.browsingContextLocateNodes({ ... }) due to ".concat(err, ", falling back to regular WebDriver Classic command"));
8470
8473
  return this && "elementId" in this && this.elementId ? this.findElementFromElement(this.elementId, using, value) : browser.findElement(using, value);
8471
8474
  });
8472
- if (!deepElementResult) {
8473
- return new Error("Couldn't find element with selector \"".concat(selector, '"'));
8474
- }
8475
8475
  return deepElementResult;
8476
8476
  }
8477
8477
  async function findDeepElements(selector) {
@@ -8518,7 +8518,9 @@ async function findElement(selector) {
8518
8518
  const browserObject = getBrowserObject35(this);
8519
8519
  const shadowRootManager = getShadowRootManager(browserObject);
8520
8520
  if (this.isBidi && typeof selector === "string" && !selector.startsWith(DEEP_SELECTOR) && !shadowRootManager.isWithinFrame()) {
8521
- return findDeepElement.call(this, selector);
8521
+ const notFoundError = new Error("Couldn't find element with selector \"".concat(selector, '"'));
8522
+ const elem = await findDeepElement.call(this, selector);
8523
+ return getElementFromResponse(elem) ? elem : notFoundError;
8522
8524
  }
8523
8525
  if (typeof selector === "string" && selector.startsWith(DEEP_SELECTOR)) {
8524
8526
  const notFoundError = new Error('shadow selector "'.concat(selector.slice(DEEP_SELECTOR.length), '" did not return an HTMLElement'));
package/build/node.js CHANGED
@@ -7672,10 +7672,13 @@ function waitForDisplayed({
7672
7672
  interval = this.options.waitforInterval,
7673
7673
  reverse = false,
7674
7674
  withinViewport = false,
7675
+ contentVisibilityAuto = true,
7676
+ opacityProperty = true,
7677
+ visibilityProperty = true,
7675
7678
  timeoutMsg = `element ("${this.selector}") still ${reverse ? "" : "not "}displayed${withinViewport ? " within viewport" : ""} after ${timeout}ms`
7676
7679
  } = {}) {
7677
7680
  return this.waitUntil(
7678
- async () => reverse !== await this.isDisplayed({ withinViewport }),
7681
+ async () => reverse !== await this.isDisplayed({ withinViewport, contentVisibilityAuto, opacityProperty, visibilityProperty }),
7679
7682
  { timeout, interval, timeoutMsg }
7680
7683
  );
7681
7684
  }
@@ -8179,9 +8182,6 @@ async function findDeepElement(selector) {
8179
8182
  log27.warn(`Failed to execute browser.browsingContextLocateNodes({ ... }) due to ${err}, falling back to regular WebDriver Classic command`);
8180
8183
  return this && "elementId" in this && this.elementId ? this.findElementFromElement(this.elementId, using, value) : browser.findElement(using, value);
8181
8184
  });
8182
- if (!deepElementResult) {
8183
- return new Error(`Couldn't find element with selector "${selector}"`);
8184
- }
8185
8185
  return deepElementResult;
8186
8186
  }
8187
8187
  async function findDeepElements(selector) {
@@ -8228,7 +8228,9 @@ async function findElement(selector) {
8228
8228
  const browserObject = getBrowserObject36(this);
8229
8229
  const shadowRootManager = getShadowRootManager(browserObject);
8230
8230
  if (this.isBidi && typeof selector === "string" && !selector.startsWith(DEEP_SELECTOR) && !shadowRootManager.isWithinFrame()) {
8231
- return findDeepElement.call(this, selector);
8231
+ const notFoundError = new Error(`Couldn't find element with selector "${selector}"`);
8232
+ const elem = await findDeepElement.call(this, selector);
8233
+ return getElementFromResponse(elem) ? elem : notFoundError;
8232
8234
  }
8233
8235
  if (typeof selector === "string" && selector.startsWith(DEEP_SELECTOR)) {
8234
8236
  const notFoundError = new Error(`shadow selector "${selector.slice(DEEP_SELECTOR.length)}" did not return an HTMLElement`);
@@ -48,7 +48,7 @@ export declare function transformClassicToBidiSelector(using: string, value: str
48
48
  * @param isMulti set to true if you call from `$$` command
49
49
  * @returns a list of shadow root ids with their corresponding matches or undefined if not found
50
50
  */
51
- export declare function findDeepElement(this: WebdriverIO.Browser | WebdriverIO.Element, selector: Selector): Promise<ElementReference | Error>;
51
+ export declare function findDeepElement(this: WebdriverIO.Browser | WebdriverIO.Element, selector: Selector): Promise<ElementReference | undefined>;
52
52
  /**
53
53
  * Parallel look up of a selector within multiple shadow roots
54
54
  * @param this WebdriverIO Browser or Element instance
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,MAAM,EAAe,MAAM,WAAW,CAAA;AAEpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AASvD,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAEvF,OAAO,KAAK,EAAmB,QAAQ,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAOtG,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QAAG,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;KAAE;CACnE;AAiBD;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,SAAS,GAAG,SAAS,uCAoCxD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,MAAM,gBAAgB,kBAuB5D,CAAA;AAWD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,kBAkDvE;AAED;;;;GAIG;AACH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AM,EAAE,MAAM,CAAC,EAC5B,OAAO,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,YAShC,CAAA;AAED,wBAAgB,mCAAmC,CAAE,UAAU,EAAE,QAAQ,GAAG,MAAM,UAKjF"}
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": "9.18.1",
4
+ "version": "9.18.4",
5
5
  "homepage": "https://webdriver.io",
6
6
  "author": "Christian Bromann <mail@bromann.dev>",
7
7
  "license": "MIT",
@@ -109,5 +109,5 @@
109
109
  "optional": true
110
110
  }
111
111
  },
112
- "gitHead": "3e04568bb2b087159ecd540b6c6c375c29dde0e5"
112
+ "gitHead": "a319103a2aa58659d427c7e475a97ffadab5df60"
113
113
  }