webdriverio 7.17.0 → 7.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/commands/browser/$$.d.ts +50 -0
- package/build/commands/browser/$$.d.ts.map +1 -0
- package/build/commands/browser/$$.js +57 -0
- package/build/commands/browser/$.d.ts +77 -0
- package/build/commands/browser/$.d.ts.map +1 -0
- package/build/commands/browser/$.js +91 -0
- package/build/commands/browser/addCommand.d.ts +37 -0
- package/build/commands/browser/addCommand.d.ts.map +1 -0
- package/build/commands/browser/addCommand.js +37 -0
- package/build/commands/browser/call.d.ts +42 -0
- package/build/commands/browser/call.d.ts.map +1 -0
- package/build/commands/browser/call.js +49 -0
- package/build/commands/browser/custom$$.d.ts +26 -0
- package/build/commands/browser/custom$$.d.ts.map +1 -0
- package/build/commands/browser/custom$$.js +47 -0
- package/build/commands/browser/custom$.d.ts +25 -0
- package/build/commands/browser/custom$.d.ts.map +1 -0
- package/build/commands/browser/custom$.js +47 -0
- package/build/commands/browser/debug.d.ts +32 -0
- package/build/commands/browser/debug.d.ts.map +1 -0
- package/build/commands/browser/debug.js +108 -0
- package/build/commands/browser/deleteCookies.d.ts +45 -0
- package/build/commands/browser/deleteCookies.d.ts.map +1 -0
- package/build/commands/browser/deleteCookies.js +56 -0
- package/build/commands/browser/execute.d.ts +37 -0
- package/build/commands/browser/execute.d.ts.map +1 -0
- package/build/commands/browser/execute.js +55 -0
- package/build/commands/browser/executeAsync.d.ts +45 -0
- package/build/commands/browser/executeAsync.d.ts.map +1 -0
- package/build/commands/browser/executeAsync.js +63 -0
- package/build/commands/browser/getCookies.d.ts +34 -0
- package/build/commands/browser/getCookies.d.ts.map +1 -0
- package/build/commands/browser/getCookies.js +46 -0
- package/build/commands/browser/getPuppeteer.d.ts +38 -0
- package/build/commands/browser/getPuppeteer.d.ts.map +1 -0
- package/build/commands/browser/getPuppeteer.js +119 -0
- package/build/commands/browser/getWindowSize.d.ts +25 -0
- package/build/commands/browser/getWindowSize.d.ts.map +1 -0
- package/build/commands/browser/getWindowSize.js +30 -0
- package/build/commands/browser/keys.d.ts +28 -0
- package/build/commands/browser/keys.d.ts.map +1 -0
- package/build/commands/browser/keys.js +64 -0
- package/build/commands/browser/mock.d.ts +111 -0
- package/build/commands/browser/mock.d.ts.map +1 -0
- package/build/commands/browser/mock.js +164 -0
- package/build/commands/browser/mockClearAll.d.ts +28 -0
- package/build/commands/browser/mockClearAll.d.ts.map +1 -0
- package/build/commands/browser/mockClearAll.js +43 -0
- package/build/commands/browser/mockRestoreAll.d.ts +26 -0
- package/build/commands/browser/mockRestoreAll.d.ts.map +1 -0
- package/build/commands/browser/mockRestoreAll.js +41 -0
- package/build/commands/browser/newWindow.d.ts +41 -0
- package/build/commands/browser/newWindow.d.ts.map +1 -0
- package/build/commands/browser/newWindow.js +83 -0
- package/build/commands/browser/overwriteCommand.d.ts +32 -0
- package/build/commands/browser/overwriteCommand.d.ts.map +1 -0
- package/build/commands/browser/overwriteCommand.js +32 -0
- package/build/commands/browser/pause.d.ts +23 -0
- package/build/commands/browser/pause.d.ts.map +1 -0
- package/build/commands/browser/pause.js +27 -0
- package/build/commands/browser/react$$.d.ts +36 -0
- package/build/commands/browser/react$$.d.ts.map +1 -0
- package/build/commands/browser/react$$.js +51 -0
- package/build/commands/browser/react$.d.ts +46 -0
- package/build/commands/browser/react$.d.ts.map +1 -0
- package/build/commands/browser/react$.js +59 -0
- package/build/commands/browser/reloadSession.d.ts +23 -0
- package/build/commands/browser/reloadSession.d.ts.map +1 -0
- package/build/commands/browser/reloadSession.js +58 -0
- package/build/commands/browser/savePDF.d.ts +46 -0
- package/build/commands/browser/savePDF.d.ts.map +1 -0
- package/build/commands/browser/savePDF.js +51 -0
- package/build/commands/browser/saveRecordingScreen.d.ts +28 -0
- package/build/commands/browser/saveRecordingScreen.d.ts.map +1 -0
- package/build/commands/browser/saveRecordingScreen.js +47 -0
- package/build/commands/browser/saveScreenshot.d.ts +22 -0
- package/build/commands/browser/saveScreenshot.d.ts.map +1 -0
- package/build/commands/browser/saveScreenshot.js +41 -0
- package/build/commands/browser/setCookies.d.ts +57 -0
- package/build/commands/browser/setCookies.d.ts.map +1 -0
- package/build/commands/browser/setCookies.js +66 -0
- package/build/commands/browser/setTimeout.d.ts +31 -0
- package/build/commands/browser/setTimeout.d.ts.map +1 -0
- package/build/commands/browser/setTimeout.js +61 -0
- package/build/commands/browser/setWindowSize.d.ts +20 -0
- package/build/commands/browser/setWindowSize.d.ts.map +1 -0
- package/build/commands/browser/setWindowSize.js +43 -0
- package/build/commands/browser/switchWindow.d.ts +30 -0
- package/build/commands/browser/switchWindow.d.ts.map +1 -0
- package/build/commands/browser/switchWindow.js +73 -0
- package/build/commands/browser/throttle.d.ts +3 -0
- package/build/commands/browser/throttle.d.ts.map +1 -0
- package/build/commands/browser/throttle.js +144 -0
- package/build/commands/browser/touchAction.d.ts +61 -0
- package/build/commands/browser/touchAction.d.ts.map +1 -0
- package/build/commands/browser/touchAction.js +65 -0
- package/build/commands/browser/uploadFile.d.ts +32 -0
- package/build/commands/browser/uploadFile.d.ts.map +1 -0
- package/build/commands/browser/uploadFile.js +63 -0
- package/build/commands/browser/url.d.ts +38 -0
- package/build/commands/browser/url.d.ts.map +1 -0
- package/build/commands/browser/url.js +49 -0
- package/build/commands/browser/waitUntil.d.ts +44 -0
- package/build/commands/browser/waitUntil.d.ts.map +1 -0
- package/build/commands/browser/waitUntil.js +73 -0
- package/build/commands/browser.d.ts +70 -0
- package/build/commands/browser.d.ts.map +1 -0
- package/build/commands/browser.js +44 -0
- package/build/commands/constant.d.ts +19 -0
- package/build/commands/constant.d.ts.map +1 -0
- package/build/commands/constant.js +91 -0
- package/build/commands/element/$$.d.ts +46 -0
- package/build/commands/element/$$.d.ts.map +1 -0
- package/build/commands/element/$$.js +50 -0
- package/build/commands/element/$.d.ts +72 -0
- package/build/commands/element/$.d.ts.map +1 -0
- package/build/commands/element/$.js +76 -0
- package/build/commands/element/addValue.d.ts +33 -0
- package/build/commands/element/addValue.d.ts.map +1 -0
- package/build/commands/element/addValue.js +48 -0
- package/build/commands/element/clearValue.d.ts +28 -0
- package/build/commands/element/clearValue.d.ts.map +1 -0
- package/build/commands/element/clearValue.js +32 -0
- package/build/commands/element/click.d.ts +73 -0
- package/build/commands/element/click.d.ts.map +1 -0
- package/build/commands/element/click.js +134 -0
- package/build/commands/element/custom$$.d.ts +28 -0
- package/build/commands/element/custom$$.d.ts.map +1 -0
- package/build/commands/element/custom$$.js +57 -0
- package/build/commands/element/custom$.d.ts +27 -0
- package/build/commands/element/custom$.d.ts.map +1 -0
- package/build/commands/element/custom$.js +57 -0
- package/build/commands/element/doubleClick.d.ts +25 -0
- package/build/commands/element/doubleClick.d.ts.map +1 -0
- package/build/commands/element/doubleClick.js +51 -0
- package/build/commands/element/dragAndDrop.d.ts +41 -0
- package/build/commands/element/dragAndDrop.d.ts.map +1 -0
- package/build/commands/element/dragAndDrop.js +98 -0
- package/build/commands/element/getAttribute.d.ts +28 -0
- package/build/commands/element/getAttribute.d.ts.map +1 -0
- package/build/commands/element/getAttribute.js +32 -0
- package/build/commands/element/getCSSProperty.d.ts +71 -0
- package/build/commands/element/getCSSProperty.d.ts.map +1 -0
- package/build/commands/element/getCSSProperty.js +108 -0
- package/build/commands/element/getComputedLabel.d.ts +20 -0
- package/build/commands/element/getComputedLabel.d.ts.map +1 -0
- package/build/commands/element/getComputedLabel.js +24 -0
- package/build/commands/element/getComputedRole.d.ts +20 -0
- package/build/commands/element/getComputedRole.d.ts.map +1 -0
- package/build/commands/element/getComputedRole.js +24 -0
- package/build/commands/element/getHTML.d.ts +32 -0
- package/build/commands/element/getHTML.d.ts.map +1 -0
- package/build/commands/element/getHTML.js +46 -0
- package/build/commands/element/getLocation.d.ts +6 -0
- package/build/commands/element/getLocation.d.ts.map +1 -0
- package/build/commands/element/getLocation.js +46 -0
- package/build/commands/element/getProperty.d.ts +53 -0
- package/build/commands/element/getProperty.d.ts.map +1 -0
- package/build/commands/element/getProperty.js +31 -0
- package/build/commands/element/getSize.d.ts +6 -0
- package/build/commands/element/getSize.d.ts.map +1 -0
- package/build/commands/element/getSize.js +47 -0
- package/build/commands/element/getTagName.d.ts +25 -0
- package/build/commands/element/getTagName.d.ts.map +1 -0
- package/build/commands/element/getTagName.js +29 -0
- package/build/commands/element/getText.d.ts +42 -0
- package/build/commands/element/getText.d.ts.map +1 -0
- package/build/commands/element/getText.js +46 -0
- package/build/commands/element/getValue.d.ts +25 -0
- package/build/commands/element/getValue.d.ts.map +1 -0
- package/build/commands/element/getValue.js +33 -0
- package/build/commands/element/isClickable.d.ts +40 -0
- package/build/commands/element/isClickable.d.ts.map +1 -0
- package/build/commands/element/isClickable.js +57 -0
- package/build/commands/element/isDisplayed.d.ts +50 -0
- package/build/commands/element/isDisplayed.d.ts.map +1 -0
- package/build/commands/element/isDisplayed.js +85 -0
- package/build/commands/element/isDisplayedInViewport.d.ts +38 -0
- package/build/commands/element/isDisplayedInViewport.d.ts.map +1 -0
- package/build/commands/element/isDisplayedInViewport.js +55 -0
- package/build/commands/element/isEnabled.d.ts +34 -0
- package/build/commands/element/isEnabled.d.ts.map +1 -0
- package/build/commands/element/isEnabled.js +38 -0
- package/build/commands/element/isEqual.d.ts +24 -0
- package/build/commands/element/isEqual.d.ts.map +1 -0
- package/build/commands/element/isEqual.js +52 -0
- package/build/commands/element/isExisting.d.ts +49 -0
- package/build/commands/element/isExisting.d.ts.map +1 -0
- package/build/commands/element/isExisting.js +65 -0
- package/build/commands/element/isFocused.d.ts +28 -0
- package/build/commands/element/isFocused.d.ts.map +1 -0
- package/build/commands/element/isFocused.js +42 -0
- package/build/commands/element/isSelected.d.ts +31 -0
- package/build/commands/element/isSelected.d.ts.map +1 -0
- package/build/commands/element/isSelected.js +35 -0
- package/build/commands/element/moveTo.d.ts +21 -0
- package/build/commands/element/moveTo.d.ts.map +1 -0
- package/build/commands/element/moveTo.js +39 -0
- package/build/commands/element/nextElement.d.ts +25 -0
- package/build/commands/element/nextElement.d.ts.map +1 -0
- package/build/commands/element/nextElement.js +31 -0
- package/build/commands/element/parentElement.d.ts +25 -0
- package/build/commands/element/parentElement.d.ts.map +1 -0
- package/build/commands/element/parentElement.js +31 -0
- package/build/commands/element/previousElement.d.ts +25 -0
- package/build/commands/element/previousElement.d.ts.map +1 -0
- package/build/commands/element/previousElement.js +31 -0
- package/build/commands/element/react$$.d.ts +36 -0
- package/build/commands/element/react$$.d.ts.map +1 -0
- package/build/commands/element/react$$.js +51 -0
- package/build/commands/element/react$.d.ts +46 -0
- package/build/commands/element/react$.d.ts.map +1 -0
- package/build/commands/element/react$.js +59 -0
- package/build/commands/element/saveScreenshot.d.ts +21 -0
- package/build/commands/element/saveScreenshot.d.ts.map +1 -0
- package/build/commands/element/saveScreenshot.js +40 -0
- package/build/commands/element/scrollIntoView.d.ts +21 -0
- package/build/commands/element/scrollIntoView.d.ts.map +1 -0
- package/build/commands/element/scrollIntoView.js +31 -0
- package/build/commands/element/selectByAttribute.d.ts +37 -0
- package/build/commands/element/selectByAttribute.d.ts.map +1 -0
- package/build/commands/element/selectByAttribute.js +59 -0
- package/build/commands/element/selectByIndex.d.ts +31 -0
- package/build/commands/element/selectByIndex.d.ts.map +1 -0
- package/build/commands/element/selectByIndex.js +55 -0
- package/build/commands/element/selectByVisibleText.d.ts +31 -0
- package/build/commands/element/selectByVisibleText.d.ts.map +1 -0
- package/build/commands/element/selectByVisibleText.js +66 -0
- package/build/commands/element/setValue.d.ts +29 -0
- package/build/commands/element/setValue.d.ts.map +1 -0
- package/build/commands/element/setValue.js +33 -0
- package/build/commands/element/shadow$$.d.ts +22 -0
- package/build/commands/element/shadow$$.d.ts.map +1 -0
- package/build/commands/element/shadow$$.js +27 -0
- package/build/commands/element/shadow$.d.ts +22 -0
- package/build/commands/element/shadow$.d.ts.map +1 -0
- package/build/commands/element/shadow$.js +27 -0
- package/build/commands/element/touchAction.d.ts +54 -0
- package/build/commands/element/touchAction.d.ts.map +1 -0
- package/build/commands/element/touchAction.js +58 -0
- package/build/commands/element/waitForClickable.d.ts +34 -0
- package/build/commands/element/waitForClickable.d.ts.map +1 -0
- package/build/commands/element/waitForClickable.js +37 -0
- package/build/commands/element/waitForDisplayed.d.ts +44 -0
- package/build/commands/element/waitForDisplayed.d.ts.map +1 -0
- package/build/commands/element/waitForDisplayed.js +47 -0
- package/build/commands/element/waitForEnabled.d.ts +46 -0
- package/build/commands/element/waitForEnabled.d.ts.map +1 -0
- package/build/commands/element/waitForEnabled.js +55 -0
- package/build/commands/element/waitForExist.d.ts +46 -0
- package/build/commands/element/waitForExist.d.ts.map +1 -0
- package/build/commands/element/waitForExist.js +49 -0
- package/build/commands/element/waitUntil.d.ts +49 -0
- package/build/commands/element/waitUntil.d.ts.map +1 -0
- package/build/commands/element/waitUntil.js +53 -0
- package/build/commands/element.d.ts +100 -0
- package/build/commands/element.d.ts.map +1 -0
- package/build/commands/element.js +63 -0
- package/build/commands/mock/abort.d.ts +19 -0
- package/build/commands/mock/abort.d.ts.map +1 -0
- package/build/commands/mock/abort.js +20 -0
- package/build/commands/mock/abortOnce.d.ts +27 -0
- package/build/commands/mock/abortOnce.d.ts.map +1 -0
- package/build/commands/mock/abortOnce.js +28 -0
- package/build/commands/mock/clear.d.ts +18 -0
- package/build/commands/mock/clear.d.ts.map +1 -0
- package/build/commands/mock/clear.js +19 -0
- package/build/commands/mock/respond.d.ts +54 -0
- package/build/commands/mock/respond.d.ts.map +1 -0
- package/build/commands/mock/respond.js +55 -0
- package/build/commands/mock/respondOnce.d.ts +55 -0
- package/build/commands/mock/respondOnce.d.ts.map +1 -0
- package/build/commands/mock/respondOnce.js +56 -0
- package/build/commands/mock/restore.d.ts +18 -0
- package/build/commands/mock/restore.d.ts.map +1 -0
- package/build/commands/mock/restore.js +19 -0
- package/build/constants.d.ts +14 -0
- package/build/constants.d.ts.map +1 -0
- package/build/constants.js +286 -0
- package/build/index.d.ts +45 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +175 -0
- package/build/middlewares.d.ts +12 -0
- package/build/middlewares.d.ts.map +1 -0
- package/build/middlewares.js +65 -0
- package/build/multiremote.d.ts +71 -0
- package/build/multiremote.d.ts.map +1 -0
- package/build/multiremote.js +160 -0
- package/build/protocol-stub.d.ts +16 -0
- package/build/protocol-stub.d.ts.map +1 -0
- package/build/protocol-stub.js +77 -0
- package/build/scripts/getHTML.d.ts +9 -0
- package/build/scripts/getHTML.d.ts.map +1 -0
- package/build/scripts/getHTML.js +13 -0
- package/build/scripts/getProperty.d.ts +43 -0
- package/build/scripts/getProperty.d.ts.map +1 -0
- package/build/scripts/getProperty.js +12 -0
- package/build/scripts/isElementClickable.d.ts +7 -0
- package/build/scripts/isElementClickable.d.ts.map +1 -0
- package/build/scripts/isElementClickable.js +121 -0
- package/build/scripts/isElementDisplayed.d.ts +7 -0
- package/build/scripts/isElementDisplayed.d.ts.map +1 -0
- package/build/scripts/isElementDisplayed.js +216 -0
- package/build/scripts/isElementInViewport.d.ts +10 -0
- package/build/scripts/isElementInViewport.d.ts.map +1 -0
- package/build/scripts/isElementInViewport.js +22 -0
- package/build/scripts/isFocused.d.ts +7 -0
- package/build/scripts/isFocused.d.ts.map +1 -0
- package/build/scripts/isFocused.js +11 -0
- package/build/scripts/newWindow.d.ts +10 -0
- package/build/scripts/newWindow.d.ts.map +1 -0
- package/build/scripts/newWindow.js +14 -0
- package/build/scripts/resq.d.ts +6 -0
- package/build/scripts/resq.d.ts.map +1 -0
- package/build/scripts/resq.js +58 -0
- package/build/scripts/shadowFnFactory.d.ts +2 -0
- package/build/scripts/shadowFnFactory.d.ts.map +1 -0
- package/build/scripts/shadowFnFactory.js +17 -0
- package/build/types.d.ts +402 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/utils/SevereServiceError.d.ts +7 -0
- package/build/utils/SevereServiceError.d.ts.map +1 -0
- package/build/utils/SevereServiceError.js +12 -0
- package/build/utils/Timer.d.ts +33 -0
- package/build/utils/Timer.d.ts.map +1 -0
- package/build/utils/Timer.js +126 -0
- package/build/utils/detectBackend.d.ts +23 -0
- package/build/utils/detectBackend.d.ts.map +1 -0
- package/build/utils/detectBackend.js +119 -0
- package/build/utils/findStrategy.d.ts +10 -0
- package/build/utils/findStrategy.d.ts.map +1 -0
- package/build/utils/findStrategy.js +267 -0
- package/build/utils/getElementObject.d.ts +17 -0
- package/build/utils/getElementObject.d.ts.map +1 -0
- package/build/utils/getElementObject.js +107 -0
- package/build/utils/implicitWait.d.ts +7 -0
- package/build/utils/implicitWait.d.ts.map +1 -0
- package/build/utils/implicitWait.js +39 -0
- package/build/utils/index.d.ts +102 -0
- package/build/utils/index.d.ts.map +1 -0
- package/build/utils/index.js +543 -0
- package/build/utils/interception/devtools.d.ts +61 -0
- package/build/utils/interception/devtools.d.ts.map +1 -0
- package/build/utils/interception/devtools.js +247 -0
- package/build/utils/interception/index.d.ts +26 -0
- package/build/utils/interception/index.d.ts.map +1 -0
- package/build/utils/interception/index.js +49 -0
- package/build/utils/interception/types.d.ts +94 -0
- package/build/utils/interception/types.d.ts.map +1 -0
- package/build/utils/interception/types.js +2 -0
- package/build/utils/interception/webdriver.d.ts +48 -0
- package/build/utils/interception/webdriver.d.ts.map +1 -0
- package/build/utils/interception/webdriver.js +75 -0
- package/build/utils/refetchElement.d.ts +6 -0
- package/build/utils/refetchElement.d.ts.map +1 -0
- package/build/utils/refetchElement.js +32 -0
- package/package.json +10 -10
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (C) 2017 Apple Inc. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions
|
|
7
|
+
* are met:
|
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
*
|
|
14
|
+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
|
|
15
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
16
|
+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
17
|
+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
|
|
18
|
+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
19
|
+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
20
|
+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
21
|
+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
22
|
+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
23
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
24
|
+
* THE POSSIBILITY OF SUCH DAMAGE.
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
/**
|
|
28
|
+
* check if element is visible
|
|
29
|
+
* @param {HTMLElement} elem element to check
|
|
30
|
+
* @return {Boolean} true if element is within viewport
|
|
31
|
+
*/
|
|
32
|
+
function isElementDisplayed(element) {
|
|
33
|
+
function nodeIsElement(node) {
|
|
34
|
+
if (!node) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
switch (node.nodeType) {
|
|
38
|
+
case Node.ELEMENT_NODE:
|
|
39
|
+
case Node.DOCUMENT_NODE:
|
|
40
|
+
case Node.DOCUMENT_FRAGMENT_NODE:
|
|
41
|
+
return true;
|
|
42
|
+
default:
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function parentElementForElement(element) {
|
|
47
|
+
if (!element) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return enclosingNodeOrSelfMatchingPredicate(element.parentNode, nodeIsElement);
|
|
51
|
+
}
|
|
52
|
+
function enclosingNodeOrSelfMatchingPredicate(targetNode, predicate) {
|
|
53
|
+
for (let node = targetNode; node && node !== targetNode.ownerDocument; node = node.parentNode)
|
|
54
|
+
if (predicate(node)) {
|
|
55
|
+
return node;
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
function enclosingElementOrSelfMatchingPredicate(targetElement, predicate) {
|
|
60
|
+
for (let element = targetElement; element && element !== targetElement.ownerDocument; element = parentElementForElement(element))
|
|
61
|
+
if (predicate(element)) {
|
|
62
|
+
return element;
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
function cascadedStylePropertyForElement(element, property) {
|
|
67
|
+
if (!element || !property) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
// if document-fragment, skip it and use element.host instead. This happens
|
|
71
|
+
// when the element is inside a shadow root.
|
|
72
|
+
// window.getComputedStyle errors on document-fragment.
|
|
73
|
+
if (element instanceof DocumentFragment) {
|
|
74
|
+
element = element.host;
|
|
75
|
+
}
|
|
76
|
+
let computedStyle = window.getComputedStyle(element);
|
|
77
|
+
let computedStyleProperty = computedStyle.getPropertyValue(property);
|
|
78
|
+
if (computedStyleProperty && computedStyleProperty !== 'inherit') {
|
|
79
|
+
return computedStyleProperty;
|
|
80
|
+
}
|
|
81
|
+
// Ideally getPropertyValue would return the 'used' or 'actual' value, but
|
|
82
|
+
// it doesn't for legacy reasons. So we need to do our own poor man's cascade.
|
|
83
|
+
// Fall back to the first non-'inherit' value found in an ancestor.
|
|
84
|
+
// In any case, getPropertyValue will not return 'initial'.
|
|
85
|
+
// FIXME: will this incorrectly inherit non-inheritable CSS properties?
|
|
86
|
+
// I think all important non-inheritable properties (width, height, etc.)
|
|
87
|
+
// for our purposes here are specially resolved, so this may not be an issue.
|
|
88
|
+
// Specification is here: https://drafts.csswg.org/cssom/#resolved-values
|
|
89
|
+
let parentElement = parentElementForElement(element);
|
|
90
|
+
return cascadedStylePropertyForElement(parentElement, property);
|
|
91
|
+
}
|
|
92
|
+
function elementSubtreeHasNonZeroDimensions(element) {
|
|
93
|
+
let boundingBox = element.getBoundingClientRect();
|
|
94
|
+
if (boundingBox.width > 0 && boundingBox.height > 0) {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
// Paths can have a zero width or height. Treat them as shown if the stroke width is positive.
|
|
98
|
+
if (element.tagName.toUpperCase() === 'PATH' && boundingBox.width + boundingBox.height > 0) {
|
|
99
|
+
let strokeWidth = cascadedStylePropertyForElement(element, 'stroke-width');
|
|
100
|
+
return !!strokeWidth && (parseInt(strokeWidth, 10) > 0);
|
|
101
|
+
}
|
|
102
|
+
let cascadedOverflow = cascadedStylePropertyForElement(element, 'overflow');
|
|
103
|
+
if (cascadedOverflow === 'hidden') {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
// If the container's overflow is not hidden and it has zero size, consider the
|
|
107
|
+
// container to have non-zero dimensions if a child node has non-zero dimensions.
|
|
108
|
+
return Array.from(element.childNodes).some((childNode) => {
|
|
109
|
+
if (childNode.nodeType === Node.TEXT_NODE) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
if (nodeIsElement(childNode)) {
|
|
113
|
+
return elementSubtreeHasNonZeroDimensions(childNode);
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function elementOverflowsContainer(element) {
|
|
119
|
+
let cascadedOverflow = cascadedStylePropertyForElement(element, 'overflow');
|
|
120
|
+
if (cascadedOverflow !== 'hidden') {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
// FIXME: this needs to take into account the scroll position of the element,
|
|
124
|
+
// the display modes of it and its ancestors, and the container it overflows.
|
|
125
|
+
// See Selenium's bot.dom.getOverflowState atom for an exhaustive list of edge cases.
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
function isElementSubtreeHiddenByOverflow(element) {
|
|
129
|
+
if (!element) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
if (!elementOverflowsContainer(element)) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
if (!element.childNodes.length) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
// This element's subtree is hidden by overflow if all child subtrees are as well.
|
|
139
|
+
return Array.from(element.childNodes).every((childNode) => {
|
|
140
|
+
// Returns true if the child node is overflowed or otherwise hidden.
|
|
141
|
+
// Base case: not an element, has zero size, scrolled out, or doesn't overflow container.
|
|
142
|
+
// Visibility of text nodes is controlled by parent
|
|
143
|
+
if (childNode.nodeType === Node.TEXT_NODE) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
if (!nodeIsElement(childNode)) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
if (!elementSubtreeHasNonZeroDimensions(childNode)) {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
// Recurse.
|
|
153
|
+
return isElementSubtreeHiddenByOverflow(childNode);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
// walk up the tree testing for a shadow root
|
|
157
|
+
function isElementInsideShadowRoot(element) {
|
|
158
|
+
if (!element) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
if (element.parentNode && element.parentNode.host) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
return isElementInsideShadowRoot(element.parentNode);
|
|
165
|
+
}
|
|
166
|
+
// This is a partial reimplementation of Selenium's "element is displayed" algorithm.
|
|
167
|
+
// When the W3C specification's algorithm stabilizes, we should implement that.
|
|
168
|
+
// If this command is misdirected to the wrong document (and is NOT inside a shadow root), treat it as not shown.
|
|
169
|
+
if (!isElementInsideShadowRoot(element) && !document.contains(element)) {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
// Special cases for specific tag names.
|
|
173
|
+
switch (element.tagName.toUpperCase()) {
|
|
174
|
+
case 'BODY':
|
|
175
|
+
return true;
|
|
176
|
+
case 'SCRIPT':
|
|
177
|
+
case 'NOSCRIPT':
|
|
178
|
+
return false;
|
|
179
|
+
case 'OPTGROUP':
|
|
180
|
+
case 'OPTION': {
|
|
181
|
+
// Option/optgroup are considered shown if the containing <select> is shown.
|
|
182
|
+
let enclosingSelectElement = enclosingNodeOrSelfMatchingPredicate(element, (e) => e.tagName.toUpperCase() === 'SELECT');
|
|
183
|
+
return isElementDisplayed(enclosingSelectElement);
|
|
184
|
+
}
|
|
185
|
+
case 'INPUT':
|
|
186
|
+
// <input type="hidden"> is considered not shown.
|
|
187
|
+
if (element.type === 'hidden') {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
break;
|
|
191
|
+
// case 'MAP':
|
|
192
|
+
// FIXME: Selenium has special handling for <map> elements. We don't do anything now.
|
|
193
|
+
default:
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
if (cascadedStylePropertyForElement(element, 'visibility') !== 'visible') {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
let hasAncestorWithZeroOpacity = !!enclosingElementOrSelfMatchingPredicate(element, (e) => {
|
|
200
|
+
return Number(cascadedStylePropertyForElement(e, 'opacity')) === 0;
|
|
201
|
+
});
|
|
202
|
+
let hasAncestorWithDisplayNone = !!enclosingElementOrSelfMatchingPredicate(element, (e) => {
|
|
203
|
+
return cascadedStylePropertyForElement(e, 'display') === 'none';
|
|
204
|
+
});
|
|
205
|
+
if (hasAncestorWithZeroOpacity || hasAncestorWithDisplayNone) {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
if (!elementSubtreeHasNonZeroDimensions(element)) {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
if (isElementSubtreeHiddenByOverflow(element)) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
exports.default = isElementDisplayed;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* check if element is within the viewport
|
|
3
|
+
* https://gist.github.com/davidtheclark/5515733#gistcomment-2113205
|
|
4
|
+
*
|
|
5
|
+
* Please update `isElementClickable.js` if the script is updated!
|
|
6
|
+
* @param {HTMLElement} elem element to check
|
|
7
|
+
* @return {Boolean} true if element is within viewport
|
|
8
|
+
*/
|
|
9
|
+
export default function isElementInViewport(elem: HTMLElement): boolean;
|
|
10
|
+
//# sourceMappingURL=isElementInViewport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isElementInViewport.d.ts","sourceRoot":"","sources":["../../src/scripts/isElementInViewport.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAE,IAAI,EAAE,WAAW,WAc7D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* check if element is within the viewport
|
|
5
|
+
* https://gist.github.com/davidtheclark/5515733#gistcomment-2113205
|
|
6
|
+
*
|
|
7
|
+
* Please update `isElementClickable.js` if the script is updated!
|
|
8
|
+
* @param {HTMLElement} elem element to check
|
|
9
|
+
* @return {Boolean} true if element is within viewport
|
|
10
|
+
*/
|
|
11
|
+
function isElementInViewport(elem) {
|
|
12
|
+
if (!elem.getBoundingClientRect) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
const rect = elem.getBoundingClientRect();
|
|
16
|
+
const windowHeight = (window.innerHeight || document.documentElement.clientHeight);
|
|
17
|
+
const windowWidth = (window.innerWidth || document.documentElement.clientWidth);
|
|
18
|
+
const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) > 0);
|
|
19
|
+
const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) > 0);
|
|
20
|
+
return (vertInView && horInView);
|
|
21
|
+
}
|
|
22
|
+
exports.default = isElementInViewport;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isFocused.d.ts","sourceRoot":"","sources":["../../src/scripts/isFocused.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAE,IAAI,EAAE,OAAO,WAE/C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* checks if given element is focused
|
|
5
|
+
* @param {HTMLElement} elem element to check
|
|
6
|
+
* @return {Boolean} true if element is focused
|
|
7
|
+
*/
|
|
8
|
+
function isFocused(elem) {
|
|
9
|
+
return elem === document.activeElement;
|
|
10
|
+
}
|
|
11
|
+
exports.default = isFocused;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* opens new window via window.open
|
|
3
|
+
* @param {String} url The URL to be loaded in the newly opened window.
|
|
4
|
+
* @param {String} windowName A string name for the new window.
|
|
5
|
+
* @param {String} windowFeatures An optional parameter listing the features (size, position, scrollbars, etc.) of the new window as a string.
|
|
6
|
+
*
|
|
7
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window.open
|
|
8
|
+
*/
|
|
9
|
+
export default function newWindow(url: string, windowName: string, windowFeatures: string): void;
|
|
10
|
+
//# sourceMappingURL=newWindow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"newWindow.d.ts","sourceRoot":"","sources":["../../src/scripts/newWindow.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC7B,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,QAGzB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* opens new window via window.open
|
|
5
|
+
* @param {String} url The URL to be loaded in the newly opened window.
|
|
6
|
+
* @param {String} windowName A string name for the new window.
|
|
7
|
+
* @param {String} windowFeatures An optional parameter listing the features (size, position, scrollbars, etc.) of the new window as a string.
|
|
8
|
+
*
|
|
9
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window.open
|
|
10
|
+
*/
|
|
11
|
+
function newWindow(url, windowName, windowFeatures) {
|
|
12
|
+
window.open(url, windowName || '', windowFeatures || '');
|
|
13
|
+
}
|
|
14
|
+
exports.default = newWindow;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const waitToLoadReact: () => void;
|
|
2
|
+
export declare const react$: (selector: string, props: any[], state: Record<string, any>, reactElement: HTMLElement) => HTMLElement | {
|
|
3
|
+
message: string;
|
|
4
|
+
} | null;
|
|
5
|
+
export declare const react$$: (selector: string, props: any[], state: Record<string, string>, reactElement: HTMLElement) => HTMLElement[];
|
|
6
|
+
//# sourceMappingURL=resq.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resq.d.ts","sourceRoot":"","sources":["../../src/scripts/resq.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,YAE3B,CAAA;AAED,eAAO,MAAM,MAAM,aACL,MAAM,SACT,GAAG,EAAE,SACL,OAAO,MAAM,EAAE,GAAG,CAAC,gBACZ,WAAW;;QA0B5B,CAAA;AAED,eAAO,MAAM,OAAO,aACN,MAAM,SACT,GAAG,EAAE,SACL,OAAO,MAAM,EAAE,MAAM,CAAC,gBACf,WAAW,kBAkC5B,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.react$$ = exports.react$ = exports.waitToLoadReact = void 0;
|
|
4
|
+
const waitToLoadReact = function waitToLoadReact() {
|
|
5
|
+
window.resq.waitToLoadReact();
|
|
6
|
+
};
|
|
7
|
+
exports.waitToLoadReact = waitToLoadReact;
|
|
8
|
+
const react$ = function react$(selector, props, state, reactElement) {
|
|
9
|
+
props = props || {};
|
|
10
|
+
state = state || {};
|
|
11
|
+
let element = window.resq.resq$(selector, reactElement);
|
|
12
|
+
if (Object.keys(props).length) {
|
|
13
|
+
// not yet typed https://github.com/baruchvlz/resq/issues/69
|
|
14
|
+
element = element.byProps(props);
|
|
15
|
+
}
|
|
16
|
+
if (Object.keys(state).length) {
|
|
17
|
+
// not yet typed https://github.com/baruchvlz/resq/issues/69
|
|
18
|
+
element = element.byState(state);
|
|
19
|
+
}
|
|
20
|
+
if (!element.name) {
|
|
21
|
+
return { message: `React element with selector "${selector}" wasn't found` };
|
|
22
|
+
}
|
|
23
|
+
// resq returns an array of HTMLElements if the React component is a fragment
|
|
24
|
+
// if the element is a fragment, we return the first child to be passed into the driver
|
|
25
|
+
return element.isFragment && element.node
|
|
26
|
+
? element.node[0]
|
|
27
|
+
: element.node;
|
|
28
|
+
};
|
|
29
|
+
exports.react$ = react$;
|
|
30
|
+
const react$$ = function react$$(selector, props, state, reactElement) {
|
|
31
|
+
let elements = window.resq.resq$$(selector, reactElement);
|
|
32
|
+
if (Object.keys(props).length) {
|
|
33
|
+
// not yet typed https://github.com/baruchvlz/resq/issues/69
|
|
34
|
+
elements = elements.byProps(props);
|
|
35
|
+
}
|
|
36
|
+
if (Object.keys(state).length) {
|
|
37
|
+
// not yet typed https://github.com/baruchvlz/resq/issues/69
|
|
38
|
+
elements = elements.byState(state);
|
|
39
|
+
}
|
|
40
|
+
if (!elements.length) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
// resq returns an array of HTMLElements if the React component is a fragment
|
|
44
|
+
// this avoids having nested arrays of nodes which the driver does not understand
|
|
45
|
+
// [[div, div], [div, div]] => [div, div, div, div]
|
|
46
|
+
let nodes = [];
|
|
47
|
+
elements.forEach(element => {
|
|
48
|
+
const { node, isFragment } = element;
|
|
49
|
+
if (isFragment) {
|
|
50
|
+
nodes = nodes.concat(node || []);
|
|
51
|
+
}
|
|
52
|
+
else if (node) {
|
|
53
|
+
nodes.push(node);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return [...nodes];
|
|
57
|
+
};
|
|
58
|
+
exports.react$$ = react$$;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shadowFnFactory.d.ts","sourceRoot":"","sources":["../../src/scripts/shadowFnFactory.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,eAAe,oBAA6B,MAAM,yBAW9D,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shadowFnFactory = void 0;
|
|
4
|
+
// generate a function that can be used to query shadowRoots
|
|
5
|
+
const shadowFnFactory = function (elementSelector, qsAll = false) {
|
|
6
|
+
const strFn = `
|
|
7
|
+
(function() {
|
|
8
|
+
// element has a shadowRoot property
|
|
9
|
+
if (this.shadowRoot) {
|
|
10
|
+
return this.shadowRoot.querySelector${qsAll ? 'All' : ''}('${elementSelector}')
|
|
11
|
+
}
|
|
12
|
+
// fall back to querying the element directly if not
|
|
13
|
+
return this.querySelector${qsAll ? 'All' : ''}('${elementSelector}')
|
|
14
|
+
})`;
|
|
15
|
+
return eval(strFn);
|
|
16
|
+
};
|
|
17
|
+
exports.shadowFnFactory = shadowFnFactory;
|