webdriverio 9.10.1 → 9.12.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/README.md CHANGED
@@ -48,8 +48,4 @@ For more information on [options](https://webdriver.io/docs/options#webdriver-op
48
48
  <a href="https://www.browserstack.com/automation-webdriverio">
49
49
  <img src="https://webdriver.io/img/sponsors/browserstack_black.svg" alt="BrowserStack" width="300" />
50
50
  </a>
51
- &nbsp;
52
- <a href="https://saucelabs.com">
53
- <img src="https://webdriver.io/img/sponsors/saucelabs_black.svg" alt="Sauce Labs" width="300" />
54
- </a>
55
51
  </p>
@@ -9,8 +9,15 @@ import type { Browser as PuppeteerBrowser } from 'puppeteer-core';
9
9
  * :::info
10
10
  *
11
11
  * Note that using Puppeteer requires support for Chrome DevTools protocol and e.g.
12
- * can not be used when running automated tests in the cloud. Find out more in the
13
- * [Automation Protocols](/docs/automationProtocols) section.
12
+ * can not be used when running automated tests in the cloud. Chrome DevTools protocol is not installed by default,
13
+ * use `npm install puppeteer-core` to install it.
14
+ * Find out more in the [Automation Protocols](/docs/automationProtocols) section.
15
+ *
16
+ * :::
17
+ *
18
+ * :::info
19
+ *
20
+ * Note: Puppeteer is currently __not__ supported when running [component tests](/docs/component-testing).
14
21
  *
15
22
  * :::
16
23
  *
@@ -1 +1 @@
1
- {"version":3,"file":"getPuppeteer.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/getPuppeteer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAa,OAAO,IAAI,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAO5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,YAAY,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAqHxF"}
1
+ {"version":3,"file":"getPuppeteer.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/getPuppeteer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAa,OAAO,IAAI,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAO5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAsB,YAAY,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA4HxF"}
@@ -3,7 +3,8 @@ import WebDriverInterception from '../../utils/interception/index.js';
3
3
  export declare const SESSION_MOCKS: Record<string, Set<WebDriverInterception>>;
4
4
  /**
5
5
  * Mock the response of a request. You can define a mock based on a matching
6
- * glob and corresponding header and status code. Calling the mock method
6
+ * [URLPattern](https://developer.mozilla.org/en-US/docs/Web/API/URLPattern)
7
+ * and corresponding header and status code. Calling the mock method
7
8
  * returns a stub object that you can use to modify the response of the
8
9
  * web resource.
9
10
  *
@@ -12,15 +13,23 @@ export declare const SESSION_MOCKS: Record<string, Set<WebDriverInterception>>;
12
13
  *
13
14
  * There are 3 ways to modify the response:
14
15
  * - return a custom JSON object (for stubbing API request)
15
- * - replace web resource with a local file (service a modified JavaScript file) or
16
+ * - replace web resource with a local file (serve a modified JavaScript file) or
16
17
  * - redirect resource to a different url
17
18
  *
18
19
  * :::info
19
20
  *
20
- * Note that using the `mock` command requires support for Chrome DevTools protocol.
21
- * That support is given if you run tests locally in Chromium based browser or if
22
- * you use a Selenium Grid v4 or higher. This command can __not__ be used when running
23
- * automated tests in the cloud. Find out more in the [Automation Protocols](/docs/automationProtocols) section.
21
+ * Note that using the `mock` command requires support for WebDriver Bidi. That is
22
+ * usually the case when running tests locally in a Chromium based browser or on
23
+ * Firefox as well as if you use a Selenium Grid v4 or higher. If you run tests
24
+ * in the cloud, make sure that your cloud provider supports WebDriver Bidi.
25
+ *
26
+ * :::
27
+ *
28
+ * :::info
29
+ *
30
+ * The `URLPattern` is an experimental technology and not yet supported in some environments, e.g. Node.js.
31
+ * We recommend to import [a polyfill](https://www.npmjs.com/package/urlpattern-polyfill)
32
+ * until the feature is more widely supported.
24
33
  *
25
34
  * :::
26
35
  *
@@ -1 +1 @@
1
- {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/mock.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,qBAAqB,MAAM,mCAAmC,CAAA;AAGrE,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,qBAAqB,CAAC,CAAM,CAAA;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;AACH,wBAAsB,IAAI,CACtB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,GAAG,EAAE,MAAM,EACX,aAAa,CAAC,EAAE,iBAAiB,GAClC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAc3B"}
1
+ {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/mock.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,qBAAqB,MAAM,mCAAmC,CAAA;AAGrE,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,qBAAqB,CAAC,CAAM,CAAA;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkHG;AACH,wBAAsB,IAAI,CACtB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,GAAG,EAAE,MAAM,EACX,aAAa,CAAC,EAAE,iBAAiB,GAClC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAc3B"}
@@ -1,3 +1,4 @@
1
+ import type { SaveScreenshotOptions } from '../../types.js';
1
2
  /**
2
3
  *
3
4
  * Save a screenshot of the current browsing context to a PNG file on your OS. Be aware that
@@ -6,9 +7,25 @@
6
7
  *
7
8
  * <example>
8
9
  :saveScreenshot.js
9
- it('should save a screenshot of the browser view', async () => {
10
+ it('should save a screenshot of the browser viewport', async () => {
10
11
  await browser.saveScreenshot('./some/path/screenshot.png');
11
12
  });
13
+
14
+ it('should save a screenshot of the full page', async () => {
15
+ await browser.saveScreenshot('./some/path/screenshot.png', { fullPage: true });
16
+ });
17
+
18
+ it('should save a screenshot of a specific rectangle', async () => {
19
+ await browser.saveScreenshot('./some/path/screenshot.png', { clip: { x: 0, y: 0, width: 100, height: 100 } });
20
+ });
21
+
22
+ it('should save a screenshot of the full page in JPEG format', async () => {
23
+ await browser.saveScreenshot('./some/path/screenshot.jpeg', { fullPage: true, format: 'jpeg' });
24
+ });
25
+
26
+ it('should save a screenshot of the full page in JPEG format with quality 50', async () => {
27
+ await browser.saveScreenshot('./some/path/screenshot.jpeg', { fullPage: true, format: 'jpeg', quality: 50 });
28
+ });
12
29
  * </example>
13
30
  *
14
31
  * When running from a hook, make sure to explicitly define the hook as async:
@@ -20,9 +37,14 @@
20
37
  * </example>
21
38
  * @alias browser.saveScreenshot
22
39
  * @param {String} filepath path to the generated image (`.png` suffix is required) relative to the execution directory
23
- * @return {Buffer} screenshot buffer
40
+ * @param {Object} options screenshot options
41
+ * @param {Boolean} [options.fullPage=false] whether to take a screenshot of the full page or just the current viewport
42
+ * @param {String} [options.format='png'] the format of the screenshot (either `png` or `jpeg`)
43
+ * @param {Number} [options.quality=100] the quality of the screenshot in case of JPEG format in range 0-100 percent
44
+ * @param {Object} [options.clip] clipping a rectangle of the screenshot
45
+ * @return {Buffer} screenshot buffer
24
46
  * @type utility
25
47
  *
26
48
  */
27
- export declare function saveScreenshot(this: WebdriverIO.Browser, filepath: string): Promise<Buffer<ArrayBuffer>>;
49
+ export declare function saveScreenshot(this: WebdriverIO.Browser, filepath: string, options?: SaveScreenshotOptions): Promise<Buffer<ArrayBuffer>>;
28
50
  //# sourceMappingURL=saveScreenshot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"saveScreenshot.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/saveScreenshot.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,cAAc,CAChC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,gCAMnB"}
1
+ {"version":3,"file":"saveScreenshot.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/saveScreenshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAsB,cAAc,CAChC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,qBAAqB,gCAMlC"}
@@ -1 +1 @@
1
- {"version":3,"file":"switchWindow.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/switchWindow.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,YAAY,CAC9B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,EAAE,MAAM,GAAG,MAAM,mBAmE3B"}
1
+ {"version":3,"file":"switchWindow.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/switchWindow.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,YAAY,CAC9B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,EAAE,MAAM,GAAG,MAAM,mBAiE3B"}
@@ -4,8 +4,9 @@
4
4
  * :::info
5
5
  *
6
6
  * Note that using the `throttleCPU` command requires support for Chrome DevTools protocol and e.g.
7
- * can not be used when running automated tests in the cloud. Find out more in the
8
- * [Automation Protocols](/docs/automationProtocols) section.
7
+ * can not be used when running automated tests in the cloud. Chrome DevTools protocol is not installed by default,
8
+ * use `npm install puppeteer-core` to install it.
9
+ * Find out more in the [Automation Protocols](/docs/automationProtocols) section.
9
10
  *
10
11
  * :::
11
12
  *
@@ -1 +1 @@
1
- {"version":3,"file":"throttleCPU.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/throttleCPU.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,wBAAsB,WAAW,CAC7B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,MAAM,EAAE,MAAM,iBAwBjB"}
1
+ {"version":3,"file":"throttleCPU.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/throttleCPU.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,wBAAsB,WAAW,CAC7B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,MAAM,EAAE,MAAM,iBAwBjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"throttleNetwork.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/throttleNetwork.ts"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAmErD,wBAAsB,eAAe,CACjC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,MAAM,EAAE,eAAe,iBAiD1B"}
1
+ {"version":3,"file":"throttleNetwork.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/throttleNetwork.ts"],"names":[],"mappings":"AA8CA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAmErD,wBAAsB,eAAe,CACjC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,MAAM,EAAE,eAAe,iBAiD1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"waitUntil.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/waitUntil.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CAAC,WAAW,EACjC,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,EAC/C,SAAS,EAAE,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,EACnD,EACI,OAAqC,EACrC,QAAuC,EACvC,UAAU,EACb,GAAE,OAAO,CAAC,gBAAgB,CAAM,GAClC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC,CAgDlE"}
1
+ {"version":3,"file":"waitUntil.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/waitUntil.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CAAC,WAAW,EACjC,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,EAC/C,SAAS,EAAE,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,EACnD,EACI,OAAqC,EACrC,QAAuC,EACvC,UAAU,EACb,GAAE,OAAO,CAAC,gBAAgB,CAAM,GAClC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC,CA8DlE"}
@@ -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,wBAAsB,gBAAgB,CAClC,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;;;;;;;;;;;;;;;;;;;;;;;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"}