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.
Files changed (358) hide show
  1. package/build/commands/browser/$$.d.ts +50 -0
  2. package/build/commands/browser/$$.d.ts.map +1 -0
  3. package/build/commands/browser/$$.js +57 -0
  4. package/build/commands/browser/$.d.ts +77 -0
  5. package/build/commands/browser/$.d.ts.map +1 -0
  6. package/build/commands/browser/$.js +91 -0
  7. package/build/commands/browser/addCommand.d.ts +37 -0
  8. package/build/commands/browser/addCommand.d.ts.map +1 -0
  9. package/build/commands/browser/addCommand.js +37 -0
  10. package/build/commands/browser/call.d.ts +42 -0
  11. package/build/commands/browser/call.d.ts.map +1 -0
  12. package/build/commands/browser/call.js +49 -0
  13. package/build/commands/browser/custom$$.d.ts +26 -0
  14. package/build/commands/browser/custom$$.d.ts.map +1 -0
  15. package/build/commands/browser/custom$$.js +47 -0
  16. package/build/commands/browser/custom$.d.ts +25 -0
  17. package/build/commands/browser/custom$.d.ts.map +1 -0
  18. package/build/commands/browser/custom$.js +47 -0
  19. package/build/commands/browser/debug.d.ts +32 -0
  20. package/build/commands/browser/debug.d.ts.map +1 -0
  21. package/build/commands/browser/debug.js +108 -0
  22. package/build/commands/browser/deleteCookies.d.ts +45 -0
  23. package/build/commands/browser/deleteCookies.d.ts.map +1 -0
  24. package/build/commands/browser/deleteCookies.js +56 -0
  25. package/build/commands/browser/execute.d.ts +37 -0
  26. package/build/commands/browser/execute.d.ts.map +1 -0
  27. package/build/commands/browser/execute.js +55 -0
  28. package/build/commands/browser/executeAsync.d.ts +45 -0
  29. package/build/commands/browser/executeAsync.d.ts.map +1 -0
  30. package/build/commands/browser/executeAsync.js +63 -0
  31. package/build/commands/browser/getCookies.d.ts +34 -0
  32. package/build/commands/browser/getCookies.d.ts.map +1 -0
  33. package/build/commands/browser/getCookies.js +46 -0
  34. package/build/commands/browser/getPuppeteer.d.ts +38 -0
  35. package/build/commands/browser/getPuppeteer.d.ts.map +1 -0
  36. package/build/commands/browser/getPuppeteer.js +119 -0
  37. package/build/commands/browser/getWindowSize.d.ts +25 -0
  38. package/build/commands/browser/getWindowSize.d.ts.map +1 -0
  39. package/build/commands/browser/getWindowSize.js +30 -0
  40. package/build/commands/browser/keys.d.ts +28 -0
  41. package/build/commands/browser/keys.d.ts.map +1 -0
  42. package/build/commands/browser/keys.js +64 -0
  43. package/build/commands/browser/mock.d.ts +111 -0
  44. package/build/commands/browser/mock.d.ts.map +1 -0
  45. package/build/commands/browser/mock.js +164 -0
  46. package/build/commands/browser/mockClearAll.d.ts +28 -0
  47. package/build/commands/browser/mockClearAll.d.ts.map +1 -0
  48. package/build/commands/browser/mockClearAll.js +43 -0
  49. package/build/commands/browser/mockRestoreAll.d.ts +26 -0
  50. package/build/commands/browser/mockRestoreAll.d.ts.map +1 -0
  51. package/build/commands/browser/mockRestoreAll.js +41 -0
  52. package/build/commands/browser/newWindow.d.ts +41 -0
  53. package/build/commands/browser/newWindow.d.ts.map +1 -0
  54. package/build/commands/browser/newWindow.js +83 -0
  55. package/build/commands/browser/overwriteCommand.d.ts +32 -0
  56. package/build/commands/browser/overwriteCommand.d.ts.map +1 -0
  57. package/build/commands/browser/overwriteCommand.js +32 -0
  58. package/build/commands/browser/pause.d.ts +23 -0
  59. package/build/commands/browser/pause.d.ts.map +1 -0
  60. package/build/commands/browser/pause.js +27 -0
  61. package/build/commands/browser/react$$.d.ts +36 -0
  62. package/build/commands/browser/react$$.d.ts.map +1 -0
  63. package/build/commands/browser/react$$.js +51 -0
  64. package/build/commands/browser/react$.d.ts +46 -0
  65. package/build/commands/browser/react$.d.ts.map +1 -0
  66. package/build/commands/browser/react$.js +59 -0
  67. package/build/commands/browser/reloadSession.d.ts +23 -0
  68. package/build/commands/browser/reloadSession.d.ts.map +1 -0
  69. package/build/commands/browser/reloadSession.js +58 -0
  70. package/build/commands/browser/savePDF.d.ts +46 -0
  71. package/build/commands/browser/savePDF.d.ts.map +1 -0
  72. package/build/commands/browser/savePDF.js +51 -0
  73. package/build/commands/browser/saveRecordingScreen.d.ts +28 -0
  74. package/build/commands/browser/saveRecordingScreen.d.ts.map +1 -0
  75. package/build/commands/browser/saveRecordingScreen.js +47 -0
  76. package/build/commands/browser/saveScreenshot.d.ts +22 -0
  77. package/build/commands/browser/saveScreenshot.d.ts.map +1 -0
  78. package/build/commands/browser/saveScreenshot.js +41 -0
  79. package/build/commands/browser/setCookies.d.ts +57 -0
  80. package/build/commands/browser/setCookies.d.ts.map +1 -0
  81. package/build/commands/browser/setCookies.js +66 -0
  82. package/build/commands/browser/setTimeout.d.ts +31 -0
  83. package/build/commands/browser/setTimeout.d.ts.map +1 -0
  84. package/build/commands/browser/setTimeout.js +61 -0
  85. package/build/commands/browser/setWindowSize.d.ts +20 -0
  86. package/build/commands/browser/setWindowSize.d.ts.map +1 -0
  87. package/build/commands/browser/setWindowSize.js +43 -0
  88. package/build/commands/browser/switchWindow.d.ts +30 -0
  89. package/build/commands/browser/switchWindow.d.ts.map +1 -0
  90. package/build/commands/browser/switchWindow.js +73 -0
  91. package/build/commands/browser/throttle.d.ts +3 -0
  92. package/build/commands/browser/throttle.d.ts.map +1 -0
  93. package/build/commands/browser/throttle.js +144 -0
  94. package/build/commands/browser/touchAction.d.ts +61 -0
  95. package/build/commands/browser/touchAction.d.ts.map +1 -0
  96. package/build/commands/browser/touchAction.js +65 -0
  97. package/build/commands/browser/uploadFile.d.ts +32 -0
  98. package/build/commands/browser/uploadFile.d.ts.map +1 -0
  99. package/build/commands/browser/uploadFile.js +63 -0
  100. package/build/commands/browser/url.d.ts +38 -0
  101. package/build/commands/browser/url.d.ts.map +1 -0
  102. package/build/commands/browser/url.js +49 -0
  103. package/build/commands/browser/waitUntil.d.ts +44 -0
  104. package/build/commands/browser/waitUntil.d.ts.map +1 -0
  105. package/build/commands/browser/waitUntil.js +73 -0
  106. package/build/commands/browser.d.ts +70 -0
  107. package/build/commands/browser.d.ts.map +1 -0
  108. package/build/commands/browser.js +44 -0
  109. package/build/commands/constant.d.ts +19 -0
  110. package/build/commands/constant.d.ts.map +1 -0
  111. package/build/commands/constant.js +91 -0
  112. package/build/commands/element/$$.d.ts +46 -0
  113. package/build/commands/element/$$.d.ts.map +1 -0
  114. package/build/commands/element/$$.js +50 -0
  115. package/build/commands/element/$.d.ts +72 -0
  116. package/build/commands/element/$.d.ts.map +1 -0
  117. package/build/commands/element/$.js +76 -0
  118. package/build/commands/element/addValue.d.ts +33 -0
  119. package/build/commands/element/addValue.d.ts.map +1 -0
  120. package/build/commands/element/addValue.js +48 -0
  121. package/build/commands/element/clearValue.d.ts +28 -0
  122. package/build/commands/element/clearValue.d.ts.map +1 -0
  123. package/build/commands/element/clearValue.js +32 -0
  124. package/build/commands/element/click.d.ts +73 -0
  125. package/build/commands/element/click.d.ts.map +1 -0
  126. package/build/commands/element/click.js +134 -0
  127. package/build/commands/element/custom$$.d.ts +28 -0
  128. package/build/commands/element/custom$$.d.ts.map +1 -0
  129. package/build/commands/element/custom$$.js +57 -0
  130. package/build/commands/element/custom$.d.ts +27 -0
  131. package/build/commands/element/custom$.d.ts.map +1 -0
  132. package/build/commands/element/custom$.js +57 -0
  133. package/build/commands/element/doubleClick.d.ts +25 -0
  134. package/build/commands/element/doubleClick.d.ts.map +1 -0
  135. package/build/commands/element/doubleClick.js +51 -0
  136. package/build/commands/element/dragAndDrop.d.ts +41 -0
  137. package/build/commands/element/dragAndDrop.d.ts.map +1 -0
  138. package/build/commands/element/dragAndDrop.js +98 -0
  139. package/build/commands/element/getAttribute.d.ts +28 -0
  140. package/build/commands/element/getAttribute.d.ts.map +1 -0
  141. package/build/commands/element/getAttribute.js +32 -0
  142. package/build/commands/element/getCSSProperty.d.ts +71 -0
  143. package/build/commands/element/getCSSProperty.d.ts.map +1 -0
  144. package/build/commands/element/getCSSProperty.js +108 -0
  145. package/build/commands/element/getComputedLabel.d.ts +20 -0
  146. package/build/commands/element/getComputedLabel.d.ts.map +1 -0
  147. package/build/commands/element/getComputedLabel.js +24 -0
  148. package/build/commands/element/getComputedRole.d.ts +20 -0
  149. package/build/commands/element/getComputedRole.d.ts.map +1 -0
  150. package/build/commands/element/getComputedRole.js +24 -0
  151. package/build/commands/element/getHTML.d.ts +32 -0
  152. package/build/commands/element/getHTML.d.ts.map +1 -0
  153. package/build/commands/element/getHTML.js +46 -0
  154. package/build/commands/element/getLocation.d.ts +6 -0
  155. package/build/commands/element/getLocation.d.ts.map +1 -0
  156. package/build/commands/element/getLocation.js +46 -0
  157. package/build/commands/element/getProperty.d.ts +53 -0
  158. package/build/commands/element/getProperty.d.ts.map +1 -0
  159. package/build/commands/element/getProperty.js +31 -0
  160. package/build/commands/element/getSize.d.ts +6 -0
  161. package/build/commands/element/getSize.d.ts.map +1 -0
  162. package/build/commands/element/getSize.js +47 -0
  163. package/build/commands/element/getTagName.d.ts +25 -0
  164. package/build/commands/element/getTagName.d.ts.map +1 -0
  165. package/build/commands/element/getTagName.js +29 -0
  166. package/build/commands/element/getText.d.ts +42 -0
  167. package/build/commands/element/getText.d.ts.map +1 -0
  168. package/build/commands/element/getText.js +46 -0
  169. package/build/commands/element/getValue.d.ts +25 -0
  170. package/build/commands/element/getValue.d.ts.map +1 -0
  171. package/build/commands/element/getValue.js +33 -0
  172. package/build/commands/element/isClickable.d.ts +40 -0
  173. package/build/commands/element/isClickable.d.ts.map +1 -0
  174. package/build/commands/element/isClickable.js +57 -0
  175. package/build/commands/element/isDisplayed.d.ts +50 -0
  176. package/build/commands/element/isDisplayed.d.ts.map +1 -0
  177. package/build/commands/element/isDisplayed.js +85 -0
  178. package/build/commands/element/isDisplayedInViewport.d.ts +38 -0
  179. package/build/commands/element/isDisplayedInViewport.d.ts.map +1 -0
  180. package/build/commands/element/isDisplayedInViewport.js +55 -0
  181. package/build/commands/element/isEnabled.d.ts +34 -0
  182. package/build/commands/element/isEnabled.d.ts.map +1 -0
  183. package/build/commands/element/isEnabled.js +38 -0
  184. package/build/commands/element/isEqual.d.ts +24 -0
  185. package/build/commands/element/isEqual.d.ts.map +1 -0
  186. package/build/commands/element/isEqual.js +52 -0
  187. package/build/commands/element/isExisting.d.ts +49 -0
  188. package/build/commands/element/isExisting.d.ts.map +1 -0
  189. package/build/commands/element/isExisting.js +65 -0
  190. package/build/commands/element/isFocused.d.ts +28 -0
  191. package/build/commands/element/isFocused.d.ts.map +1 -0
  192. package/build/commands/element/isFocused.js +42 -0
  193. package/build/commands/element/isSelected.d.ts +31 -0
  194. package/build/commands/element/isSelected.d.ts.map +1 -0
  195. package/build/commands/element/isSelected.js +35 -0
  196. package/build/commands/element/moveTo.d.ts +21 -0
  197. package/build/commands/element/moveTo.d.ts.map +1 -0
  198. package/build/commands/element/moveTo.js +39 -0
  199. package/build/commands/element/nextElement.d.ts +25 -0
  200. package/build/commands/element/nextElement.d.ts.map +1 -0
  201. package/build/commands/element/nextElement.js +31 -0
  202. package/build/commands/element/parentElement.d.ts +25 -0
  203. package/build/commands/element/parentElement.d.ts.map +1 -0
  204. package/build/commands/element/parentElement.js +31 -0
  205. package/build/commands/element/previousElement.d.ts +25 -0
  206. package/build/commands/element/previousElement.d.ts.map +1 -0
  207. package/build/commands/element/previousElement.js +31 -0
  208. package/build/commands/element/react$$.d.ts +36 -0
  209. package/build/commands/element/react$$.d.ts.map +1 -0
  210. package/build/commands/element/react$$.js +51 -0
  211. package/build/commands/element/react$.d.ts +46 -0
  212. package/build/commands/element/react$.d.ts.map +1 -0
  213. package/build/commands/element/react$.js +59 -0
  214. package/build/commands/element/saveScreenshot.d.ts +21 -0
  215. package/build/commands/element/saveScreenshot.d.ts.map +1 -0
  216. package/build/commands/element/saveScreenshot.js +40 -0
  217. package/build/commands/element/scrollIntoView.d.ts +21 -0
  218. package/build/commands/element/scrollIntoView.d.ts.map +1 -0
  219. package/build/commands/element/scrollIntoView.js +31 -0
  220. package/build/commands/element/selectByAttribute.d.ts +37 -0
  221. package/build/commands/element/selectByAttribute.d.ts.map +1 -0
  222. package/build/commands/element/selectByAttribute.js +59 -0
  223. package/build/commands/element/selectByIndex.d.ts +31 -0
  224. package/build/commands/element/selectByIndex.d.ts.map +1 -0
  225. package/build/commands/element/selectByIndex.js +55 -0
  226. package/build/commands/element/selectByVisibleText.d.ts +31 -0
  227. package/build/commands/element/selectByVisibleText.d.ts.map +1 -0
  228. package/build/commands/element/selectByVisibleText.js +66 -0
  229. package/build/commands/element/setValue.d.ts +29 -0
  230. package/build/commands/element/setValue.d.ts.map +1 -0
  231. package/build/commands/element/setValue.js +33 -0
  232. package/build/commands/element/shadow$$.d.ts +22 -0
  233. package/build/commands/element/shadow$$.d.ts.map +1 -0
  234. package/build/commands/element/shadow$$.js +27 -0
  235. package/build/commands/element/shadow$.d.ts +22 -0
  236. package/build/commands/element/shadow$.d.ts.map +1 -0
  237. package/build/commands/element/shadow$.js +27 -0
  238. package/build/commands/element/touchAction.d.ts +54 -0
  239. package/build/commands/element/touchAction.d.ts.map +1 -0
  240. package/build/commands/element/touchAction.js +58 -0
  241. package/build/commands/element/waitForClickable.d.ts +34 -0
  242. package/build/commands/element/waitForClickable.d.ts.map +1 -0
  243. package/build/commands/element/waitForClickable.js +37 -0
  244. package/build/commands/element/waitForDisplayed.d.ts +44 -0
  245. package/build/commands/element/waitForDisplayed.d.ts.map +1 -0
  246. package/build/commands/element/waitForDisplayed.js +47 -0
  247. package/build/commands/element/waitForEnabled.d.ts +46 -0
  248. package/build/commands/element/waitForEnabled.d.ts.map +1 -0
  249. package/build/commands/element/waitForEnabled.js +55 -0
  250. package/build/commands/element/waitForExist.d.ts +46 -0
  251. package/build/commands/element/waitForExist.d.ts.map +1 -0
  252. package/build/commands/element/waitForExist.js +49 -0
  253. package/build/commands/element/waitUntil.d.ts +49 -0
  254. package/build/commands/element/waitUntil.d.ts.map +1 -0
  255. package/build/commands/element/waitUntil.js +53 -0
  256. package/build/commands/element.d.ts +100 -0
  257. package/build/commands/element.d.ts.map +1 -0
  258. package/build/commands/element.js +63 -0
  259. package/build/commands/mock/abort.d.ts +19 -0
  260. package/build/commands/mock/abort.d.ts.map +1 -0
  261. package/build/commands/mock/abort.js +20 -0
  262. package/build/commands/mock/abortOnce.d.ts +27 -0
  263. package/build/commands/mock/abortOnce.d.ts.map +1 -0
  264. package/build/commands/mock/abortOnce.js +28 -0
  265. package/build/commands/mock/clear.d.ts +18 -0
  266. package/build/commands/mock/clear.d.ts.map +1 -0
  267. package/build/commands/mock/clear.js +19 -0
  268. package/build/commands/mock/respond.d.ts +54 -0
  269. package/build/commands/mock/respond.d.ts.map +1 -0
  270. package/build/commands/mock/respond.js +55 -0
  271. package/build/commands/mock/respondOnce.d.ts +55 -0
  272. package/build/commands/mock/respondOnce.d.ts.map +1 -0
  273. package/build/commands/mock/respondOnce.js +56 -0
  274. package/build/commands/mock/restore.d.ts +18 -0
  275. package/build/commands/mock/restore.d.ts.map +1 -0
  276. package/build/commands/mock/restore.js +19 -0
  277. package/build/constants.d.ts +14 -0
  278. package/build/constants.d.ts.map +1 -0
  279. package/build/constants.js +286 -0
  280. package/build/index.d.ts +45 -0
  281. package/build/index.d.ts.map +1 -0
  282. package/build/index.js +175 -0
  283. package/build/middlewares.d.ts +12 -0
  284. package/build/middlewares.d.ts.map +1 -0
  285. package/build/middlewares.js +65 -0
  286. package/build/multiremote.d.ts +71 -0
  287. package/build/multiremote.d.ts.map +1 -0
  288. package/build/multiremote.js +160 -0
  289. package/build/protocol-stub.d.ts +16 -0
  290. package/build/protocol-stub.d.ts.map +1 -0
  291. package/build/protocol-stub.js +77 -0
  292. package/build/scripts/getHTML.d.ts +9 -0
  293. package/build/scripts/getHTML.d.ts.map +1 -0
  294. package/build/scripts/getHTML.js +13 -0
  295. package/build/scripts/getProperty.d.ts +43 -0
  296. package/build/scripts/getProperty.d.ts.map +1 -0
  297. package/build/scripts/getProperty.js +12 -0
  298. package/build/scripts/isElementClickable.d.ts +7 -0
  299. package/build/scripts/isElementClickable.d.ts.map +1 -0
  300. package/build/scripts/isElementClickable.js +121 -0
  301. package/build/scripts/isElementDisplayed.d.ts +7 -0
  302. package/build/scripts/isElementDisplayed.d.ts.map +1 -0
  303. package/build/scripts/isElementDisplayed.js +216 -0
  304. package/build/scripts/isElementInViewport.d.ts +10 -0
  305. package/build/scripts/isElementInViewport.d.ts.map +1 -0
  306. package/build/scripts/isElementInViewport.js +22 -0
  307. package/build/scripts/isFocused.d.ts +7 -0
  308. package/build/scripts/isFocused.d.ts.map +1 -0
  309. package/build/scripts/isFocused.js +11 -0
  310. package/build/scripts/newWindow.d.ts +10 -0
  311. package/build/scripts/newWindow.d.ts.map +1 -0
  312. package/build/scripts/newWindow.js +14 -0
  313. package/build/scripts/resq.d.ts +6 -0
  314. package/build/scripts/resq.d.ts.map +1 -0
  315. package/build/scripts/resq.js +58 -0
  316. package/build/scripts/shadowFnFactory.d.ts +2 -0
  317. package/build/scripts/shadowFnFactory.d.ts.map +1 -0
  318. package/build/scripts/shadowFnFactory.js +17 -0
  319. package/build/types.d.ts +402 -0
  320. package/build/types.d.ts.map +1 -0
  321. package/build/types.js +2 -0
  322. package/build/utils/SevereServiceError.d.ts +7 -0
  323. package/build/utils/SevereServiceError.d.ts.map +1 -0
  324. package/build/utils/SevereServiceError.js +12 -0
  325. package/build/utils/Timer.d.ts +33 -0
  326. package/build/utils/Timer.d.ts.map +1 -0
  327. package/build/utils/Timer.js +126 -0
  328. package/build/utils/detectBackend.d.ts +23 -0
  329. package/build/utils/detectBackend.d.ts.map +1 -0
  330. package/build/utils/detectBackend.js +119 -0
  331. package/build/utils/findStrategy.d.ts +10 -0
  332. package/build/utils/findStrategy.d.ts.map +1 -0
  333. package/build/utils/findStrategy.js +267 -0
  334. package/build/utils/getElementObject.d.ts +17 -0
  335. package/build/utils/getElementObject.d.ts.map +1 -0
  336. package/build/utils/getElementObject.js +107 -0
  337. package/build/utils/implicitWait.d.ts +7 -0
  338. package/build/utils/implicitWait.d.ts.map +1 -0
  339. package/build/utils/implicitWait.js +39 -0
  340. package/build/utils/index.d.ts +102 -0
  341. package/build/utils/index.d.ts.map +1 -0
  342. package/build/utils/index.js +543 -0
  343. package/build/utils/interception/devtools.d.ts +61 -0
  344. package/build/utils/interception/devtools.d.ts.map +1 -0
  345. package/build/utils/interception/devtools.js +247 -0
  346. package/build/utils/interception/index.d.ts +26 -0
  347. package/build/utils/interception/index.d.ts.map +1 -0
  348. package/build/utils/interception/index.js +49 -0
  349. package/build/utils/interception/types.d.ts +94 -0
  350. package/build/utils/interception/types.d.ts.map +1 -0
  351. package/build/utils/interception/types.js +2 -0
  352. package/build/utils/interception/webdriver.d.ts +48 -0
  353. package/build/utils/interception/webdriver.d.ts.map +1 -0
  354. package/build/utils/interception/webdriver.js +75 -0
  355. package/build/utils/refetchElement.d.ts +6 -0
  356. package/build/utils/refetchElement.d.ts.map +1 -0
  357. package/build/utils/refetchElement.js +32 -0
  358. 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,7 @@
1
+ /**
2
+ * checks if given element is focused
3
+ * @param {HTMLElement} elem element to check
4
+ * @return {Boolean} true if element is focused
5
+ */
6
+ export default function isFocused(elem: Element): boolean;
7
+ //# sourceMappingURL=isFocused.d.ts.map
@@ -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,2 @@
1
+ export declare const shadowFnFactory: (elementSelector: string, qsAll?: boolean) => any;
2
+ //# sourceMappingURL=shadowFnFactory.d.ts.map
@@ -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;