webdriverio 9.0.0-alpha.78 → 9.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/build/clock.d.ts +79 -0
- package/build/clock.d.ts.map +1 -0
- package/build/commands/browser/$.d.ts.map +1 -1
- package/build/commands/browser/addInitScript.d.ts +86 -0
- package/build/commands/browser/addInitScript.d.ts.map +1 -0
- package/build/commands/browser/downloadFile.d.ts +34 -0
- package/build/commands/browser/downloadFile.d.ts.map +1 -0
- package/build/commands/browser/emulate.d.ts +11 -28
- package/build/commands/browser/emulate.d.ts.map +1 -1
- package/build/commands/browser/execute.d.ts.map +1 -1
- package/build/commands/browser/executeAsync.d.ts.map +1 -1
- package/build/commands/browser/getCookies.d.ts +2 -1
- package/build/commands/browser/getCookies.d.ts.map +1 -1
- package/build/commands/browser/getPuppeteer.d.ts.map +1 -1
- package/build/commands/browser/mock.d.ts +2 -2
- package/build/commands/browser/mock.d.ts.map +1 -1
- package/build/commands/browser/reloadSession.d.ts +20 -0
- package/build/commands/browser/reloadSession.d.ts.map +1 -1
- package/build/commands/browser/restore.d.ts +33 -0
- package/build/commands/browser/restore.d.ts.map +1 -0
- package/build/commands/browser/savePDF.d.ts +0 -1
- package/build/commands/browser/savePDF.d.ts.map +1 -1
- package/build/commands/browser/saveRecordingScreen.d.ts +0 -1
- package/build/commands/browser/saveRecordingScreen.d.ts.map +1 -1
- package/build/commands/browser/saveScreenshot.d.ts +0 -1
- package/build/commands/browser/saveScreenshot.d.ts.map +1 -1
- package/build/commands/browser/setViewport.d.ts +30 -0
- package/build/commands/browser/setViewport.d.ts.map +1 -0
- package/build/commands/browser/setWindowSize.d.ts +3 -1
- package/build/commands/browser/setWindowSize.d.ts.map +1 -1
- package/build/commands/browser/url.d.ts +119 -8
- package/build/commands/browser/url.d.ts.map +1 -1
- package/build/commands/browser.d.ts +4 -0
- package/build/commands/browser.d.ts.map +1 -1
- package/build/commands/clock/restore.d.ts +20 -0
- package/build/commands/clock/restore.d.ts.map +1 -0
- package/build/commands/clock/setSystemTime.d.ts +19 -0
- package/build/commands/clock/setSystemTime.d.ts.map +1 -0
- package/build/commands/clock/tick.d.ts +18 -0
- package/build/commands/clock/tick.d.ts.map +1 -0
- package/build/commands/constant.d.ts.map +1 -1
- package/build/commands/dialog/accept.d.ts +14 -0
- package/build/commands/dialog/accept.d.ts.map +1 -0
- package/build/commands/dialog/defaultValue.d.ts +12 -0
- package/build/commands/dialog/defaultValue.d.ts.map +1 -0
- package/build/commands/dialog/dismiss.d.ts +12 -0
- package/build/commands/dialog/dismiss.d.ts.map +1 -0
- package/build/commands/dialog/message.d.ts +13 -0
- package/build/commands/dialog/message.d.ts.map +1 -0
- package/build/commands/dialog/type.d.ts +13 -0
- package/build/commands/dialog/type.d.ts.map +1 -0
- package/build/commands/element/$$.d.ts +9 -0
- package/build/commands/element/$$.d.ts.map +1 -1
- package/build/commands/element/$.d.ts +9 -0
- package/build/commands/element/$.d.ts.map +1 -1
- package/build/commands/element/dragAndDrop.d.ts +2 -1
- package/build/commands/element/dragAndDrop.d.ts.map +1 -1
- package/build/commands/element/execute.d.ts +1 -1
- package/build/commands/element/execute.d.ts.map +1 -1
- package/build/commands/element/executeAsync.d.ts +1 -1
- package/build/commands/element/executeAsync.d.ts.map +1 -1
- package/build/commands/element/getElement.d.ts +20 -0
- package/build/commands/element/getElement.d.ts.map +1 -0
- package/build/commands/element/getElements.d.ts +20 -0
- package/build/commands/element/getElements.d.ts.map +1 -0
- package/build/commands/element/getHTML.d.ts.map +1 -1
- package/build/commands/element/getSize.d.ts.map +1 -1
- package/build/commands/element/isExisting.d.ts.map +1 -1
- package/build/commands/element/nextElement.d.ts +1 -1
- package/build/commands/element/nextElement.d.ts.map +1 -1
- package/build/commands/element/parentElement.d.ts +1 -1
- package/build/commands/element/parentElement.d.ts.map +1 -1
- package/build/commands/element/previousElement.d.ts +1 -1
- package/build/commands/element/previousElement.d.ts.map +1 -1
- package/build/commands/element/saveScreenshot.d.ts +0 -1
- package/build/commands/element/saveScreenshot.d.ts.map +1 -1
- package/build/commands/element/shadow$$.d.ts +9 -1
- package/build/commands/element/shadow$$.d.ts.map +1 -1
- package/build/commands/element/shadow$.d.ts +9 -1
- package/build/commands/element/shadow$.d.ts.map +1 -1
- package/build/commands/element.d.ts +4 -0
- package/build/commands/element.d.ts.map +1 -1
- package/build/commands/mock/redirect.d.ts +22 -0
- package/build/commands/mock/redirect.d.ts.map +1 -0
- package/build/commands/mock/request.d.ts +37 -0
- package/build/commands/mock/request.d.ts.map +1 -0
- package/build/commands/mock/requestOnce.d.ts +37 -0
- package/build/commands/mock/requestOnce.d.ts.map +1 -0
- package/build/commands/mock/restore.d.ts +1 -1
- package/build/constants.d.ts +7 -2
- package/build/constants.d.ts.map +1 -1
- package/build/deviceDescriptorsSource.d.ts +1344 -0
- package/build/deviceDescriptorsSource.d.ts.map +1 -0
- package/build/dialog.d.ts +29 -0
- package/build/dialog.d.ts.map +1 -0
- package/build/index.cjs +103 -0
- package/build/index.d.cts +2 -0
- package/build/index.d.cts.map +1 -0
- package/build/index.d.ts +6 -8
- package/build/index.d.ts.map +1 -1
- package/build/index.js +7002 -122
- package/build/middlewares.d.ts.map +1 -1
- package/build/multiremote.d.ts +1 -1
- package/build/multiremote.d.ts.map +1 -1
- package/build/networkManager.d.ts +22 -0
- package/build/networkManager.d.ts.map +1 -0
- package/build/protocol-stub.d.ts +2 -2
- package/build/protocol-stub.d.ts.map +1 -1
- package/build/scripts/customElement.d.ts.map +1 -1
- package/build/scripts/customElement.js +22 -14
- package/build/scripts/elementContains.d.ts +2 -0
- package/build/scripts/elementContains.d.ts.map +1 -0
- package/build/scripts/elementContains.js +20 -0
- package/build/scripts/getHTML.js +6 -9
- package/build/scripts/getHTMLShadow.d.ts +11 -8
- package/build/scripts/getHTMLShadow.d.ts.map +1 -1
- package/build/scripts/getHTMLShadow.js +22 -43
- package/build/scripts/getProperty.js +6 -8
- package/build/scripts/isDescendant.js +6 -2
- package/build/scripts/isElementClickable.js +93 -114
- package/build/scripts/isElementDisplayed.js +158 -218
- package/build/scripts/isElementInViewport.js +14 -18
- package/build/scripts/isElementStable.js +24 -28
- package/build/scripts/isFocused.js +6 -7
- package/build/scripts/newWindow.js +6 -10
- package/build/scripts/resq.d.ts.map +1 -1
- package/build/scripts/resq.js +41 -47
- package/build/scripts/shadowFnFactory.js +13 -7
- package/build/shadowRoot.d.ts +28 -13
- package/build/shadowRoot.d.ts.map +1 -1
- package/build/types.d.ts +98 -28
- package/build/types.d.ts.map +1 -1
- package/build/utils/actions/pointer.d.ts +3 -1
- package/build/utils/actions/pointer.d.ts.map +1 -1
- package/build/utils/actions/wheel.d.ts +1 -1
- package/build/utils/actions/wheel.d.ts.map +1 -1
- package/build/utils/bidi/constants.d.ts +66 -0
- package/build/utils/bidi/constants.d.ts.map +1 -0
- package/build/utils/bidi/index.d.ts +4 -0
- package/build/utils/bidi/index.d.ts.map +1 -0
- package/build/utils/bidi/value.d.ts +131 -0
- package/build/utils/bidi/value.d.ts.map +1 -0
- package/build/utils/detectBackend.d.ts +1 -1
- package/build/utils/detectBackend.d.ts.map +1 -1
- package/build/utils/driver.d.ts +5 -6
- package/build/utils/driver.d.ts.map +1 -1
- package/build/utils/getElementObject.d.ts +3 -3
- package/build/utils/getElementObject.d.ts.map +1 -1
- package/build/utils/index.d.ts +5 -11
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/interception/index.d.ts +19 -12
- package/build/utils/interception/index.d.ts.map +1 -1
- package/build/utils/interception/types.d.ts +0 -3
- package/build/utils/interception/types.d.ts.map +1 -1
- package/build/utils/interception/utils.d.ts +3 -8
- package/build/utils/interception/utils.d.ts.map +1 -1
- package/package.json +25 -20
- package/third_party/fake-timers.js +1846 -0
- package/build/cjs/index.d.ts +0 -2
- package/build/cjs/index.d.ts.map +0 -1
- package/build/cjs/index.js +0 -111
- package/build/cjs/package.json +0 -5
- package/build/commands/browser/$$.js +0 -99
- package/build/commands/browser/$.js +0 -100
- package/build/commands/browser/action.js +0 -13
- package/build/commands/browser/actions.js +0 -30
- package/build/commands/browser/addCommand.js +0 -37
- package/build/commands/browser/call.js +0 -48
- package/build/commands/browser/custom$$.js +0 -46
- package/build/commands/browser/custom$.js +0 -49
- package/build/commands/browser/debug.js +0 -102
- package/build/commands/browser/deleteCookies.js +0 -20
- package/build/commands/browser/emulate.js +0 -98
- package/build/commands/browser/execute.js +0 -52
- package/build/commands/browser/executeAsync.js +0 -60
- package/build/commands/browser/getCookies.js +0 -43
- package/build/commands/browser/getPuppeteer.js +0 -130
- package/build/commands/browser/getWindowSize.js +0 -24
- package/build/commands/browser/keys.js +0 -55
- package/build/commands/browser/mock.js +0 -122
- package/build/commands/browser/mockClearAll.js +0 -37
- package/build/commands/browser/mockRestoreAll.js +0 -35
- package/build/commands/browser/newWindow.js +0 -83
- package/build/commands/browser/overwriteCommand.js +0 -32
- package/build/commands/browser/pause.js +0 -24
- package/build/commands/browser/react$$.js +0 -51
- package/build/commands/browser/react$.js +0 -59
- package/build/commands/browser/reloadSession.js +0 -64
- package/build/commands/browser/savePDF.js +0 -45
- package/build/commands/browser/saveRecordingScreen.js +0 -41
- package/build/commands/browser/saveScreenshot.js +0 -50
- package/build/commands/browser/scroll.js +0 -41
- package/build/commands/browser/setCookies.js +0 -64
- package/build/commands/browser/setTimeout.js +0 -54
- package/build/commands/browser/setWindowSize.js +0 -37
- package/build/commands/browser/switchWindow.js +0 -70
- package/build/commands/browser/throttle.js +0 -11
- package/build/commands/browser/throttleCPU.js +0 -41
- package/build/commands/browser/throttleNetwork.js +0 -145
- package/build/commands/browser/touchAction.js +0 -75
- package/build/commands/browser/uploadFile.js +0 -58
- package/build/commands/browser/url.js +0 -55
- package/build/commands/browser/waitUntil.js +0 -45
- package/build/commands/browser.js +0 -39
- package/build/commands/constant.js +0 -88
- package/build/commands/element/$$.js +0 -45
- package/build/commands/element/$.js +0 -60
- package/build/commands/element/addValue.js +0 -40
- package/build/commands/element/clearValue.js +0 -29
- package/build/commands/element/click.js +0 -162
- package/build/commands/element/custom$$.js +0 -57
- package/build/commands/element/custom$.js +0 -59
- package/build/commands/element/doubleClick.js +0 -38
- package/build/commands/element/dragAndDrop.js +0 -79
- package/build/commands/element/execute.js +0 -53
- package/build/commands/element/executeAsync.js +0 -63
- package/build/commands/element/getAttribute.js +0 -29
- package/build/commands/element/getCSSProperty.js +0 -140
- package/build/commands/element/getComputedLabel.js +0 -21
- package/build/commands/element/getComputedRole.js +0 -21
- package/build/commands/element/getHTML.js +0 -168
- package/build/commands/element/getLocation.js +0 -38
- package/build/commands/element/getProperty.js +0 -19
- package/build/commands/element/getSize.js +0 -38
- package/build/commands/element/getTagName.js +0 -26
- package/build/commands/element/getText.js +0 -43
- package/build/commands/element/getValue.js +0 -29
- package/build/commands/element/isClickable.js +0 -59
- package/build/commands/element/isDisplayed.js +0 -115
- package/build/commands/element/isEnabled.js +0 -35
- package/build/commands/element/isEqual.js +0 -56
- package/build/commands/element/isExisting.js +0 -66
- package/build/commands/element/isFocused.js +0 -36
- package/build/commands/element/isSelected.js +0 -32
- package/build/commands/element/isStable.js +0 -62
- package/build/commands/element/moveTo.js +0 -49
- package/build/commands/element/nextElement.js +0 -28
- package/build/commands/element/parentElement.js +0 -28
- package/build/commands/element/previousElement.js +0 -28
- package/build/commands/element/react$$.js +0 -53
- package/build/commands/element/react$.js +0 -61
- package/build/commands/element/saveScreenshot.js +0 -34
- package/build/commands/element/scrollIntoView.js +0 -96
- package/build/commands/element/selectByAttribute.js +0 -56
- package/build/commands/element/selectByIndex.js +0 -52
- package/build/commands/element/selectByVisibleText.js +0 -63
- package/build/commands/element/setValue.js +0 -30
- package/build/commands/element/shadow$$.js +0 -43
- package/build/commands/element/shadow$.js +0 -41
- package/build/commands/element/touchAction.js +0 -68
- package/build/commands/element/waitForClickable.js +0 -34
- package/build/commands/element/waitForDisplayed.js +0 -27
- package/build/commands/element/waitForEnabled.js +0 -52
- package/build/commands/element/waitForExist.js +0 -46
- package/build/commands/element/waitForStable.js +0 -86
- package/build/commands/element/waitUntil.js +0 -28
- package/build/commands/element.js +0 -51
- package/build/commands/mock/abort.js +0 -20
- package/build/commands/mock/abortOnce.js +0 -28
- package/build/commands/mock/clear.js +0 -19
- package/build/commands/mock/respond.js +0 -55
- package/build/commands/mock/respondOnce.js +0 -56
- package/build/commands/mock/restore.js +0 -20
- package/build/constants.js +0 -150
- package/build/middlewares.js +0 -62
- package/build/multiremote.js +0 -168
- package/build/protocol-stub.js +0 -58
- package/build/shadowRoot.js +0 -126
- package/build/types.js +0 -1
- package/build/utils/SevereServiceError.js +0 -9
- package/build/utils/Timer.js +0 -110
- package/build/utils/actions/base.js +0 -66
- package/build/utils/actions/index.js +0 -5
- package/build/utils/actions/key.js +0 -42
- package/build/utils/actions/pointer.js +0 -92
- package/build/utils/actions/wheel.js +0 -20
- package/build/utils/detectBackend.js +0 -116
- package/build/utils/driver.js +0 -30
- package/build/utils/findStrategy.js +0 -327
- package/build/utils/getElementObject.js +0 -146
- package/build/utils/implicitWait.js +0 -33
- package/build/utils/index.js +0 -653
- package/build/utils/interception/index.js +0 -320
- package/build/utils/interception/types.js +0 -1
- package/build/utils/interception/utils.js +0 -87
- package/build/utils/refetchElement.js +0 -30
- package/build/utils/thirdParty/querySelectorShadowDom.js +0 -270
- /package/{LICENSE-MIT → LICENSE} +0 -0
package/build/clock.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { FakeTimerInstallOpts, InstalledClock, install } from '@sinonjs/fake-timers';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
__clock: InstalledClock;
|
|
5
|
+
__wdio_sinon: {
|
|
6
|
+
install: typeof install;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class ClockManager {
|
|
11
|
+
#private;
|
|
12
|
+
constructor(browser: WebdriverIO.Browser);
|
|
13
|
+
/**
|
|
14
|
+
* Install fake timers on the browser. If you call the `emulate` command, WebdriverIO will automatically install
|
|
15
|
+
* the fake timers for you. You can use this method to re-install the fake timers if you have called `restore`.
|
|
16
|
+
*
|
|
17
|
+
* @param options {FakeTimerInstallOpts} Options to pass to the fake clock
|
|
18
|
+
* @returns {Promise<void>}
|
|
19
|
+
*/
|
|
20
|
+
install(options?: FakeTimerInstallOpts): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Restore all overridden native functions. This is automatically called between tests, so should not
|
|
23
|
+
* generally be needed.
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* it('should restore the clock', async () => {
|
|
27
|
+
* console.log(new Date()) // returns e.g. 1722560447102
|
|
28
|
+
*
|
|
29
|
+
* const clock = await browser.emulate('clock', { now: new Date(2021, 3, 14) })
|
|
30
|
+
* console.log(await browser.execute(() => new Date().getTime())) // returns 1618383600000
|
|
31
|
+
*
|
|
32
|
+
* await clock.restore()
|
|
33
|
+
* console.log(await browser.execute(() => new Date().getTime())) // returns 1722560447102
|
|
34
|
+
* })
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @returns {Promise<void>}
|
|
38
|
+
*/
|
|
39
|
+
restore(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Move the clock the specified number of `milliseconds`. Any timers within the affected range of time will be called.
|
|
42
|
+
* @param ms {number} The number of milliseconds to move the clock.
|
|
43
|
+
*
|
|
44
|
+
* ```ts
|
|
45
|
+
* it('should move the clock', async () => {
|
|
46
|
+
* console.log(new Date()) // returns e.g. 1722560447102
|
|
47
|
+
*
|
|
48
|
+
* const clock = await browser.emulate('clock', { now: new Date(2021, 3, 14) })
|
|
49
|
+
* console.log(await browser.execute(() => new Date().getTime())) // returns 1618383600000
|
|
50
|
+
*
|
|
51
|
+
* await clock.tick(1000)
|
|
52
|
+
* console.log(await browser.execute(() => new Date().getTime())) // returns 1618383601000
|
|
53
|
+
* })
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @param {number} ms The number of milliseconds to move the clock.
|
|
57
|
+
* @returns {Promise<void>}
|
|
58
|
+
*/
|
|
59
|
+
tick(ms: number): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Change the system time to the new now. Now can be a timestamp, date object, or not passed in which defaults
|
|
62
|
+
* to 0. No timers will be called, nor will the time left before they trigger change.
|
|
63
|
+
*
|
|
64
|
+
* ```ts
|
|
65
|
+
* it('should set the system time', async () => {
|
|
66
|
+
* const clock = await browser.emulate('clock', { now: new Date(2021, 3, 14) })
|
|
67
|
+
* console.log(await browser.execute(() => new Date().getTime())) // returns 1618383600000
|
|
68
|
+
*
|
|
69
|
+
* await clock.setSystemTime(new Date(2011, 3, 15))
|
|
70
|
+
* console.log(await browser.execute(() => new Date().getTime())) // returns 1302850800000
|
|
71
|
+
* })
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @param date {Date|number} The new date to set the system time to.
|
|
75
|
+
* @returns {Promise<void>}
|
|
76
|
+
*/
|
|
77
|
+
setSystemTime(date: number | Date): Promise<void>;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=clock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../src/clock.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAIzF,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,OAAO,EAAE,cAAc,CAAA;QACvB,YAAY,EAAE;YACV,OAAO,EAAE,OAAO,OAAO,CAAA;SAC1B,CAAA;KACJ;CACJ;AAUD,qBAAa,YAAY;;gBAKT,OAAO,EAAE,WAAW,CAAC,OAAO;IAIxC;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,CAAC,EAAE,oBAAoB;IAkD5C;;;;;;;;;;;;;;;;;OAiBG;IACG,OAAO;IAKb;;;;;;;;;;;;;;;;;;OAkBG;IACG,IAAI,CAAC,EAAE,EAAE,MAAM;IAIrB;;;;;;;;;;;;;;;;OAgBG;IACG,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAI1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"$.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/$.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,wBAAsB,CAAC,CACnB,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,EAC/C,QAAQ,EAAE,QAAQ,GACnB,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"$.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/$.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,wBAAsB,CAAC,CACnB,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,EAC/C,QAAQ,EAAE,QAAQ,GACnB,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CA6B9B"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export interface InitScript<Payload = undefined> {
|
|
2
|
+
remove: () => Promise<void>;
|
|
3
|
+
on: (event: 'data', listener: (data: Payload) => void) => void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Callback to emit data from the browser back to the Node.js environment. In order to receive the
|
|
7
|
+
* data returned by the callback function you have to listen to the `data` event, e.g.
|
|
8
|
+
*
|
|
9
|
+
* ```js
|
|
10
|
+
* const script = await browser.addInitScript((emit) => {
|
|
11
|
+
* emit('hello')
|
|
12
|
+
* })
|
|
13
|
+
* script.on('data', (data) => {
|
|
14
|
+
* console.log(data) // prints: hello
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param {any} data The data to emit.
|
|
19
|
+
*/
|
|
20
|
+
type InitScriptCallback<Payload> = (data: Payload) => void;
|
|
21
|
+
type InitScriptFunction<Payload> = ((emit: InitScriptCallback<Payload>) => void | Promise<void>);
|
|
22
|
+
type InitScriptFunctionArg1<Payload, Arg1> = ((arg1: Arg1, emit: InitScriptCallback<Payload>) => void | Promise<void>);
|
|
23
|
+
type InitScriptFunctionArg2<Payload, Arg1, Arg2> = ((arg1: Arg1, arg2: Arg2, emit: InitScriptCallback<Payload>) => void | Promise<void>);
|
|
24
|
+
type InitScriptFunctionArg3<Payload, Arg1, Arg2, Arg3> = ((arg1: Arg1, arg2: Arg2, arg3: Arg3, emit: InitScriptCallback<Payload>) => void | Promise<void>);
|
|
25
|
+
type InitScriptFunctionArg4<Payload, Arg1, Arg2, Arg3, Arg4> = ((arg1: Arg1, arg2: Arg2, arg3: Arg3, arg4: Arg4, emit: InitScriptCallback<Payload>) => void | Promise<void>);
|
|
26
|
+
type InitScriptFunctionArg5<Payload, Arg1, Arg2, Arg3, Arg4, Arg5> = ((arg1: Arg1, arg2: Arg2, arg3: Arg3, arg4: Arg4, arg5: Arg5, emit: InitScriptCallback<Payload>) => void | Promise<void>);
|
|
27
|
+
/**
|
|
28
|
+
* Adds a script which would be evaluated in one of the following scenarios:
|
|
29
|
+
*
|
|
30
|
+
* - Whenever the page is navigated.
|
|
31
|
+
* - Whenever the child frame is attached or navigated. In this case, the script is evaluated in
|
|
32
|
+
* the context of the newly attached frame.
|
|
33
|
+
*
|
|
34
|
+
* The script is evaluated after the document was created but before any of its scripts were run.
|
|
35
|
+
* In order to remove the initialization script from the page again, call the function that got
|
|
36
|
+
* returned by this function.
|
|
37
|
+
*
|
|
38
|
+
* This is useful to amend the JavaScript environment, e.g. to seed Math.random.
|
|
39
|
+
*
|
|
40
|
+
* <example>
|
|
41
|
+
:addInitScript.js
|
|
42
|
+
const script = await browser.addInitScript((seed) => {
|
|
43
|
+
Math.random = () => seed
|
|
44
|
+
}, 42)
|
|
45
|
+
|
|
46
|
+
await browser.url('https://webdriver.io')
|
|
47
|
+
console.log(await browser.execute(() => Math.random())) // returns 42
|
|
48
|
+
|
|
49
|
+
await reset()
|
|
50
|
+
await browser.url('https://webdriver.io')
|
|
51
|
+
console.log(await browser.execute(() => Math.random())) // returns a random number
|
|
52
|
+
* </example>
|
|
53
|
+
*
|
|
54
|
+
* Furthermore you can also use the `emit` function to send data back to the Node.js environment.
|
|
55
|
+
* This is useful if you want to observe certain events in the browser environment, e.g.:
|
|
56
|
+
*
|
|
57
|
+
* <example>
|
|
58
|
+
:addInitScriptWithEmit.js
|
|
59
|
+
const script = await browser.addInitScript((emit) => {
|
|
60
|
+
const observer = new MutationObserver((mutations) => {
|
|
61
|
+
for (const mutation of mutations) {
|
|
62
|
+
emit(mutation.target.nodeName)
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
observer.observe(document, { childList: true, subtree: true })
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
script.on('data', (data) => {
|
|
69
|
+
console.log(data) // prints: BODY, DIV, P, ...
|
|
70
|
+
})
|
|
71
|
+
* </example>
|
|
72
|
+
*
|
|
73
|
+
* @alias browser.addInitScript
|
|
74
|
+
* @param {Function} script function to be injected as initialization script
|
|
75
|
+
* @param {number|string|boolean} args parameters for the script
|
|
76
|
+
* @type utility
|
|
77
|
+
*
|
|
78
|
+
*/
|
|
79
|
+
export declare function addInitScript<Payload>(this: WebdriverIO.Browser, script: string | InitScriptFunction<Payload>): Promise<InitScript<Payload>>;
|
|
80
|
+
export declare function addInitScript<Payload, Arg1>(this: WebdriverIO.Browser, script: string | InitScriptFunctionArg1<Payload, Arg1>, arg1: Arg1): Promise<InitScript<Payload>>;
|
|
81
|
+
export declare function addInitScript<Payload, Arg1, Arg2>(this: WebdriverIO.Browser, script: string | InitScriptFunctionArg2<Payload, Arg1, Arg2>, arg1: Arg1, arg2: Arg2): Promise<InitScript<Payload>>;
|
|
82
|
+
export declare function addInitScript<Payload, Arg1, Arg2, Arg3>(this: WebdriverIO.Browser, script: string | InitScriptFunctionArg3<Payload, Arg1, Arg2, Arg3>, arg1: Arg1, arg2: Arg2, arg3: Arg3): Promise<InitScript<Payload>>;
|
|
83
|
+
export declare function addInitScript<Payload, Arg1, Arg2, Arg3, Arg4>(this: WebdriverIO.Browser, script: string | InitScriptFunctionArg4<Payload, Arg1, Arg2, Arg3, Arg4>, arg1: Arg1, arg2: Arg2, arg3: Arg3, arg4: Arg4): Promise<InitScript<Payload>>;
|
|
84
|
+
export declare function addInitScript<Payload, Arg1, Arg2, Arg3, Arg4, Arg5>(this: WebdriverIO.Browser, script: string | InitScriptFunctionArg5<Payload, Arg1, Arg2, Arg3, Arg4, Arg5>, arg1: Arg1, arg2: Arg2, arg3: Arg3, arg4: Arg4, arg5: Arg5): Promise<InitScript<Payload>>;
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=addInitScript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addInitScript.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/addInitScript.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Download a file from the remote computer running Selenium node to local file system
|
|
4
|
+
* by using the [`downloadFile`](https://webdriver.io/docs/api/selenium#downloadFile) command.
|
|
5
|
+
*
|
|
6
|
+
* :::info
|
|
7
|
+
* Note that this command is only supported if you use a
|
|
8
|
+
* [Selenium Grid](https://www.selenium.dev/documentation/en/grid/) with Chrome, Edge or Firefox
|
|
9
|
+
* and have the `se:downloadsEnabled` flag set in the capabilities.
|
|
10
|
+
* :::
|
|
11
|
+
*
|
|
12
|
+
* <example>
|
|
13
|
+
:downloadFile.js
|
|
14
|
+
it('should download a file', async () => {
|
|
15
|
+
await browser.url('https://www.selenium.dev/selenium/web/downloads/download.html')
|
|
16
|
+
await $('#file-1').click()
|
|
17
|
+
await browser.waitUntil(async function () {
|
|
18
|
+
return (await browser.getDownloadableFiles()).names.includes('file_1.txt')
|
|
19
|
+
}, {timeout: 5000})
|
|
20
|
+
const files = await browser.getDownloadableFiles()
|
|
21
|
+
const downloaded = await browser.downloadFile(files.names[0], process.cwd())
|
|
22
|
+
await browser.deleteDownloadableFiles()
|
|
23
|
+
})
|
|
24
|
+
* </example>
|
|
25
|
+
*
|
|
26
|
+
* @alias browser.downloadFile
|
|
27
|
+
* @param {string} fileName remote path to file
|
|
28
|
+
* @param {string} targetDirectory target location on local computer
|
|
29
|
+
* @type utility
|
|
30
|
+
* @uses protocol/download
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
export declare function downloadFile(this: WebdriverIO.Browser, fileName: string, targetDirectory: string): Promise<object>;
|
|
34
|
+
//# sourceMappingURL=downloadFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"downloadFile.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/downloadFile.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,YAAY,CAC9B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,GACxB,OAAO,CAAC,MAAM,CAAC,CAgDjB"}
|
|
@@ -1,30 +1,13 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* Read more on this in the [Emulation](/docs/emulation) guidelines.
|
|
13
|
-
*
|
|
14
|
-
* :::info
|
|
15
|
-
*
|
|
16
|
-
* This feature requires WebDriver Bidi support for the browser. While recent versions of Chrome, Edge
|
|
17
|
-
* and Firefox have such support, Safari __does not__. For updates follow [wpt.fyi](https://wpt.fyi/results/webdriver/tests/bidi/script/add_preload_script/add_preload_script.py?label=experimental&label=master&aligned).
|
|
18
|
-
* Furthermore if you use a cloud vendor for spawning browsers, make sure your vendor also supports WebDriver Bidi.
|
|
19
|
-
*
|
|
20
|
-
* :::
|
|
21
|
-
*
|
|
22
|
-
* @param {string} scope feature of the browser you like to emulate, can be either `geolocation`, `userAgent`, `colorScheme` or `onLine`
|
|
23
|
-
* @param {EmulationOptions} options emulation option for specific scope
|
|
24
|
-
* @example https://github.com/webdriverio/example-recipes/blob/9bff2baf8a0678c6886f8591d9fc8dea201895d3/emulate/example.js#L4-L18
|
|
25
|
-
* @example https://github.com/webdriverio/example-recipes/blob/9bff2baf8a0678c6886f8591d9fc8dea201895d3/emulate/example.js#L20-L36
|
|
26
|
-
* @returns `void`
|
|
27
|
-
*/
|
|
28
|
-
export declare function emulate<Scope extends SupportedScopes>(this: WebdriverIO.Browser, scope: Scope, options: EmulationOptions[Scope]): Promise<void>;
|
|
1
|
+
import type { FakeTimerInstallOpts } from '@sinonjs/fake-timers';
|
|
2
|
+
import { ClockManager } from '../../clock.js';
|
|
3
|
+
import { type DeviceName } from '../../deviceDescriptorsSource.js';
|
|
4
|
+
type RestoreFunction = () => Promise<any>;
|
|
5
|
+
type ColorScheme = 'light' | 'dark';
|
|
6
|
+
export declare function emulate(scope: 'clock', options?: FakeTimerInstallOpts): Promise<ClockManager>;
|
|
7
|
+
export declare function emulate(scope: 'geolocation', geolocation: Partial<GeolocationCoordinates>): Promise<RestoreFunction>;
|
|
8
|
+
export declare function emulate(scope: 'userAgent', userAgent: string): Promise<RestoreFunction>;
|
|
9
|
+
export declare function emulate(scope: 'device', userAgent: DeviceName): Promise<RestoreFunction>;
|
|
10
|
+
export declare function emulate(scope: 'colorScheme', colorScheme: ColorScheme): Promise<RestoreFunction>;
|
|
11
|
+
export declare function emulate(scope: 'onLine', state: boolean): Promise<RestoreFunction>;
|
|
29
12
|
export {};
|
|
30
13
|
//# sourceMappingURL=emulate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emulate.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/emulate.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG,
|
|
1
|
+
{"version":3,"file":"emulate.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/emulate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAA2B,KAAK,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAI3F,KAAK,eAAe,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAA;AACzC,KAAK,WAAW,GAAG,OAAO,GAAG,MAAM,CAAA;AAqBnC,wBAAsB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;AACpG,wBAAsB,OAAO,CAAC,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;AAC3H,wBAAsB,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;AAC9F,wBAAsB,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;AAC/F,wBAAsB,OAAO,CAAC,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;AACvG,wBAAsB,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/execute.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/execute.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,OAAO,CAAC,WAAW,EAAE,cAAc,SAAS,GAAG,EAAE,EACnE,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,kBAAkB,EAChF,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,SAAS,EAAE,cAAc,KAAK,WAAW,CAAC,EAChE,GAAG,IAAI,EAAE,cAAc,GACxB,OAAO,CAAC,WAAW,CAAC,CA8BtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeAsync.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/executeAsync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"executeAsync.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/executeAsync.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAsB,YAAY,CAAC,WAAW,EAAE,cAAc,SAAS,GAAG,EAAE,EACxE,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,EAC/C,MAAM,EACF,MAAM,GACN,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC,EACjG,GAAG,IAAI,EAAE,cAAc,GACxB,OAAO,CAAC,WAAW,CAAC,CA8BtB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Cookie } from '@wdio/protocols';
|
|
1
2
|
/**
|
|
2
3
|
*
|
|
3
4
|
* Retrieve a [cookie](https://w3c.github.io/webdriver/webdriver-spec.html#cookies)
|
|
@@ -30,5 +31,5 @@
|
|
|
30
31
|
* @uses webdriver/getAllCookies
|
|
31
32
|
*
|
|
32
33
|
*/
|
|
33
|
-
export declare function getCookies(this: WebdriverIO.Browser, names?: string | string[]): Promise<
|
|
34
|
+
export declare function getCookies(this: WebdriverIO.Browser, names?: string | string[]): Promise<Cookie[]>;
|
|
34
35
|
//# sourceMappingURL=getCookies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCookies.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/getCookies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,UAAU,CAC5B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"getCookies.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/getCookies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,UAAU,CAC5B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAC1B,OAAO,CAAC,MAAM,EAAE,CAAC,CAanB"}
|
|
@@ -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;AAM5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,YAAY,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,
|
|
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;AAM5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,YAAY,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAwGxF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MockFilterOptions } from '../../utils/interception/types.js';
|
|
2
2
|
import WebDriverInterception from '../../utils/interception/index.js';
|
|
3
3
|
export declare const SESSION_MOCKS: Record<string, Set<WebDriverInterception>>;
|
|
4
4
|
/**
|
|
@@ -107,5 +107,5 @@ export declare const SESSION_MOCKS: Record<string, Set<WebDriverInterception>>;
|
|
|
107
107
|
* @type utility
|
|
108
108
|
*
|
|
109
109
|
*/
|
|
110
|
-
export declare function mock(this: WebdriverIO.Browser, url: string, filterOptions?:
|
|
110
|
+
export declare function mock(this: WebdriverIO.Browser, url: string, filterOptions?: MockFilterOptions): Promise<WebdriverIO.Mock>;
|
|
111
111
|
//# sourceMappingURL=mock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/mock.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
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;AAErE,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,CAa3B"}
|
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
* Be careful though, this command affects your test time tremendously since spawning
|
|
7
7
|
* new Selenium sessions is very time consuming especially when using cloud services.
|
|
8
8
|
*
|
|
9
|
+
* Connection parameters such as hostname, port, protocol, etc. can be added along side
|
|
10
|
+
* browserName when you want to connect to a different remote service. This is useful
|
|
11
|
+
* in a situation, for example, where you start a test in native app and need to verify
|
|
12
|
+
* data in web app.
|
|
13
|
+
*
|
|
14
|
+
* If you start from remote service, you can pass in 0.0.0.0 for hostname if you want
|
|
15
|
+
* to switch to local drivers.
|
|
16
|
+
*
|
|
9
17
|
* <example>
|
|
10
18
|
:reloadSync.js
|
|
11
19
|
it('should reload my session with current capabilities', async () => {
|
|
@@ -21,6 +29,18 @@
|
|
|
21
29
|
})
|
|
22
30
|
console.log(browser.capabilities.browserName) // outputs: firefox
|
|
23
31
|
})
|
|
32
|
+
|
|
33
|
+
it('should reload my session with new remote', async () => {
|
|
34
|
+
console.log(browser.capabilities.browserName) // outputs: chrome
|
|
35
|
+
await browser.reloadSession({
|
|
36
|
+
protocol: 'https',
|
|
37
|
+
host: '0.0.0.1',
|
|
38
|
+
port: 4444,
|
|
39
|
+
path: '/wd/hub',
|
|
40
|
+
browserName: 'firefox'
|
|
41
|
+
})
|
|
42
|
+
console.log(browser.capabilities.browserName) // outputs: firefox
|
|
43
|
+
})
|
|
24
44
|
* </example>
|
|
25
45
|
*
|
|
26
46
|
* @alias browser.reloadSession
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reloadSession.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/reloadSession.ts"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"reloadSession.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/reloadSession.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAsB,aAAa,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,EAAE,eAAe,CAAC,EAAE,WAAW,CAAC,YAAY,mBAoCzG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SupportedScopes } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* This command restores specific or all emulated behaviors that were set using the `emulate` command.
|
|
5
|
+
*
|
|
6
|
+
* <example>
|
|
7
|
+
:restore.js
|
|
8
|
+
before(async () => {
|
|
9
|
+
await browser.emulate('geolocation', { latitude: 52.52, longitude: 13.405 })
|
|
10
|
+
await browser.emulate('userAgent', 'foobar')
|
|
11
|
+
await browser.emulate('colorScheme', 'dark')
|
|
12
|
+
await browser.emulate('onLine', false)
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
it('should restore all emulated behavior', async () => {
|
|
16
|
+
await browser.url('https://webdriver.io')
|
|
17
|
+
// test within an emulated environment...
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
after(async () => {
|
|
21
|
+
// restore all emulated behavior
|
|
22
|
+
await browser.restore()
|
|
23
|
+
// or only restore specific emulated behavior
|
|
24
|
+
// await browser.restore(['geolocation', 'userAgent'])
|
|
25
|
+
})
|
|
26
|
+
* </example>
|
|
27
|
+
*
|
|
28
|
+
* @alias browser.restore
|
|
29
|
+
* @type utility
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
export declare function restore(this: WebdriverIO.Browser, scopes?: SupportedScopes | SupportedScopes[]): Promise<void>;
|
|
33
|
+
//# sourceMappingURL=restore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restore.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/restore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAGrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,OAAO,CACzB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,MAAM,CAAC,EAAE,eAAe,GAAG,eAAe,EAAE,iBAc/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"savePDF.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/savePDF.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"savePDF.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/savePDF.ts"],"names":[],"mappings":"AAGA,KAAK,eAAe,GAAG;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACxB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,OAAO,CACzB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,eAAe,mBAmB5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveRecordingScreen.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/saveRecordingScreen.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"saveRecordingScreen.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/saveRecordingScreen.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,mBAAmB,CACrC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,mBAiBnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveScreenshot.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/saveScreenshot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"saveScreenshot.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/saveScreenshot.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,cAAc,CAChC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,mBAwBnB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface SetViewportOptions {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
devicePixelRatio?: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Resizes the browser viewport within the browser. As oppose to `setWindowSize`,
|
|
8
|
+
* this command changes the viewport size, not the window size.
|
|
9
|
+
*
|
|
10
|
+
* <example>
|
|
11
|
+
* :setWindowSize.js
|
|
12
|
+
it('should set viewport to emulate iPhone 15', async () => {
|
|
13
|
+
await browser.setWindowSize({
|
|
14
|
+
width: 393,
|
|
15
|
+
height: 659,
|
|
16
|
+
deviceScaleFactor: 3
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
* </example>
|
|
20
|
+
*
|
|
21
|
+
* @alias browser.setWindowSize
|
|
22
|
+
* @param {SetViewportOptions} options command arguments
|
|
23
|
+
* @param {number} options.width viewport width in pixels
|
|
24
|
+
* @param {number} options.height viewport height in pixels
|
|
25
|
+
* @param {number} options.devicePixelRatio pixel ratio of the viewport
|
|
26
|
+
* @return {Promise<void>}
|
|
27
|
+
* @type window
|
|
28
|
+
*/
|
|
29
|
+
export declare function setViewport(this: WebdriverIO.Browser, options: SetViewportOptions): Promise<void>;
|
|
30
|
+
//# sourceMappingURL=setViewport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setViewport.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/setViewport.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,WAAW,CAC7B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,EAAE,kBAAkB,iBA+B9B"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
|
-
* Resizes browser window outer size according to provided width and height.
|
|
3
|
+
* Resizes browser window outer size according to provided width and height. Based on your operating
|
|
4
|
+
* system some browser windows might now allow you so have a smaller width than `500px`. If you want
|
|
5
|
+
* to mimic the viewport of e.g. an iPhone you should consider using the `setViewport` command.
|
|
4
6
|
*
|
|
5
7
|
* <example>
|
|
6
8
|
* :setWindowSize.js
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setWindowSize.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/setWindowSize.ts"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"setWindowSize.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/setWindowSize.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,aAAa,CAC/B,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,iBAmBjB"}
|