webdriverio 7.16.16 → 7.17.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/package.json +7 -7
- package/build/commands/browser/$$.d.ts +0 -50
- package/build/commands/browser/$$.d.ts.map +0 -1
- package/build/commands/browser/$$.js +0 -57
- package/build/commands/browser/$.d.ts +0 -77
- package/build/commands/browser/$.d.ts.map +0 -1
- package/build/commands/browser/$.js +0 -91
- package/build/commands/browser/addCommand.d.ts +0 -37
- package/build/commands/browser/addCommand.d.ts.map +0 -1
- package/build/commands/browser/addCommand.js +0 -37
- package/build/commands/browser/call.d.ts +0 -42
- package/build/commands/browser/call.d.ts.map +0 -1
- package/build/commands/browser/call.js +0 -49
- package/build/commands/browser/custom$$.d.ts +0 -26
- package/build/commands/browser/custom$$.d.ts.map +0 -1
- package/build/commands/browser/custom$$.js +0 -47
- package/build/commands/browser/custom$.d.ts +0 -25
- package/build/commands/browser/custom$.d.ts.map +0 -1
- package/build/commands/browser/custom$.js +0 -47
- package/build/commands/browser/debug.d.ts +0 -32
- package/build/commands/browser/debug.d.ts.map +0 -1
- package/build/commands/browser/debug.js +0 -108
- package/build/commands/browser/deleteCookies.d.ts +0 -45
- package/build/commands/browser/deleteCookies.d.ts.map +0 -1
- package/build/commands/browser/deleteCookies.js +0 -56
- package/build/commands/browser/execute.d.ts +0 -37
- package/build/commands/browser/execute.d.ts.map +0 -1
- package/build/commands/browser/execute.js +0 -55
- package/build/commands/browser/executeAsync.d.ts +0 -45
- package/build/commands/browser/executeAsync.d.ts.map +0 -1
- package/build/commands/browser/executeAsync.js +0 -63
- package/build/commands/browser/getCookies.d.ts +0 -34
- package/build/commands/browser/getCookies.d.ts.map +0 -1
- package/build/commands/browser/getCookies.js +0 -46
- package/build/commands/browser/getPuppeteer.d.ts +0 -38
- package/build/commands/browser/getPuppeteer.d.ts.map +0 -1
- package/build/commands/browser/getPuppeteer.js +0 -119
- package/build/commands/browser/getWindowSize.d.ts +0 -25
- package/build/commands/browser/getWindowSize.d.ts.map +0 -1
- package/build/commands/browser/getWindowSize.js +0 -30
- package/build/commands/browser/keys.d.ts +0 -28
- package/build/commands/browser/keys.d.ts.map +0 -1
- package/build/commands/browser/keys.js +0 -64
- package/build/commands/browser/mock.d.ts +0 -111
- package/build/commands/browser/mock.d.ts.map +0 -1
- package/build/commands/browser/mock.js +0 -164
- package/build/commands/browser/mockClearAll.d.ts +0 -28
- package/build/commands/browser/mockClearAll.d.ts.map +0 -1
- package/build/commands/browser/mockClearAll.js +0 -43
- package/build/commands/browser/mockRestoreAll.d.ts +0 -26
- package/build/commands/browser/mockRestoreAll.d.ts.map +0 -1
- package/build/commands/browser/mockRestoreAll.js +0 -41
- package/build/commands/browser/newWindow.d.ts +0 -41
- package/build/commands/browser/newWindow.d.ts.map +0 -1
- package/build/commands/browser/newWindow.js +0 -83
- package/build/commands/browser/overwriteCommand.d.ts +0 -32
- package/build/commands/browser/overwriteCommand.d.ts.map +0 -1
- package/build/commands/browser/overwriteCommand.js +0 -32
- package/build/commands/browser/pause.d.ts +0 -23
- package/build/commands/browser/pause.d.ts.map +0 -1
- package/build/commands/browser/pause.js +0 -27
- package/build/commands/browser/react$$.d.ts +0 -36
- package/build/commands/browser/react$$.d.ts.map +0 -1
- package/build/commands/browser/react$$.js +0 -51
- package/build/commands/browser/react$.d.ts +0 -46
- package/build/commands/browser/react$.d.ts.map +0 -1
- package/build/commands/browser/react$.js +0 -59
- package/build/commands/browser/reloadSession.d.ts +0 -23
- package/build/commands/browser/reloadSession.d.ts.map +0 -1
- package/build/commands/browser/reloadSession.js +0 -58
- package/build/commands/browser/savePDF.d.ts +0 -46
- package/build/commands/browser/savePDF.d.ts.map +0 -1
- package/build/commands/browser/savePDF.js +0 -51
- package/build/commands/browser/saveRecordingScreen.d.ts +0 -28
- package/build/commands/browser/saveRecordingScreen.d.ts.map +0 -1
- package/build/commands/browser/saveRecordingScreen.js +0 -47
- package/build/commands/browser/saveScreenshot.d.ts +0 -22
- package/build/commands/browser/saveScreenshot.d.ts.map +0 -1
- package/build/commands/browser/saveScreenshot.js +0 -41
- package/build/commands/browser/setCookies.d.ts +0 -57
- package/build/commands/browser/setCookies.d.ts.map +0 -1
- package/build/commands/browser/setCookies.js +0 -66
- package/build/commands/browser/setTimeout.d.ts +0 -31
- package/build/commands/browser/setTimeout.d.ts.map +0 -1
- package/build/commands/browser/setTimeout.js +0 -61
- package/build/commands/browser/setWindowSize.d.ts +0 -20
- package/build/commands/browser/setWindowSize.d.ts.map +0 -1
- package/build/commands/browser/setWindowSize.js +0 -43
- package/build/commands/browser/switchWindow.d.ts +0 -30
- package/build/commands/browser/switchWindow.d.ts.map +0 -1
- package/build/commands/browser/switchWindow.js +0 -73
- package/build/commands/browser/throttle.d.ts +0 -3
- package/build/commands/browser/throttle.d.ts.map +0 -1
- package/build/commands/browser/throttle.js +0 -144
- package/build/commands/browser/touchAction.d.ts +0 -61
- package/build/commands/browser/touchAction.d.ts.map +0 -1
- package/build/commands/browser/touchAction.js +0 -65
- package/build/commands/browser/uploadFile.d.ts +0 -32
- package/build/commands/browser/uploadFile.d.ts.map +0 -1
- package/build/commands/browser/uploadFile.js +0 -63
- package/build/commands/browser/url.d.ts +0 -38
- package/build/commands/browser/url.d.ts.map +0 -1
- package/build/commands/browser/url.js +0 -49
- package/build/commands/browser/waitUntil.d.ts +0 -44
- package/build/commands/browser/waitUntil.d.ts.map +0 -1
- package/build/commands/browser/waitUntil.js +0 -73
- package/build/commands/browser.d.ts +0 -70
- package/build/commands/browser.d.ts.map +0 -1
- package/build/commands/browser.js +0 -44
- package/build/commands/constant.d.ts +0 -19
- package/build/commands/constant.d.ts.map +0 -1
- package/build/commands/constant.js +0 -91
- package/build/commands/element/$$.d.ts +0 -46
- package/build/commands/element/$$.d.ts.map +0 -1
- package/build/commands/element/$$.js +0 -50
- package/build/commands/element/$.d.ts +0 -72
- package/build/commands/element/$.d.ts.map +0 -1
- package/build/commands/element/$.js +0 -76
- package/build/commands/element/addValue.d.ts +0 -33
- package/build/commands/element/addValue.d.ts.map +0 -1
- package/build/commands/element/addValue.js +0 -48
- package/build/commands/element/clearValue.d.ts +0 -28
- package/build/commands/element/clearValue.d.ts.map +0 -1
- package/build/commands/element/clearValue.js +0 -32
- package/build/commands/element/click.d.ts +0 -73
- package/build/commands/element/click.d.ts.map +0 -1
- package/build/commands/element/click.js +0 -134
- package/build/commands/element/custom$$.d.ts +0 -28
- package/build/commands/element/custom$$.d.ts.map +0 -1
- package/build/commands/element/custom$$.js +0 -57
- package/build/commands/element/custom$.d.ts +0 -27
- package/build/commands/element/custom$.d.ts.map +0 -1
- package/build/commands/element/custom$.js +0 -57
- package/build/commands/element/doubleClick.d.ts +0 -25
- package/build/commands/element/doubleClick.d.ts.map +0 -1
- package/build/commands/element/doubleClick.js +0 -51
- package/build/commands/element/dragAndDrop.d.ts +0 -41
- package/build/commands/element/dragAndDrop.d.ts.map +0 -1
- package/build/commands/element/dragAndDrop.js +0 -98
- package/build/commands/element/getAttribute.d.ts +0 -28
- package/build/commands/element/getAttribute.d.ts.map +0 -1
- package/build/commands/element/getAttribute.js +0 -32
- package/build/commands/element/getCSSProperty.d.ts +0 -71
- package/build/commands/element/getCSSProperty.d.ts.map +0 -1
- package/build/commands/element/getCSSProperty.js +0 -108
- package/build/commands/element/getComputedLabel.d.ts +0 -20
- package/build/commands/element/getComputedLabel.d.ts.map +0 -1
- package/build/commands/element/getComputedLabel.js +0 -24
- package/build/commands/element/getComputedRole.d.ts +0 -20
- package/build/commands/element/getComputedRole.d.ts.map +0 -1
- package/build/commands/element/getComputedRole.js +0 -24
- package/build/commands/element/getHTML.d.ts +0 -32
- package/build/commands/element/getHTML.d.ts.map +0 -1
- package/build/commands/element/getHTML.js +0 -46
- package/build/commands/element/getLocation.d.ts +0 -6
- package/build/commands/element/getLocation.d.ts.map +0 -1
- package/build/commands/element/getLocation.js +0 -46
- package/build/commands/element/getProperty.d.ts +0 -53
- package/build/commands/element/getProperty.d.ts.map +0 -1
- package/build/commands/element/getProperty.js +0 -31
- package/build/commands/element/getSize.d.ts +0 -6
- package/build/commands/element/getSize.d.ts.map +0 -1
- package/build/commands/element/getSize.js +0 -47
- package/build/commands/element/getTagName.d.ts +0 -25
- package/build/commands/element/getTagName.d.ts.map +0 -1
- package/build/commands/element/getTagName.js +0 -29
- package/build/commands/element/getText.d.ts +0 -42
- package/build/commands/element/getText.d.ts.map +0 -1
- package/build/commands/element/getText.js +0 -46
- package/build/commands/element/getValue.d.ts +0 -25
- package/build/commands/element/getValue.d.ts.map +0 -1
- package/build/commands/element/getValue.js +0 -33
- package/build/commands/element/isClickable.d.ts +0 -40
- package/build/commands/element/isClickable.d.ts.map +0 -1
- package/build/commands/element/isClickable.js +0 -57
- package/build/commands/element/isDisplayed.d.ts +0 -50
- package/build/commands/element/isDisplayed.d.ts.map +0 -1
- package/build/commands/element/isDisplayed.js +0 -85
- package/build/commands/element/isDisplayedInViewport.d.ts +0 -38
- package/build/commands/element/isDisplayedInViewport.d.ts.map +0 -1
- package/build/commands/element/isDisplayedInViewport.js +0 -55
- package/build/commands/element/isEnabled.d.ts +0 -34
- package/build/commands/element/isEnabled.d.ts.map +0 -1
- package/build/commands/element/isEnabled.js +0 -38
- package/build/commands/element/isEqual.d.ts +0 -24
- package/build/commands/element/isEqual.d.ts.map +0 -1
- package/build/commands/element/isEqual.js +0 -52
- package/build/commands/element/isExisting.d.ts +0 -49
- package/build/commands/element/isExisting.d.ts.map +0 -1
- package/build/commands/element/isExisting.js +0 -65
- package/build/commands/element/isFocused.d.ts +0 -28
- package/build/commands/element/isFocused.d.ts.map +0 -1
- package/build/commands/element/isFocused.js +0 -42
- package/build/commands/element/isSelected.d.ts +0 -31
- package/build/commands/element/isSelected.d.ts.map +0 -1
- package/build/commands/element/isSelected.js +0 -35
- package/build/commands/element/moveTo.d.ts +0 -21
- package/build/commands/element/moveTo.d.ts.map +0 -1
- package/build/commands/element/moveTo.js +0 -39
- package/build/commands/element/nextElement.d.ts +0 -25
- package/build/commands/element/nextElement.d.ts.map +0 -1
- package/build/commands/element/nextElement.js +0 -31
- package/build/commands/element/parentElement.d.ts +0 -25
- package/build/commands/element/parentElement.d.ts.map +0 -1
- package/build/commands/element/parentElement.js +0 -31
- package/build/commands/element/previousElement.d.ts +0 -25
- package/build/commands/element/previousElement.d.ts.map +0 -1
- package/build/commands/element/previousElement.js +0 -31
- package/build/commands/element/react$$.d.ts +0 -36
- package/build/commands/element/react$$.d.ts.map +0 -1
- package/build/commands/element/react$$.js +0 -51
- package/build/commands/element/react$.d.ts +0 -46
- package/build/commands/element/react$.d.ts.map +0 -1
- package/build/commands/element/react$.js +0 -59
- package/build/commands/element/saveScreenshot.d.ts +0 -21
- package/build/commands/element/saveScreenshot.d.ts.map +0 -1
- package/build/commands/element/saveScreenshot.js +0 -40
- package/build/commands/element/scrollIntoView.d.ts +0 -21
- package/build/commands/element/scrollIntoView.d.ts.map +0 -1
- package/build/commands/element/scrollIntoView.js +0 -31
- package/build/commands/element/selectByAttribute.d.ts +0 -37
- package/build/commands/element/selectByAttribute.d.ts.map +0 -1
- package/build/commands/element/selectByAttribute.js +0 -59
- package/build/commands/element/selectByIndex.d.ts +0 -31
- package/build/commands/element/selectByIndex.d.ts.map +0 -1
- package/build/commands/element/selectByIndex.js +0 -55
- package/build/commands/element/selectByVisibleText.d.ts +0 -31
- package/build/commands/element/selectByVisibleText.d.ts.map +0 -1
- package/build/commands/element/selectByVisibleText.js +0 -66
- package/build/commands/element/setValue.d.ts +0 -29
- package/build/commands/element/setValue.d.ts.map +0 -1
- package/build/commands/element/setValue.js +0 -33
- package/build/commands/element/shadow$$.d.ts +0 -22
- package/build/commands/element/shadow$$.d.ts.map +0 -1
- package/build/commands/element/shadow$$.js +0 -27
- package/build/commands/element/shadow$.d.ts +0 -22
- package/build/commands/element/shadow$.d.ts.map +0 -1
- package/build/commands/element/shadow$.js +0 -27
- package/build/commands/element/touchAction.d.ts +0 -54
- package/build/commands/element/touchAction.d.ts.map +0 -1
- package/build/commands/element/touchAction.js +0 -58
- package/build/commands/element/waitForClickable.d.ts +0 -34
- package/build/commands/element/waitForClickable.d.ts.map +0 -1
- package/build/commands/element/waitForClickable.js +0 -37
- package/build/commands/element/waitForDisplayed.d.ts +0 -44
- package/build/commands/element/waitForDisplayed.d.ts.map +0 -1
- package/build/commands/element/waitForDisplayed.js +0 -47
- package/build/commands/element/waitForEnabled.d.ts +0 -46
- package/build/commands/element/waitForEnabled.d.ts.map +0 -1
- package/build/commands/element/waitForEnabled.js +0 -55
- package/build/commands/element/waitForExist.d.ts +0 -46
- package/build/commands/element/waitForExist.d.ts.map +0 -1
- package/build/commands/element/waitForExist.js +0 -49
- package/build/commands/element/waitUntil.d.ts +0 -49
- package/build/commands/element/waitUntil.d.ts.map +0 -1
- package/build/commands/element/waitUntil.js +0 -53
- package/build/commands/element.d.ts +0 -100
- package/build/commands/element.d.ts.map +0 -1
- package/build/commands/element.js +0 -63
- package/build/commands/mock/abort.d.ts +0 -19
- package/build/commands/mock/abort.d.ts.map +0 -1
- package/build/commands/mock/abort.js +0 -20
- package/build/commands/mock/abortOnce.d.ts +0 -27
- package/build/commands/mock/abortOnce.d.ts.map +0 -1
- package/build/commands/mock/abortOnce.js +0 -28
- package/build/commands/mock/clear.d.ts +0 -18
- package/build/commands/mock/clear.d.ts.map +0 -1
- package/build/commands/mock/clear.js +0 -19
- package/build/commands/mock/respond.d.ts +0 -54
- package/build/commands/mock/respond.d.ts.map +0 -1
- package/build/commands/mock/respond.js +0 -55
- package/build/commands/mock/respondOnce.d.ts +0 -55
- package/build/commands/mock/respondOnce.d.ts.map +0 -1
- package/build/commands/mock/respondOnce.js +0 -56
- package/build/commands/mock/restore.d.ts +0 -18
- package/build/commands/mock/restore.d.ts.map +0 -1
- package/build/commands/mock/restore.js +0 -19
- package/build/constants.d.ts +0 -14
- package/build/constants.d.ts.map +0 -1
- package/build/constants.js +0 -286
- package/build/index.d.ts +0 -45
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -171
- package/build/middlewares.d.ts +0 -12
- package/build/middlewares.d.ts.map +0 -1
- package/build/middlewares.js +0 -65
- package/build/multiremote.d.ts +0 -71
- package/build/multiremote.d.ts.map +0 -1
- package/build/multiremote.js +0 -160
- package/build/protocol-stub.d.ts +0 -16
- package/build/protocol-stub.d.ts.map +0 -1
- package/build/protocol-stub.js +0 -77
- package/build/scripts/getHTML.d.ts +0 -9
- package/build/scripts/getHTML.d.ts.map +0 -1
- package/build/scripts/getHTML.js +0 -13
- package/build/scripts/getProperty.d.ts +0 -43
- package/build/scripts/getProperty.d.ts.map +0 -1
- package/build/scripts/getProperty.js +0 -12
- package/build/scripts/isElementClickable.d.ts +0 -7
- package/build/scripts/isElementClickable.d.ts.map +0 -1
- package/build/scripts/isElementClickable.js +0 -121
- package/build/scripts/isElementDisplayed.d.ts +0 -7
- package/build/scripts/isElementDisplayed.d.ts.map +0 -1
- package/build/scripts/isElementDisplayed.js +0 -216
- package/build/scripts/isElementInViewport.d.ts +0 -10
- package/build/scripts/isElementInViewport.d.ts.map +0 -1
- package/build/scripts/isElementInViewport.js +0 -22
- package/build/scripts/isFocused.d.ts +0 -7
- package/build/scripts/isFocused.d.ts.map +0 -1
- package/build/scripts/isFocused.js +0 -11
- package/build/scripts/newWindow.d.ts +0 -10
- package/build/scripts/newWindow.d.ts.map +0 -1
- package/build/scripts/newWindow.js +0 -14
- package/build/scripts/resq.d.ts +0 -6
- package/build/scripts/resq.d.ts.map +0 -1
- package/build/scripts/resq.js +0 -58
- package/build/scripts/shadowFnFactory.d.ts +0 -2
- package/build/scripts/shadowFnFactory.d.ts.map +0 -1
- package/build/scripts/shadowFnFactory.js +0 -17
- package/build/types.d.ts +0 -402
- package/build/types.d.ts.map +0 -1
- package/build/types.js +0 -2
- package/build/utils/SevereServiceError.d.ts +0 -7
- package/build/utils/SevereServiceError.d.ts.map +0 -1
- package/build/utils/SevereServiceError.js +0 -12
- package/build/utils/Timer.d.ts +0 -33
- package/build/utils/Timer.d.ts.map +0 -1
- package/build/utils/Timer.js +0 -126
- package/build/utils/detectBackend.d.ts +0 -23
- package/build/utils/detectBackend.d.ts.map +0 -1
- package/build/utils/detectBackend.js +0 -119
- package/build/utils/findStrategy.d.ts +0 -10
- package/build/utils/findStrategy.d.ts.map +0 -1
- package/build/utils/findStrategy.js +0 -267
- package/build/utils/getElementObject.d.ts +0 -17
- package/build/utils/getElementObject.d.ts.map +0 -1
- package/build/utils/getElementObject.js +0 -107
- package/build/utils/implicitWait.d.ts +0 -7
- package/build/utils/implicitWait.d.ts.map +0 -1
- package/build/utils/implicitWait.js +0 -39
- package/build/utils/index.d.ts +0 -102
- package/build/utils/index.d.ts.map +0 -1
- package/build/utils/index.js +0 -543
- package/build/utils/interception/devtools.d.ts +0 -61
- package/build/utils/interception/devtools.d.ts.map +0 -1
- package/build/utils/interception/devtools.js +0 -247
- package/build/utils/interception/index.d.ts +0 -26
- package/build/utils/interception/index.d.ts.map +0 -1
- package/build/utils/interception/index.js +0 -49
- package/build/utils/interception/types.d.ts +0 -94
- package/build/utils/interception/types.d.ts.map +0 -1
- package/build/utils/interception/types.js +0 -2
- package/build/utils/interception/webdriver.d.ts +0 -48
- package/build/utils/interception/webdriver.d.ts.map +0 -1
- package/build/utils/interception/webdriver.js +0 -75
- package/build/utils/refetchElement.d.ts +0 -6
- package/build/utils/refetchElement.d.ts.map +0 -1
- package/build/utils/refetchElement.js +0 -32
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
7
|
-
const mock_1 = require("./mock");
|
|
8
|
-
const log = (0, logger_1.default)('webdriverio:mockRestoreAll');
|
|
9
|
-
/**
|
|
10
|
-
* Restores all mock information and behavior stored in all registered
|
|
11
|
-
* mocks of the session.
|
|
12
|
-
*
|
|
13
|
-
* <example>
|
|
14
|
-
:mockRestoreAll.js
|
|
15
|
-
it('should restore all mocks', async () => {
|
|
16
|
-
const googleMock = await browser.mock('https://google.com/')
|
|
17
|
-
googleMock.respond('https://webdriver.io')
|
|
18
|
-
const wdioMock = await browser.mock('https://webdriver.io')
|
|
19
|
-
wdioMock.respond('http://json.org')
|
|
20
|
-
|
|
21
|
-
await browser.url('https://google.com/')
|
|
22
|
-
console.log(await browser.getTitle()) // JSON
|
|
23
|
-
|
|
24
|
-
await browser.mockRestoreAll()
|
|
25
|
-
|
|
26
|
-
await browser.url('https://google.com/')
|
|
27
|
-
console.log(await browser.getTitle()) // Google
|
|
28
|
-
})
|
|
29
|
-
* </example>
|
|
30
|
-
*
|
|
31
|
-
* @alias browser.mockRestoreAll
|
|
32
|
-
*/
|
|
33
|
-
async function mockRestoreAll() {
|
|
34
|
-
for (const [handle, mocks] of Object.entries(mock_1.SESSION_MOCKS)) {
|
|
35
|
-
log.trace(`Clearing mocks for ${handle}`);
|
|
36
|
-
for (const mock of mocks) {
|
|
37
|
-
mock.restore();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.default = mockRestoreAll;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { NewWindowOptions } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* Open new window in browser. This command is the equivalent function to `window.open()`. This command does not
|
|
5
|
-
* work in mobile environments.
|
|
6
|
-
*
|
|
7
|
-
* __Note:__ When calling this command you automatically switch to the new window.
|
|
8
|
-
*
|
|
9
|
-
* <example>
|
|
10
|
-
:newWindowSync.js
|
|
11
|
-
it('should open a new tab', async () => {
|
|
12
|
-
await browser.url('https://google.com')
|
|
13
|
-
console.log(await browser.getTitle()) // outputs: "Google"
|
|
14
|
-
|
|
15
|
-
await browser.newWindow('https://webdriver.io', {
|
|
16
|
-
windowName: 'WebdriverIO window',
|
|
17
|
-
windowFeature: 'width=420,height=230,resizable,scrollbars=yes,status=1',
|
|
18
|
-
})
|
|
19
|
-
console.log(await browser.getTitle()) // outputs: "WebdriverIO · Next-gen browser and mobile automation test framework for Node.js"
|
|
20
|
-
|
|
21
|
-
const handles = await browser.getWindowHandles()
|
|
22
|
-
await browser.switchToWindow(handles[1])
|
|
23
|
-
await browser.closeWindow()
|
|
24
|
-
await browser.switchToWindow(handles[0])
|
|
25
|
-
console.log(await browser.getTitle()) // outputs: "Google"
|
|
26
|
-
});
|
|
27
|
-
* </example>
|
|
28
|
-
*
|
|
29
|
-
* @param {String} url website URL to open
|
|
30
|
-
* @param {NewWindowOptions=} options newWindow command options
|
|
31
|
-
* @param {String=} options.windowName name of the new window
|
|
32
|
-
* @param {String=} options.windowFeatures features of opened window (e.g. size, position, scrollbars, etc.)
|
|
33
|
-
*
|
|
34
|
-
* @return {String} id of window handle of new tab
|
|
35
|
-
*
|
|
36
|
-
* @uses browser/execute, protocol/getWindowHandles, protocol/switchToWindow
|
|
37
|
-
* @alias browser.newWindow
|
|
38
|
-
* @type window
|
|
39
|
-
*/
|
|
40
|
-
export default function newWindow(this: WebdriverIO.Browser, url: string, { windowName, windowFeatures }?: NewWindowOptions): Promise<string>;
|
|
41
|
-
//# sourceMappingURL=newWindow.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"newWindow.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/newWindow.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAInD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAA8B,SAAS,CACnC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,GAAG,EAAE,MAAM,EACX,EAAE,UAAe,EAAE,cAAmB,EAAE,GAAE,gBAAqB,mBAyClE"}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const utils_1 = require("@wdio/utils");
|
|
7
|
-
const newWindow_1 = __importDefault(require("../../scripts/newWindow"));
|
|
8
|
-
const WAIT_FOR_NEW_HANDLE_TIMEOUT = 3000;
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
* Open new window in browser. This command is the equivalent function to `window.open()`. This command does not
|
|
12
|
-
* work in mobile environments.
|
|
13
|
-
*
|
|
14
|
-
* __Note:__ When calling this command you automatically switch to the new window.
|
|
15
|
-
*
|
|
16
|
-
* <example>
|
|
17
|
-
:newWindowSync.js
|
|
18
|
-
it('should open a new tab', async () => {
|
|
19
|
-
await browser.url('https://google.com')
|
|
20
|
-
console.log(await browser.getTitle()) // outputs: "Google"
|
|
21
|
-
|
|
22
|
-
await browser.newWindow('https://webdriver.io', {
|
|
23
|
-
windowName: 'WebdriverIO window',
|
|
24
|
-
windowFeature: 'width=420,height=230,resizable,scrollbars=yes,status=1',
|
|
25
|
-
})
|
|
26
|
-
console.log(await browser.getTitle()) // outputs: "WebdriverIO · Next-gen browser and mobile automation test framework for Node.js"
|
|
27
|
-
|
|
28
|
-
const handles = await browser.getWindowHandles()
|
|
29
|
-
await browser.switchToWindow(handles[1])
|
|
30
|
-
await browser.closeWindow()
|
|
31
|
-
await browser.switchToWindow(handles[0])
|
|
32
|
-
console.log(await browser.getTitle()) // outputs: "Google"
|
|
33
|
-
});
|
|
34
|
-
* </example>
|
|
35
|
-
*
|
|
36
|
-
* @param {String} url website URL to open
|
|
37
|
-
* @param {NewWindowOptions=} options newWindow command options
|
|
38
|
-
* @param {String=} options.windowName name of the new window
|
|
39
|
-
* @param {String=} options.windowFeatures features of opened window (e.g. size, position, scrollbars, etc.)
|
|
40
|
-
*
|
|
41
|
-
* @return {String} id of window handle of new tab
|
|
42
|
-
*
|
|
43
|
-
* @uses browser/execute, protocol/getWindowHandles, protocol/switchToWindow
|
|
44
|
-
* @alias browser.newWindow
|
|
45
|
-
* @type window
|
|
46
|
-
*/
|
|
47
|
-
async function newWindow(url, { windowName = '', windowFeatures = '' } = {}) {
|
|
48
|
-
/**
|
|
49
|
-
* parameter check
|
|
50
|
-
*/
|
|
51
|
-
if (typeof url !== 'string') {
|
|
52
|
-
throw new Error('number or type of arguments don\'t agree with newWindow command');
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* mobile check
|
|
56
|
-
*/
|
|
57
|
-
if (this.isMobile) {
|
|
58
|
-
throw new Error('newWindow command is not supported on mobile platforms');
|
|
59
|
-
}
|
|
60
|
-
const tabsBefore = await this.getWindowHandles();
|
|
61
|
-
await this.execute(newWindow_1.default, url, windowName, windowFeatures);
|
|
62
|
-
/**
|
|
63
|
-
* if tests are run in DevTools there might be a delay until
|
|
64
|
-
* a new window handle got registered, this little procedure
|
|
65
|
-
* waits for it to exist and avoid race conditions
|
|
66
|
-
*/
|
|
67
|
-
let tabsAfter = await this.getWindowHandles();
|
|
68
|
-
const now = Date.now();
|
|
69
|
-
while ((Date.now() - now) < WAIT_FOR_NEW_HANDLE_TIMEOUT) {
|
|
70
|
-
tabsAfter = await this.getWindowHandles();
|
|
71
|
-
if (tabsAfter.length > tabsBefore.length) {
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
await (0, utils_1.sleep)(100);
|
|
75
|
-
}
|
|
76
|
-
const newTab = tabsAfter.pop();
|
|
77
|
-
if (!newTab) {
|
|
78
|
-
throw new Error('No window handle was found to switch to');
|
|
79
|
-
}
|
|
80
|
-
await this.switchToWindow(newTab);
|
|
81
|
-
return newTab;
|
|
82
|
-
}
|
|
83
|
-
exports.default = newWindow;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The browser method `overwriteCommand` helps you to overwrite the browser's and element's native commands like `pause` and `click`.
|
|
3
|
-
*
|
|
4
|
-
* :::info
|
|
5
|
-
*
|
|
6
|
-
* You can view more information on this in the [custom command](/docs/customcommands#overwriting-native-commands) section.
|
|
7
|
-
*
|
|
8
|
-
* :::
|
|
9
|
-
*
|
|
10
|
-
* <example>
|
|
11
|
-
:execute.js
|
|
12
|
-
// print milliseconds before pause and return its value.
|
|
13
|
-
await browser.overwriteCommand('pause', function (origPauseFunction, ms) {
|
|
14
|
-
console.log(`Sleeping for ${ms}`)
|
|
15
|
-
origPauseFunction(ms)
|
|
16
|
-
return ms
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
// usage
|
|
20
|
-
it('should use my overwrite command', async () => {
|
|
21
|
-
await browser.url('https://webdriver.io')
|
|
22
|
-
await browser.pause(1000) // outputs "Sleeping for 1000"
|
|
23
|
-
})
|
|
24
|
-
* </example>
|
|
25
|
-
* @alias browser.overwriteCommand
|
|
26
|
-
* @param {String} name name of the original command
|
|
27
|
-
* @param {Function} callback pass original function
|
|
28
|
-
* @param {Boolean=} elementScope extend the Element object instead of the Browser object
|
|
29
|
-
* @type utility
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
//# sourceMappingURL=overwriteCommand.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"overwriteCommand.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/overwriteCommand.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The browser method `overwriteCommand` helps you to overwrite the browser's and element's native commands like `pause` and `click`.
|
|
4
|
-
*
|
|
5
|
-
* :::info
|
|
6
|
-
*
|
|
7
|
-
* You can view more information on this in the [custom command](/docs/customcommands#overwriting-native-commands) section.
|
|
8
|
-
*
|
|
9
|
-
* :::
|
|
10
|
-
*
|
|
11
|
-
* <example>
|
|
12
|
-
:execute.js
|
|
13
|
-
// print milliseconds before pause and return its value.
|
|
14
|
-
await browser.overwriteCommand('pause', function (origPauseFunction, ms) {
|
|
15
|
-
console.log(`Sleeping for ${ms}`)
|
|
16
|
-
origPauseFunction(ms)
|
|
17
|
-
return ms
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
// usage
|
|
21
|
-
it('should use my overwrite command', async () => {
|
|
22
|
-
await browser.url('https://webdriver.io')
|
|
23
|
-
await browser.pause(1000) // outputs "Sleeping for 1000"
|
|
24
|
-
})
|
|
25
|
-
* </example>
|
|
26
|
-
* @alias browser.overwriteCommand
|
|
27
|
-
* @param {String} name name of the original command
|
|
28
|
-
* @param {Function} callback pass original function
|
|
29
|
-
* @param {Boolean=} elementScope extend the Element object instead of the Browser object
|
|
30
|
-
* @type utility
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Pauses execution for a specific amount of time. It is recommended to not use this command to wait for an
|
|
4
|
-
* element to show up. In order to avoid flaky test results it is better to use commands like
|
|
5
|
-
* [`waitForExist`](/docs/api/element/waitForExist) or other waitFor* commands.
|
|
6
|
-
*
|
|
7
|
-
* <example>
|
|
8
|
-
:pause.js
|
|
9
|
-
it('should pause the execution', async () => {
|
|
10
|
-
const starttime = new Date().getTime()
|
|
11
|
-
await browser.pause(3000)
|
|
12
|
-
const endtime = new Date().getTime()
|
|
13
|
-
console.log(endtime - starttime) // outputs: 3000
|
|
14
|
-
});
|
|
15
|
-
* </example>
|
|
16
|
-
*
|
|
17
|
-
* @alias browser.pause
|
|
18
|
-
* @param {Number} milliseconds time in ms
|
|
19
|
-
* @type utility
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
export default function pause(this: WebdriverIO.Browser, milliseconds?: number): Promise<unknown>;
|
|
23
|
-
//# sourceMappingURL=pause.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pause.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/pause.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CACzB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,YAAY,SAAO,oBAGtB"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* Pauses execution for a specific amount of time. It is recommended to not use this command to wait for an
|
|
6
|
-
* element to show up. In order to avoid flaky test results it is better to use commands like
|
|
7
|
-
* [`waitForExist`](/docs/api/element/waitForExist) or other waitFor* commands.
|
|
8
|
-
*
|
|
9
|
-
* <example>
|
|
10
|
-
:pause.js
|
|
11
|
-
it('should pause the execution', async () => {
|
|
12
|
-
const starttime = new Date().getTime()
|
|
13
|
-
await browser.pause(3000)
|
|
14
|
-
const endtime = new Date().getTime()
|
|
15
|
-
console.log(endtime - starttime) // outputs: 3000
|
|
16
|
-
});
|
|
17
|
-
* </example>
|
|
18
|
-
*
|
|
19
|
-
* @alias browser.pause
|
|
20
|
-
* @param {Number} milliseconds time in ms
|
|
21
|
-
* @type utility
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
function pause(milliseconds = 1000) {
|
|
25
|
-
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
26
|
-
}
|
|
27
|
-
exports.default = pause;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { ReactSelectorOptions, ElementArray } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* The `react$$` command is a useful command to query multiple React Components
|
|
5
|
-
* by their actual name and filter them by props and state.
|
|
6
|
-
*
|
|
7
|
-
* :::info
|
|
8
|
-
*
|
|
9
|
-
* The command only works with applications using React v16.x. Read more about React
|
|
10
|
-
* selectors in the [Selectors](/docs/selectors#react-selectors) guide.
|
|
11
|
-
*
|
|
12
|
-
* :::
|
|
13
|
-
*
|
|
14
|
-
* <example>
|
|
15
|
-
:pause.js
|
|
16
|
-
it('should calculate 7 * 6', async () => {
|
|
17
|
-
await browser.url('https://ahfarmer.github.io/calculator/');
|
|
18
|
-
|
|
19
|
-
const orangeButtons = await browser.react$$('t', {
|
|
20
|
-
props: { orange: true }
|
|
21
|
-
})
|
|
22
|
-
console.log(await orangeButtons.map((btn) => btn.getText()));
|
|
23
|
-
// prints "[ '÷', 'x', '-', '+', '=' ]"
|
|
24
|
-
});
|
|
25
|
-
* </example>
|
|
26
|
-
*
|
|
27
|
-
* @alias browser.react$$
|
|
28
|
-
* @param {String} selector of React component
|
|
29
|
-
* @param {ReactSelectorOptions=} options React selector options
|
|
30
|
-
* @param {Object=} options.props React props the element should contain
|
|
31
|
-
* @param {Array<any>|number|string|object|boolean=} options.state React state the element should be in
|
|
32
|
-
* @return {ElementArray}
|
|
33
|
-
*
|
|
34
|
-
*/
|
|
35
|
-
export default function react$$(this: WebdriverIO.Browser, selector: string, { props, state }?: ReactSelectorOptions): Promise<ElementArray>;
|
|
36
|
-
//# sourceMappingURL=react$$.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react$$.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/react$$.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAIrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAA8B,OAAO,CACjC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,EAChB,EAAE,KAAU,EAAE,KAAU,EAAE,GAAE,oBAAyB,yBAUxD"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const fs_1 = __importDefault(require("fs"));
|
|
7
|
-
const utils_1 = require("../../utils");
|
|
8
|
-
const getElementObject_1 = require("../../utils/getElementObject");
|
|
9
|
-
const resq_1 = require("../../scripts/resq");
|
|
10
|
-
const resqScript = fs_1.default.readFileSync(require.resolve('resq'));
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* The `react$$` command is a useful command to query multiple React Components
|
|
14
|
-
* by their actual name and filter them by props and state.
|
|
15
|
-
*
|
|
16
|
-
* :::info
|
|
17
|
-
*
|
|
18
|
-
* The command only works with applications using React v16.x. Read more about React
|
|
19
|
-
* selectors in the [Selectors](/docs/selectors#react-selectors) guide.
|
|
20
|
-
*
|
|
21
|
-
* :::
|
|
22
|
-
*
|
|
23
|
-
* <example>
|
|
24
|
-
:pause.js
|
|
25
|
-
it('should calculate 7 * 6', async () => {
|
|
26
|
-
await browser.url('https://ahfarmer.github.io/calculator/');
|
|
27
|
-
|
|
28
|
-
const orangeButtons = await browser.react$$('t', {
|
|
29
|
-
props: { orange: true }
|
|
30
|
-
})
|
|
31
|
-
console.log(await orangeButtons.map((btn) => btn.getText()));
|
|
32
|
-
// prints "[ '÷', 'x', '-', '+', '=' ]"
|
|
33
|
-
});
|
|
34
|
-
* </example>
|
|
35
|
-
*
|
|
36
|
-
* @alias browser.react$$
|
|
37
|
-
* @param {String} selector of React component
|
|
38
|
-
* @param {ReactSelectorOptions=} options React selector options
|
|
39
|
-
* @param {Object=} options.props React props the element should contain
|
|
40
|
-
* @param {Array<any>|number|string|object|boolean=} options.state React state the element should be in
|
|
41
|
-
* @return {ElementArray}
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
async function react$$(selector, { props = {}, state = {} } = {}) {
|
|
45
|
-
await this.executeScript(resqScript.toString(), []);
|
|
46
|
-
await this.execute(resq_1.waitToLoadReact);
|
|
47
|
-
const res = await this.execute(resq_1.react$$, selector, props, state);
|
|
48
|
-
const elements = await getElementObject_1.getElements.call(this, selector, res, true);
|
|
49
|
-
return (0, utils_1.enhanceElementsArray)(elements, this, selector, 'react$$', [props, state]);
|
|
50
|
-
}
|
|
51
|
-
exports.default = react$$;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { ReactSelectorOptions } from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* The `react$` command is a useful command to query React Components by their
|
|
5
|
-
* actual name and filter them by props and state.
|
|
6
|
-
*
|
|
7
|
-
* :::info
|
|
8
|
-
*
|
|
9
|
-
* The command only works with applications using React v16.x. Read more about React
|
|
10
|
-
* selectors in the [Selectors](/docs/selectors#react-selectors) guide.
|
|
11
|
-
*
|
|
12
|
-
* :::
|
|
13
|
-
*
|
|
14
|
-
* <example>
|
|
15
|
-
:pause.js
|
|
16
|
-
it('should calculate 7 * 6', async () => {
|
|
17
|
-
await browser.url('https://ahfarmer.github.io/calculator/');
|
|
18
|
-
const appWrapper = await $('div#root')
|
|
19
|
-
|
|
20
|
-
await browser.react$('t', {
|
|
21
|
-
props: { name: '7' }
|
|
22
|
-
}).click()
|
|
23
|
-
await browser.react$('t', {
|
|
24
|
-
props: { name: 'x' }
|
|
25
|
-
}).click()
|
|
26
|
-
await browser.react$('t', {
|
|
27
|
-
props: { name: '6' }
|
|
28
|
-
}).click()
|
|
29
|
-
await browser.react$('t', {
|
|
30
|
-
props: { name: '=' }
|
|
31
|
-
}).click()
|
|
32
|
-
|
|
33
|
-
console.log(await $('.component-display').getText()); // prints "42"
|
|
34
|
-
});
|
|
35
|
-
* </example>
|
|
36
|
-
*
|
|
37
|
-
* @alias browser.react$
|
|
38
|
-
* @param {String} selector of React component
|
|
39
|
-
* @param {ReactSelectorOptions=} options React selector options
|
|
40
|
-
* @param {Object=} options.props React props the element should contain
|
|
41
|
-
* @param {Array<any>|number|string|object|boolean=} options.state React state the element should be in
|
|
42
|
-
* @return {Element}
|
|
43
|
-
*
|
|
44
|
-
*/
|
|
45
|
-
export default function react$(this: WebdriverIO.Browser, selector: string, { props, state }?: ReactSelectorOptions): Promise<WebdriverIO.Element>;
|
|
46
|
-
//# sourceMappingURL=react$.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react$.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/react$.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAIvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAA8B,MAAM,CAChC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,EAChB,EAAE,KAAU,EAAE,KAAU,EAAE,GAAE,oBAAyB,gCASxD"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const fs_1 = __importDefault(require("fs"));
|
|
7
|
-
const getElementObject_1 = require("../../utils/getElementObject");
|
|
8
|
-
const resq_1 = require("../../scripts/resq");
|
|
9
|
-
const resqScript = fs_1.default.readFileSync(require.resolve('resq'));
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* The `react$` command is a useful command to query React Components by their
|
|
13
|
-
* actual name and filter them by props and state.
|
|
14
|
-
*
|
|
15
|
-
* :::info
|
|
16
|
-
*
|
|
17
|
-
* The command only works with applications using React v16.x. Read more about React
|
|
18
|
-
* selectors in the [Selectors](/docs/selectors#react-selectors) guide.
|
|
19
|
-
*
|
|
20
|
-
* :::
|
|
21
|
-
*
|
|
22
|
-
* <example>
|
|
23
|
-
:pause.js
|
|
24
|
-
it('should calculate 7 * 6', async () => {
|
|
25
|
-
await browser.url('https://ahfarmer.github.io/calculator/');
|
|
26
|
-
const appWrapper = await $('div#root')
|
|
27
|
-
|
|
28
|
-
await browser.react$('t', {
|
|
29
|
-
props: { name: '7' }
|
|
30
|
-
}).click()
|
|
31
|
-
await browser.react$('t', {
|
|
32
|
-
props: { name: 'x' }
|
|
33
|
-
}).click()
|
|
34
|
-
await browser.react$('t', {
|
|
35
|
-
props: { name: '6' }
|
|
36
|
-
}).click()
|
|
37
|
-
await browser.react$('t', {
|
|
38
|
-
props: { name: '=' }
|
|
39
|
-
}).click()
|
|
40
|
-
|
|
41
|
-
console.log(await $('.component-display').getText()); // prints "42"
|
|
42
|
-
});
|
|
43
|
-
* </example>
|
|
44
|
-
*
|
|
45
|
-
* @alias browser.react$
|
|
46
|
-
* @param {String} selector of React component
|
|
47
|
-
* @param {ReactSelectorOptions=} options React selector options
|
|
48
|
-
* @param {Object=} options.props React props the element should contain
|
|
49
|
-
* @param {Array<any>|number|string|object|boolean=} options.state React state the element should be in
|
|
50
|
-
* @return {Element}
|
|
51
|
-
*
|
|
52
|
-
*/
|
|
53
|
-
async function react$(selector, { props = {}, state = {} } = {}) {
|
|
54
|
-
await this.executeScript(resqScript.toString(), []);
|
|
55
|
-
await this.execute(resq_1.waitToLoadReact);
|
|
56
|
-
const res = await this.execute(resq_1.react$, selector, props, state);
|
|
57
|
-
return getElementObject_1.getElement.call(this, selector, res, true);
|
|
58
|
-
}
|
|
59
|
-
exports.default = react$;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Creates a new Selenium session with your current capabilities. This is useful if you
|
|
4
|
-
* test highly stateful application where you need to clean the browser session between
|
|
5
|
-
* the tests in your spec file to avoid creating hundreds of single test files with WDIO.
|
|
6
|
-
* Be careful though, this command affects your test time tremendously since spawning
|
|
7
|
-
* new Selenium sessions is very time consuming especially when using cloud services.
|
|
8
|
-
*
|
|
9
|
-
* <example>
|
|
10
|
-
:reloadSync.js
|
|
11
|
-
it('should reload my session with current capabilities', async () => {
|
|
12
|
-
console.log(browser.sessionId) // outputs: e042b3f3cd5a479da4e171825e96e655
|
|
13
|
-
await browser.reloadSession()
|
|
14
|
-
console.log(browser.sessionId) // outputs: 9a0d9bf9d4864160aa982c50cf18a573
|
|
15
|
-
})
|
|
16
|
-
* </example>
|
|
17
|
-
*
|
|
18
|
-
* @alias browser.reloadSession
|
|
19
|
-
* @type utility
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
export default function reloadSession(this: WebdriverIO.Browser): Promise<string>;
|
|
23
|
-
//# sourceMappingURL=reloadSession.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reloadSession.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/reloadSession.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAA8B,aAAa,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,mBA+BrE"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
7
|
-
const log = (0, logger_1.default)('webdriverio');
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* Creates a new Selenium session with your current capabilities. This is useful if you
|
|
11
|
-
* test highly stateful application where you need to clean the browser session between
|
|
12
|
-
* the tests in your spec file to avoid creating hundreds of single test files with WDIO.
|
|
13
|
-
* Be careful though, this command affects your test time tremendously since spawning
|
|
14
|
-
* new Selenium sessions is very time consuming especially when using cloud services.
|
|
15
|
-
*
|
|
16
|
-
* <example>
|
|
17
|
-
:reloadSync.js
|
|
18
|
-
it('should reload my session with current capabilities', async () => {
|
|
19
|
-
console.log(browser.sessionId) // outputs: e042b3f3cd5a479da4e171825e96e655
|
|
20
|
-
await browser.reloadSession()
|
|
21
|
-
console.log(browser.sessionId) // outputs: 9a0d9bf9d4864160aa982c50cf18a573
|
|
22
|
-
})
|
|
23
|
-
* </example>
|
|
24
|
-
*
|
|
25
|
-
* @alias browser.reloadSession
|
|
26
|
-
* @type utility
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
async function reloadSession() {
|
|
30
|
-
var _a;
|
|
31
|
-
const oldSessionId = this.sessionId;
|
|
32
|
-
/**
|
|
33
|
-
* end current running session, if session already gone suppress exceptions
|
|
34
|
-
*/
|
|
35
|
-
try {
|
|
36
|
-
await this.deleteSession();
|
|
37
|
-
}
|
|
38
|
-
catch (err) {
|
|
39
|
-
/**
|
|
40
|
-
* ignoring all exceptions that could be caused by browser.deleteSession()
|
|
41
|
-
* there maybe times where session is ended remotely, browser.deleteSession() will fail in this case)
|
|
42
|
-
* this can be worked around in code but requires a lot of overhead
|
|
43
|
-
*/
|
|
44
|
-
log.warn(`Suppressing error closing the session: ${err.stack}`);
|
|
45
|
-
}
|
|
46
|
-
if ((_a = this.puppeteer) === null || _a === void 0 ? void 0 : _a.isConnected()) {
|
|
47
|
-
this.puppeteer.disconnect();
|
|
48
|
-
log.debug('Disconnected puppeteer session');
|
|
49
|
-
}
|
|
50
|
-
const ProtocolDriver = require(this.options.automationProtocol).default;
|
|
51
|
-
await ProtocolDriver.reloadSession(this);
|
|
52
|
-
const options = this.options;
|
|
53
|
-
if (Array.isArray(options.onReload) && options.onReload.length) {
|
|
54
|
-
await Promise.all(options.onReload.map((hook) => hook(oldSessionId, this.sessionId)));
|
|
55
|
-
}
|
|
56
|
-
return this.sessionId;
|
|
57
|
-
}
|
|
58
|
-
exports.default = reloadSession;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
declare type PDFPrintOptions = {
|
|
3
|
-
orientation?: string;
|
|
4
|
-
scale?: number;
|
|
5
|
-
background?: boolean;
|
|
6
|
-
width?: number;
|
|
7
|
-
height?: number;
|
|
8
|
-
top?: number;
|
|
9
|
-
bottom?: number;
|
|
10
|
-
left?: number;
|
|
11
|
-
right?: number;
|
|
12
|
-
shrinkToFit?: boolean;
|
|
13
|
-
pageRanges?: object[];
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* Prints the page of the current browsing context to a PDF file on your OS.
|
|
18
|
-
*
|
|
19
|
-
* <example>
|
|
20
|
-
:savePDF.js
|
|
21
|
-
it('should save a PDF screenshot of the browser view', function () {
|
|
22
|
-
await browser.savePDF('./some/path/screenshot.pdf');
|
|
23
|
-
});
|
|
24
|
-
* </example>
|
|
25
|
-
*
|
|
26
|
-
* @alias browser.savePDF
|
|
27
|
-
* @param {String} filepath path to the generated pdf (`.pdf` suffix is required) relative to the execution directory
|
|
28
|
-
* @param {PDFPrintOptions=} options Print PDF Options
|
|
29
|
-
* @param {String=} options.orientation Orientation of PDF page
|
|
30
|
-
* @param {number=} options.scale Scale of PDF page
|
|
31
|
-
* @param {boolean=} options.background Include background of PDF page
|
|
32
|
-
* @param {number=} options.width Width of PDF page
|
|
33
|
-
* @param {number=} options.height Height of PDF page
|
|
34
|
-
* @param {number=} options.top Top padding of PDF page
|
|
35
|
-
* @param {number=} options.bottom Bottom padding of PDF page
|
|
36
|
-
* @param {number=} options.left Left padding of PDF page
|
|
37
|
-
* @param {number=} options.right Right padding of PDF page
|
|
38
|
-
* @param {boolean=} options.shrinkToFit Shrink page to fit page
|
|
39
|
-
* @param {object[]=} options.pageRanges Range of pages to include in PDF
|
|
40
|
-
* @return {Buffer} screenshot buffer
|
|
41
|
-
* @type utility
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
export default function savePDF(this: WebdriverIO.Browser, filepath: string, options?: PDFPrintOptions): Promise<Buffer>;
|
|
45
|
-
export {};
|
|
46
|
-
//# sourceMappingURL=savePDF.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"savePDF.d.ts","sourceRoot":"","sources":["../../../src/commands/browser/savePDF.ts"],"names":[],"mappings":";AAGA,aAAK,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,wBAA8B,OAAO,CACjC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,eAAe,mBAmB5B"}
|