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.
Files changed (358) hide show
  1. package/package.json +7 -7
  2. package/build/commands/browser/$$.d.ts +0 -50
  3. package/build/commands/browser/$$.d.ts.map +0 -1
  4. package/build/commands/browser/$$.js +0 -57
  5. package/build/commands/browser/$.d.ts +0 -77
  6. package/build/commands/browser/$.d.ts.map +0 -1
  7. package/build/commands/browser/$.js +0 -91
  8. package/build/commands/browser/addCommand.d.ts +0 -37
  9. package/build/commands/browser/addCommand.d.ts.map +0 -1
  10. package/build/commands/browser/addCommand.js +0 -37
  11. package/build/commands/browser/call.d.ts +0 -42
  12. package/build/commands/browser/call.d.ts.map +0 -1
  13. package/build/commands/browser/call.js +0 -49
  14. package/build/commands/browser/custom$$.d.ts +0 -26
  15. package/build/commands/browser/custom$$.d.ts.map +0 -1
  16. package/build/commands/browser/custom$$.js +0 -47
  17. package/build/commands/browser/custom$.d.ts +0 -25
  18. package/build/commands/browser/custom$.d.ts.map +0 -1
  19. package/build/commands/browser/custom$.js +0 -47
  20. package/build/commands/browser/debug.d.ts +0 -32
  21. package/build/commands/browser/debug.d.ts.map +0 -1
  22. package/build/commands/browser/debug.js +0 -108
  23. package/build/commands/browser/deleteCookies.d.ts +0 -45
  24. package/build/commands/browser/deleteCookies.d.ts.map +0 -1
  25. package/build/commands/browser/deleteCookies.js +0 -56
  26. package/build/commands/browser/execute.d.ts +0 -37
  27. package/build/commands/browser/execute.d.ts.map +0 -1
  28. package/build/commands/browser/execute.js +0 -55
  29. package/build/commands/browser/executeAsync.d.ts +0 -45
  30. package/build/commands/browser/executeAsync.d.ts.map +0 -1
  31. package/build/commands/browser/executeAsync.js +0 -63
  32. package/build/commands/browser/getCookies.d.ts +0 -34
  33. package/build/commands/browser/getCookies.d.ts.map +0 -1
  34. package/build/commands/browser/getCookies.js +0 -46
  35. package/build/commands/browser/getPuppeteer.d.ts +0 -38
  36. package/build/commands/browser/getPuppeteer.d.ts.map +0 -1
  37. package/build/commands/browser/getPuppeteer.js +0 -119
  38. package/build/commands/browser/getWindowSize.d.ts +0 -25
  39. package/build/commands/browser/getWindowSize.d.ts.map +0 -1
  40. package/build/commands/browser/getWindowSize.js +0 -30
  41. package/build/commands/browser/keys.d.ts +0 -28
  42. package/build/commands/browser/keys.d.ts.map +0 -1
  43. package/build/commands/browser/keys.js +0 -64
  44. package/build/commands/browser/mock.d.ts +0 -111
  45. package/build/commands/browser/mock.d.ts.map +0 -1
  46. package/build/commands/browser/mock.js +0 -164
  47. package/build/commands/browser/mockClearAll.d.ts +0 -28
  48. package/build/commands/browser/mockClearAll.d.ts.map +0 -1
  49. package/build/commands/browser/mockClearAll.js +0 -43
  50. package/build/commands/browser/mockRestoreAll.d.ts +0 -26
  51. package/build/commands/browser/mockRestoreAll.d.ts.map +0 -1
  52. package/build/commands/browser/mockRestoreAll.js +0 -41
  53. package/build/commands/browser/newWindow.d.ts +0 -41
  54. package/build/commands/browser/newWindow.d.ts.map +0 -1
  55. package/build/commands/browser/newWindow.js +0 -83
  56. package/build/commands/browser/overwriteCommand.d.ts +0 -32
  57. package/build/commands/browser/overwriteCommand.d.ts.map +0 -1
  58. package/build/commands/browser/overwriteCommand.js +0 -32
  59. package/build/commands/browser/pause.d.ts +0 -23
  60. package/build/commands/browser/pause.d.ts.map +0 -1
  61. package/build/commands/browser/pause.js +0 -27
  62. package/build/commands/browser/react$$.d.ts +0 -36
  63. package/build/commands/browser/react$$.d.ts.map +0 -1
  64. package/build/commands/browser/react$$.js +0 -51
  65. package/build/commands/browser/react$.d.ts +0 -46
  66. package/build/commands/browser/react$.d.ts.map +0 -1
  67. package/build/commands/browser/react$.js +0 -59
  68. package/build/commands/browser/reloadSession.d.ts +0 -23
  69. package/build/commands/browser/reloadSession.d.ts.map +0 -1
  70. package/build/commands/browser/reloadSession.js +0 -58
  71. package/build/commands/browser/savePDF.d.ts +0 -46
  72. package/build/commands/browser/savePDF.d.ts.map +0 -1
  73. package/build/commands/browser/savePDF.js +0 -51
  74. package/build/commands/browser/saveRecordingScreen.d.ts +0 -28
  75. package/build/commands/browser/saveRecordingScreen.d.ts.map +0 -1
  76. package/build/commands/browser/saveRecordingScreen.js +0 -47
  77. package/build/commands/browser/saveScreenshot.d.ts +0 -22
  78. package/build/commands/browser/saveScreenshot.d.ts.map +0 -1
  79. package/build/commands/browser/saveScreenshot.js +0 -41
  80. package/build/commands/browser/setCookies.d.ts +0 -57
  81. package/build/commands/browser/setCookies.d.ts.map +0 -1
  82. package/build/commands/browser/setCookies.js +0 -66
  83. package/build/commands/browser/setTimeout.d.ts +0 -31
  84. package/build/commands/browser/setTimeout.d.ts.map +0 -1
  85. package/build/commands/browser/setTimeout.js +0 -61
  86. package/build/commands/browser/setWindowSize.d.ts +0 -20
  87. package/build/commands/browser/setWindowSize.d.ts.map +0 -1
  88. package/build/commands/browser/setWindowSize.js +0 -43
  89. package/build/commands/browser/switchWindow.d.ts +0 -30
  90. package/build/commands/browser/switchWindow.d.ts.map +0 -1
  91. package/build/commands/browser/switchWindow.js +0 -73
  92. package/build/commands/browser/throttle.d.ts +0 -3
  93. package/build/commands/browser/throttle.d.ts.map +0 -1
  94. package/build/commands/browser/throttle.js +0 -144
  95. package/build/commands/browser/touchAction.d.ts +0 -61
  96. package/build/commands/browser/touchAction.d.ts.map +0 -1
  97. package/build/commands/browser/touchAction.js +0 -65
  98. package/build/commands/browser/uploadFile.d.ts +0 -32
  99. package/build/commands/browser/uploadFile.d.ts.map +0 -1
  100. package/build/commands/browser/uploadFile.js +0 -63
  101. package/build/commands/browser/url.d.ts +0 -38
  102. package/build/commands/browser/url.d.ts.map +0 -1
  103. package/build/commands/browser/url.js +0 -49
  104. package/build/commands/browser/waitUntil.d.ts +0 -44
  105. package/build/commands/browser/waitUntil.d.ts.map +0 -1
  106. package/build/commands/browser/waitUntil.js +0 -73
  107. package/build/commands/browser.d.ts +0 -70
  108. package/build/commands/browser.d.ts.map +0 -1
  109. package/build/commands/browser.js +0 -44
  110. package/build/commands/constant.d.ts +0 -19
  111. package/build/commands/constant.d.ts.map +0 -1
  112. package/build/commands/constant.js +0 -91
  113. package/build/commands/element/$$.d.ts +0 -46
  114. package/build/commands/element/$$.d.ts.map +0 -1
  115. package/build/commands/element/$$.js +0 -50
  116. package/build/commands/element/$.d.ts +0 -72
  117. package/build/commands/element/$.d.ts.map +0 -1
  118. package/build/commands/element/$.js +0 -76
  119. package/build/commands/element/addValue.d.ts +0 -33
  120. package/build/commands/element/addValue.d.ts.map +0 -1
  121. package/build/commands/element/addValue.js +0 -48
  122. package/build/commands/element/clearValue.d.ts +0 -28
  123. package/build/commands/element/clearValue.d.ts.map +0 -1
  124. package/build/commands/element/clearValue.js +0 -32
  125. package/build/commands/element/click.d.ts +0 -73
  126. package/build/commands/element/click.d.ts.map +0 -1
  127. package/build/commands/element/click.js +0 -134
  128. package/build/commands/element/custom$$.d.ts +0 -28
  129. package/build/commands/element/custom$$.d.ts.map +0 -1
  130. package/build/commands/element/custom$$.js +0 -57
  131. package/build/commands/element/custom$.d.ts +0 -27
  132. package/build/commands/element/custom$.d.ts.map +0 -1
  133. package/build/commands/element/custom$.js +0 -57
  134. package/build/commands/element/doubleClick.d.ts +0 -25
  135. package/build/commands/element/doubleClick.d.ts.map +0 -1
  136. package/build/commands/element/doubleClick.js +0 -51
  137. package/build/commands/element/dragAndDrop.d.ts +0 -41
  138. package/build/commands/element/dragAndDrop.d.ts.map +0 -1
  139. package/build/commands/element/dragAndDrop.js +0 -98
  140. package/build/commands/element/getAttribute.d.ts +0 -28
  141. package/build/commands/element/getAttribute.d.ts.map +0 -1
  142. package/build/commands/element/getAttribute.js +0 -32
  143. package/build/commands/element/getCSSProperty.d.ts +0 -71
  144. package/build/commands/element/getCSSProperty.d.ts.map +0 -1
  145. package/build/commands/element/getCSSProperty.js +0 -108
  146. package/build/commands/element/getComputedLabel.d.ts +0 -20
  147. package/build/commands/element/getComputedLabel.d.ts.map +0 -1
  148. package/build/commands/element/getComputedLabel.js +0 -24
  149. package/build/commands/element/getComputedRole.d.ts +0 -20
  150. package/build/commands/element/getComputedRole.d.ts.map +0 -1
  151. package/build/commands/element/getComputedRole.js +0 -24
  152. package/build/commands/element/getHTML.d.ts +0 -32
  153. package/build/commands/element/getHTML.d.ts.map +0 -1
  154. package/build/commands/element/getHTML.js +0 -46
  155. package/build/commands/element/getLocation.d.ts +0 -6
  156. package/build/commands/element/getLocation.d.ts.map +0 -1
  157. package/build/commands/element/getLocation.js +0 -46
  158. package/build/commands/element/getProperty.d.ts +0 -53
  159. package/build/commands/element/getProperty.d.ts.map +0 -1
  160. package/build/commands/element/getProperty.js +0 -31
  161. package/build/commands/element/getSize.d.ts +0 -6
  162. package/build/commands/element/getSize.d.ts.map +0 -1
  163. package/build/commands/element/getSize.js +0 -47
  164. package/build/commands/element/getTagName.d.ts +0 -25
  165. package/build/commands/element/getTagName.d.ts.map +0 -1
  166. package/build/commands/element/getTagName.js +0 -29
  167. package/build/commands/element/getText.d.ts +0 -42
  168. package/build/commands/element/getText.d.ts.map +0 -1
  169. package/build/commands/element/getText.js +0 -46
  170. package/build/commands/element/getValue.d.ts +0 -25
  171. package/build/commands/element/getValue.d.ts.map +0 -1
  172. package/build/commands/element/getValue.js +0 -33
  173. package/build/commands/element/isClickable.d.ts +0 -40
  174. package/build/commands/element/isClickable.d.ts.map +0 -1
  175. package/build/commands/element/isClickable.js +0 -57
  176. package/build/commands/element/isDisplayed.d.ts +0 -50
  177. package/build/commands/element/isDisplayed.d.ts.map +0 -1
  178. package/build/commands/element/isDisplayed.js +0 -85
  179. package/build/commands/element/isDisplayedInViewport.d.ts +0 -38
  180. package/build/commands/element/isDisplayedInViewport.d.ts.map +0 -1
  181. package/build/commands/element/isDisplayedInViewport.js +0 -55
  182. package/build/commands/element/isEnabled.d.ts +0 -34
  183. package/build/commands/element/isEnabled.d.ts.map +0 -1
  184. package/build/commands/element/isEnabled.js +0 -38
  185. package/build/commands/element/isEqual.d.ts +0 -24
  186. package/build/commands/element/isEqual.d.ts.map +0 -1
  187. package/build/commands/element/isEqual.js +0 -52
  188. package/build/commands/element/isExisting.d.ts +0 -49
  189. package/build/commands/element/isExisting.d.ts.map +0 -1
  190. package/build/commands/element/isExisting.js +0 -65
  191. package/build/commands/element/isFocused.d.ts +0 -28
  192. package/build/commands/element/isFocused.d.ts.map +0 -1
  193. package/build/commands/element/isFocused.js +0 -42
  194. package/build/commands/element/isSelected.d.ts +0 -31
  195. package/build/commands/element/isSelected.d.ts.map +0 -1
  196. package/build/commands/element/isSelected.js +0 -35
  197. package/build/commands/element/moveTo.d.ts +0 -21
  198. package/build/commands/element/moveTo.d.ts.map +0 -1
  199. package/build/commands/element/moveTo.js +0 -39
  200. package/build/commands/element/nextElement.d.ts +0 -25
  201. package/build/commands/element/nextElement.d.ts.map +0 -1
  202. package/build/commands/element/nextElement.js +0 -31
  203. package/build/commands/element/parentElement.d.ts +0 -25
  204. package/build/commands/element/parentElement.d.ts.map +0 -1
  205. package/build/commands/element/parentElement.js +0 -31
  206. package/build/commands/element/previousElement.d.ts +0 -25
  207. package/build/commands/element/previousElement.d.ts.map +0 -1
  208. package/build/commands/element/previousElement.js +0 -31
  209. package/build/commands/element/react$$.d.ts +0 -36
  210. package/build/commands/element/react$$.d.ts.map +0 -1
  211. package/build/commands/element/react$$.js +0 -51
  212. package/build/commands/element/react$.d.ts +0 -46
  213. package/build/commands/element/react$.d.ts.map +0 -1
  214. package/build/commands/element/react$.js +0 -59
  215. package/build/commands/element/saveScreenshot.d.ts +0 -21
  216. package/build/commands/element/saveScreenshot.d.ts.map +0 -1
  217. package/build/commands/element/saveScreenshot.js +0 -40
  218. package/build/commands/element/scrollIntoView.d.ts +0 -21
  219. package/build/commands/element/scrollIntoView.d.ts.map +0 -1
  220. package/build/commands/element/scrollIntoView.js +0 -31
  221. package/build/commands/element/selectByAttribute.d.ts +0 -37
  222. package/build/commands/element/selectByAttribute.d.ts.map +0 -1
  223. package/build/commands/element/selectByAttribute.js +0 -59
  224. package/build/commands/element/selectByIndex.d.ts +0 -31
  225. package/build/commands/element/selectByIndex.d.ts.map +0 -1
  226. package/build/commands/element/selectByIndex.js +0 -55
  227. package/build/commands/element/selectByVisibleText.d.ts +0 -31
  228. package/build/commands/element/selectByVisibleText.d.ts.map +0 -1
  229. package/build/commands/element/selectByVisibleText.js +0 -66
  230. package/build/commands/element/setValue.d.ts +0 -29
  231. package/build/commands/element/setValue.d.ts.map +0 -1
  232. package/build/commands/element/setValue.js +0 -33
  233. package/build/commands/element/shadow$$.d.ts +0 -22
  234. package/build/commands/element/shadow$$.d.ts.map +0 -1
  235. package/build/commands/element/shadow$$.js +0 -27
  236. package/build/commands/element/shadow$.d.ts +0 -22
  237. package/build/commands/element/shadow$.d.ts.map +0 -1
  238. package/build/commands/element/shadow$.js +0 -27
  239. package/build/commands/element/touchAction.d.ts +0 -54
  240. package/build/commands/element/touchAction.d.ts.map +0 -1
  241. package/build/commands/element/touchAction.js +0 -58
  242. package/build/commands/element/waitForClickable.d.ts +0 -34
  243. package/build/commands/element/waitForClickable.d.ts.map +0 -1
  244. package/build/commands/element/waitForClickable.js +0 -37
  245. package/build/commands/element/waitForDisplayed.d.ts +0 -44
  246. package/build/commands/element/waitForDisplayed.d.ts.map +0 -1
  247. package/build/commands/element/waitForDisplayed.js +0 -47
  248. package/build/commands/element/waitForEnabled.d.ts +0 -46
  249. package/build/commands/element/waitForEnabled.d.ts.map +0 -1
  250. package/build/commands/element/waitForEnabled.js +0 -55
  251. package/build/commands/element/waitForExist.d.ts +0 -46
  252. package/build/commands/element/waitForExist.d.ts.map +0 -1
  253. package/build/commands/element/waitForExist.js +0 -49
  254. package/build/commands/element/waitUntil.d.ts +0 -49
  255. package/build/commands/element/waitUntil.d.ts.map +0 -1
  256. package/build/commands/element/waitUntil.js +0 -53
  257. package/build/commands/element.d.ts +0 -100
  258. package/build/commands/element.d.ts.map +0 -1
  259. package/build/commands/element.js +0 -63
  260. package/build/commands/mock/abort.d.ts +0 -19
  261. package/build/commands/mock/abort.d.ts.map +0 -1
  262. package/build/commands/mock/abort.js +0 -20
  263. package/build/commands/mock/abortOnce.d.ts +0 -27
  264. package/build/commands/mock/abortOnce.d.ts.map +0 -1
  265. package/build/commands/mock/abortOnce.js +0 -28
  266. package/build/commands/mock/clear.d.ts +0 -18
  267. package/build/commands/mock/clear.d.ts.map +0 -1
  268. package/build/commands/mock/clear.js +0 -19
  269. package/build/commands/mock/respond.d.ts +0 -54
  270. package/build/commands/mock/respond.d.ts.map +0 -1
  271. package/build/commands/mock/respond.js +0 -55
  272. package/build/commands/mock/respondOnce.d.ts +0 -55
  273. package/build/commands/mock/respondOnce.d.ts.map +0 -1
  274. package/build/commands/mock/respondOnce.js +0 -56
  275. package/build/commands/mock/restore.d.ts +0 -18
  276. package/build/commands/mock/restore.d.ts.map +0 -1
  277. package/build/commands/mock/restore.js +0 -19
  278. package/build/constants.d.ts +0 -14
  279. package/build/constants.d.ts.map +0 -1
  280. package/build/constants.js +0 -286
  281. package/build/index.d.ts +0 -45
  282. package/build/index.d.ts.map +0 -1
  283. package/build/index.js +0 -171
  284. package/build/middlewares.d.ts +0 -12
  285. package/build/middlewares.d.ts.map +0 -1
  286. package/build/middlewares.js +0 -65
  287. package/build/multiremote.d.ts +0 -71
  288. package/build/multiremote.d.ts.map +0 -1
  289. package/build/multiremote.js +0 -160
  290. package/build/protocol-stub.d.ts +0 -16
  291. package/build/protocol-stub.d.ts.map +0 -1
  292. package/build/protocol-stub.js +0 -77
  293. package/build/scripts/getHTML.d.ts +0 -9
  294. package/build/scripts/getHTML.d.ts.map +0 -1
  295. package/build/scripts/getHTML.js +0 -13
  296. package/build/scripts/getProperty.d.ts +0 -43
  297. package/build/scripts/getProperty.d.ts.map +0 -1
  298. package/build/scripts/getProperty.js +0 -12
  299. package/build/scripts/isElementClickable.d.ts +0 -7
  300. package/build/scripts/isElementClickable.d.ts.map +0 -1
  301. package/build/scripts/isElementClickable.js +0 -121
  302. package/build/scripts/isElementDisplayed.d.ts +0 -7
  303. package/build/scripts/isElementDisplayed.d.ts.map +0 -1
  304. package/build/scripts/isElementDisplayed.js +0 -216
  305. package/build/scripts/isElementInViewport.d.ts +0 -10
  306. package/build/scripts/isElementInViewport.d.ts.map +0 -1
  307. package/build/scripts/isElementInViewport.js +0 -22
  308. package/build/scripts/isFocused.d.ts +0 -7
  309. package/build/scripts/isFocused.d.ts.map +0 -1
  310. package/build/scripts/isFocused.js +0 -11
  311. package/build/scripts/newWindow.d.ts +0 -10
  312. package/build/scripts/newWindow.d.ts.map +0 -1
  313. package/build/scripts/newWindow.js +0 -14
  314. package/build/scripts/resq.d.ts +0 -6
  315. package/build/scripts/resq.d.ts.map +0 -1
  316. package/build/scripts/resq.js +0 -58
  317. package/build/scripts/shadowFnFactory.d.ts +0 -2
  318. package/build/scripts/shadowFnFactory.d.ts.map +0 -1
  319. package/build/scripts/shadowFnFactory.js +0 -17
  320. package/build/types.d.ts +0 -402
  321. package/build/types.d.ts.map +0 -1
  322. package/build/types.js +0 -2
  323. package/build/utils/SevereServiceError.d.ts +0 -7
  324. package/build/utils/SevereServiceError.d.ts.map +0 -1
  325. package/build/utils/SevereServiceError.js +0 -12
  326. package/build/utils/Timer.d.ts +0 -33
  327. package/build/utils/Timer.d.ts.map +0 -1
  328. package/build/utils/Timer.js +0 -126
  329. package/build/utils/detectBackend.d.ts +0 -23
  330. package/build/utils/detectBackend.d.ts.map +0 -1
  331. package/build/utils/detectBackend.js +0 -119
  332. package/build/utils/findStrategy.d.ts +0 -10
  333. package/build/utils/findStrategy.d.ts.map +0 -1
  334. package/build/utils/findStrategy.js +0 -267
  335. package/build/utils/getElementObject.d.ts +0 -17
  336. package/build/utils/getElementObject.d.ts.map +0 -1
  337. package/build/utils/getElementObject.js +0 -107
  338. package/build/utils/implicitWait.d.ts +0 -7
  339. package/build/utils/implicitWait.d.ts.map +0 -1
  340. package/build/utils/implicitWait.js +0 -39
  341. package/build/utils/index.d.ts +0 -102
  342. package/build/utils/index.d.ts.map +0 -1
  343. package/build/utils/index.js +0 -543
  344. package/build/utils/interception/devtools.d.ts +0 -61
  345. package/build/utils/interception/devtools.d.ts.map +0 -1
  346. package/build/utils/interception/devtools.js +0 -247
  347. package/build/utils/interception/index.d.ts +0 -26
  348. package/build/utils/interception/index.d.ts.map +0 -1
  349. package/build/utils/interception/index.js +0 -49
  350. package/build/utils/interception/types.d.ts +0 -94
  351. package/build/utils/interception/types.d.ts.map +0 -1
  352. package/build/utils/interception/types.js +0 -2
  353. package/build/utils/interception/webdriver.d.ts +0 -48
  354. package/build/utils/interception/webdriver.d.ts.map +0 -1
  355. package/build/utils/interception/webdriver.js +0 -75
  356. package/build/utils/refetchElement.d.ts +0 -6
  357. package/build/utils/refetchElement.d.ts.map +0 -1
  358. package/build/utils/refetchElement.js +0 -32
@@ -1,61 +0,0 @@
1
- /// <reference types="node" />
2
- import type { CDPSession } from 'puppeteer-core/lib/cjs/puppeteer/common/Connection';
3
- import type Protocol from 'devtools-protocol';
4
- import Interception from '.';
5
- import type { Matches, MockOverwrite, MockResponseParams } from './types';
6
- declare type ClientResponse = {
7
- body: string;
8
- base64Encoded?: boolean;
9
- };
10
- interface HeaderEntry {
11
- name: string;
12
- value: string;
13
- }
14
- declare type Event = {
15
- requestId: string;
16
- request: Matches & {
17
- mockedResponse: string | Buffer;
18
- };
19
- responseStatusCode?: number;
20
- responseHeaders: HeaderEntry[];
21
- };
22
- export default class DevtoolsInterception extends Interception {
23
- static handleRequestInterception(client: CDPSession, mocks: Set<Interception>): (event: Event) => Promise<void | ClientResponse>;
24
- /**
25
- * allows access to all requests made with given pattern
26
- */
27
- get calls(): Matches[];
28
- /**
29
- * Resets all information stored in the `mock.calls` set.
30
- */
31
- clear(): void;
32
- /**
33
- * Does everything that `mock.clear()` does, and also
34
- * removes any mocked return values or implementations.
35
- */
36
- restore(): void;
37
- /**
38
- * Always respond with same overwrite
39
- * @param {*} overwrites payload to overwrite the response
40
- * @param {*} params additional respond parameters to overwrite
41
- */
42
- respond(overwrite: MockOverwrite, params?: MockResponseParams): void;
43
- /**
44
- * Respond request once with given overwrite
45
- * @param {*} overwrites payload to overwrite the response
46
- * @param {*} params additional respond parameters to overwrite
47
- */
48
- respondOnce(overwrite: MockOverwrite, params?: MockResponseParams): void;
49
- /**
50
- * Abort the request with an error code
51
- * @param {string} errorCode error code of the response
52
- */
53
- abort(errorReason: Protocol.Network.ErrorReason, sticky?: boolean): void;
54
- /**
55
- * Abort the request once with an error code
56
- * @param {string} errorReason error code of the response
57
- */
58
- abortOnce(errorReason: Protocol.Network.ErrorReason): void;
59
- }
60
- export {};
61
- //# sourceMappingURL=devtools.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"devtools.d.ts","sourceRoot":"","sources":["../../../src/utils/interception/devtools.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oDAAoD,CAAA;AACpF,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAG7C,OAAO,YAAY,MAAM,GAAG,CAAA;AAC5B,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAMzE,aAAK,cAAc,GAAG;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,UAAU,WAAW;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,aAAK,KAAK,GAAG;IACT,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,OAAO,GAAG;QAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACtD,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,eAAe,EAAE,WAAW,EAAE,CAAA;CACjC,CAAA;AAID,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,YAAY;IAC1D,MAAM,CAAC,yBAAyB,CAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,GAAG,cAAc,CAAC;IA8IjI;;OAEG;IACH,IAAI,KAAK,cAER;IAED;;OAEG;IACH,KAAK;IAIL;;;OAGG;IACH,OAAO;IAKP;;;;OAIG;IACH,OAAO,CAAE,SAAS,EAAE,aAAa,EAAE,MAAM,GAAE,kBAAuB;IAIlE;;;;OAIG;IACH,WAAW,CAAE,SAAS,EAAE,aAAa,EAAE,MAAM,GAAE,kBAAuB;IAItE;;;OAGG;IACH,KAAK,CAAE,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,GAAE,OAAc;IAOxE;;;OAGG;IACH,SAAS,CAAE,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW;CAGvD"}
@@ -1,247 +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_extra_1 = __importDefault(require("fs-extra"));
7
- const path_1 = __importDefault(require("path"));
8
- const logger_1 = __importDefault(require("@wdio/logger"));
9
- const _1 = __importDefault(require("."));
10
- const __1 = require("..");
11
- const constants_1 = require("../../constants");
12
- const log = (0, logger_1.default)('webdriverio');
13
- class DevtoolsInterception extends _1.default {
14
- static handleRequestInterception(client, mocks) {
15
- return async (event) => {
16
- // responseHeaders and responseStatusCode are only present in Response stage
17
- // https://chromedevtools.github.io/devtools-protocol/tot/Fetch/#event-requestPaused
18
- const isRequest = !event.responseHeaders;
19
- const eventResponseHeaders = event.responseHeaders || [];
20
- const responseHeaders = eventResponseHeaders.reduce((headers, { name, value }) => {
21
- headers[name] = value;
22
- return headers;
23
- }, {});
24
- const { requestId, request, responseStatusCode = 200 } = event;
25
- for (const mock of mocks) {
26
- /**
27
- * skip response mocks in Request stage
28
- */
29
- if (isRequest && (mock.respondOverwrites.length === 0 || // nothing to do in Request stage
30
- (!mock.respondOverwrites[0].errorReason && // skip if not going to abort a request
31
- // or want to fetch response
32
- mock.respondOverwrites[0].params &&
33
- mock.respondOverwrites[0].params.fetchResponse !== false))) {
34
- continue;
35
- }
36
- /**
37
- * match mock url
38
- */
39
- if (!_1.default.isMatchingRequest(mock.url, request.url)) {
40
- continue;
41
- }
42
- /**
43
- * Add statusCode and responseHeaders to request to be used in expect-webdriverio
44
- */
45
- request.statusCode = responseStatusCode;
46
- request.responseHeaders = { ...responseHeaders };
47
- /**
48
- * match filter options
49
- */
50
- if (filterMethod(request.method, mock.filterOptions.method) ||
51
- filterHeaders(request.headers, mock.filterOptions.requestHeaders) ||
52
- filterHeaders(responseHeaders, mock.filterOptions.headers) ||
53
- filterRequest(request.postData, mock.filterOptions.postData) ||
54
- filterStatusCode(responseStatusCode, mock.filterOptions.statusCode)) {
55
- continue;
56
- }
57
- const { body, base64Encoded = undefined } = isRequest ? { body: '' } : await client.send('Fetch.getResponseBody', { requestId }).catch(/* istanbul ignore next */ () => ({}));
58
- request.body = base64Encoded ? Buffer.from(body, 'base64').toString('utf8') : body;
59
- const contentTypeHeader = Object.keys(responseHeaders).find(h => h.toLowerCase() === 'content-type') || '';
60
- const responseContentType = responseHeaders[contentTypeHeader];
61
- request.body = responseContentType && responseContentType.includes('application/json')
62
- ? tryParseJson(request.body)
63
- : request.body;
64
- mock.matches.push(request);
65
- /**
66
- * no stubbing if no overwrites were defined
67
- */
68
- if (mock.respondOverwrites.length === 0) {
69
- continue;
70
- }
71
- const { errorReason, overwrite, params = {} } = mock.respondOverwrites[0].sticky
72
- ? mock.respondOverwrites[0]
73
- : mock.respondOverwrites.shift() || {};
74
- /**
75
- * when response is modified
76
- */
77
- if (overwrite !== undefined) {
78
- let newBody = overwrite;
79
- if (typeof overwrite === 'function') {
80
- newBody = await overwrite(request, client);
81
- }
82
- const isBodyUndefined = typeof newBody === 'undefined';
83
- if (isBodyUndefined) {
84
- newBody = '';
85
- }
86
- if (typeof newBody !== 'string') {
87
- newBody = JSON.stringify(newBody);
88
- }
89
- let responseCode = typeof params.statusCode === 'function' ? params.statusCode(request) : params.statusCode || responseStatusCode;
90
- let responseHeaders = [
91
- ...eventResponseHeaders,
92
- ...Object.entries(typeof params.headers === 'function' ? params.headers(request) : params.headers || {}).map(([name, value]) => ({ name, value }))
93
- ];
94
- /**
95
- * check if local file and load it
96
- */
97
- const responseFilePath = path_1.default.isAbsolute(newBody) ? newBody : path_1.default.join(process.cwd(), newBody);
98
- if (newBody.length > 0 && await fs_extra_1.default.pathExists(responseFilePath) && await canAccess(responseFilePath)) {
99
- newBody = await fs_extra_1.default.readFile(responseFilePath);
100
- }
101
- else if (newBody.startsWith('http')) {
102
- responseCode = 301;
103
- /**
104
- * filter out possible available location header
105
- */
106
- responseHeaders = responseHeaders.filter(({ name }) => name.toLowerCase() !== 'location');
107
- responseHeaders.push({ name: 'Location', value: newBody });
108
- }
109
- request.mockedResponse = newBody;
110
- return client.send('Fetch.fulfillRequest', {
111
- requestId,
112
- responseCode,
113
- responseHeaders,
114
- /** do not mock body if it's undefined */
115
- body: isBodyUndefined ? undefined : (newBody instanceof Buffer ? newBody : Buffer.from(newBody, 'utf8')).toString('base64')
116
- }).catch(/* istanbul ignore next */ logFetchError);
117
- }
118
- /**
119
- * when request is aborted
120
- */
121
- if (errorReason) {
122
- return client.send('Fetch.failRequest', {
123
- requestId,
124
- errorReason
125
- }).catch(/* istanbul ignore next */ logFetchError);
126
- }
127
- }
128
- return client.send('Fetch.continueRequest', { requestId }).catch(/* istanbul ignore next */ logFetchError);
129
- };
130
- }
131
- /**
132
- * allows access to all requests made with given pattern
133
- */
134
- get calls() {
135
- return this.matches;
136
- }
137
- /**
138
- * Resets all information stored in the `mock.calls` set.
139
- */
140
- clear() {
141
- this.matches = [];
142
- }
143
- /**
144
- * Does everything that `mock.clear()` does, and also
145
- * removes any mocked return values or implementations.
146
- */
147
- restore() {
148
- this.clear();
149
- this.respondOverwrites = [];
150
- }
151
- /**
152
- * Always respond with same overwrite
153
- * @param {*} overwrites payload to overwrite the response
154
- * @param {*} params additional respond parameters to overwrite
155
- */
156
- respond(overwrite, params = {}) {
157
- this.respondOverwrites.push({ overwrite, params, sticky: true });
158
- }
159
- /**
160
- * Respond request once with given overwrite
161
- * @param {*} overwrites payload to overwrite the response
162
- * @param {*} params additional respond parameters to overwrite
163
- */
164
- respondOnce(overwrite, params = {}) {
165
- this.respondOverwrites.push({ overwrite, params });
166
- }
167
- /**
168
- * Abort the request with an error code
169
- * @param {string} errorCode error code of the response
170
- */
171
- abort(errorReason, sticky = true) {
172
- if (typeof errorReason !== 'string' || !constants_1.ERROR_REASON.includes(errorReason)) {
173
- throw new Error(`Invalid value for errorReason, allowed are: ${constants_1.ERROR_REASON.join(', ')}`);
174
- }
175
- this.respondOverwrites.push({ errorReason, sticky });
176
- }
177
- /**
178
- * Abort the request once with an error code
179
- * @param {string} errorReason error code of the response
180
- */
181
- abortOnce(errorReason) {
182
- this.abort(errorReason, false);
183
- }
184
- }
185
- exports.default = DevtoolsInterception;
186
- const filterMethod = (method, expected) => {
187
- if (typeof expected === 'undefined') {
188
- return false;
189
- }
190
- if (typeof expected === 'function') {
191
- return expected(method) !== true;
192
- }
193
- return expected.toLowerCase() !== method.toLowerCase();
194
- };
195
- const filterHeaders = (responseHeaders, expected) => {
196
- if (typeof expected === 'undefined') {
197
- return false;
198
- }
199
- if (typeof expected === 'function') {
200
- return expected(responseHeaders) !== true;
201
- }
202
- return !(0, __1.containsHeaderObject)(responseHeaders, expected);
203
- };
204
- const filterRequest = (postData, expected) => {
205
- if (typeof expected === 'undefined') {
206
- return false;
207
- }
208
- if (typeof expected === 'function') {
209
- return expected(postData) !== true;
210
- }
211
- return postData !== expected;
212
- };
213
- const filterStatusCode = (statusCode, expected) => {
214
- if (typeof expected === 'undefined') {
215
- return false;
216
- }
217
- if (typeof expected === 'function') {
218
- return expected(statusCode) !== true;
219
- }
220
- return statusCode !== expected;
221
- };
222
- /**
223
- * Helper utility to check file access
224
- * @param {String} file file to check access for
225
- * @return Promise<true> if file can be accessed
226
- */
227
- const canAccess = async (filepath) => {
228
- try {
229
- await fs_extra_1.default.access(filepath);
230
- return true;
231
- }
232
- catch {
233
- return false;
234
- }
235
- };
236
- const tryParseJson = (body) => {
237
- try {
238
- return JSON.parse(body) || body;
239
- }
240
- catch {
241
- return body;
242
- }
243
- };
244
- const logFetchError = (err) => {
245
- /* istanbul ignore next */
246
- log.debug(err === null || err === void 0 ? void 0 : err.message);
247
- };
@@ -1,26 +0,0 @@
1
- import { WaitForOptions } from '../../types';
2
- import { MockFilterOptions, MockOverwrite, MockResponseParams, Matches } from './types';
3
- import type Protocol from 'devtools-protocol';
4
- export default abstract class Interception {
5
- url: string | RegExp;
6
- filterOptions: MockFilterOptions;
7
- browser: WebdriverIO.Browser;
8
- abstract calls: Matches[] | Promise<Matches[]>;
9
- abstract clear(): void;
10
- abstract restore(): void;
11
- abstract respond(overwrite: MockOverwrite, params: MockResponseParams): void;
12
- abstract respondOnce(overwrite: MockOverwrite, params: MockResponseParams): void;
13
- abstract abort(errorReason: Protocol.Network.ErrorReason, sticky: boolean): void;
14
- abstract abortOnce(errorReason: Protocol.Network.ErrorReason): void;
15
- respondOverwrites: {
16
- overwrite?: MockOverwrite;
17
- params?: MockResponseParams;
18
- sticky?: boolean;
19
- errorReason?: Protocol.Network.ErrorReason;
20
- }[];
21
- matches: Matches[];
22
- constructor(url: string | RegExp, filterOptions: MockFilterOptions, browser: WebdriverIO.Browser);
23
- waitForResponse({ timeout, interval, timeoutMsg, }?: WaitForOptions): Promise<boolean> | Promise<Promise<boolean>>;
24
- static isMatchingRequest(expectedUrl: string | RegExp, actualUrl: string): boolean;
25
- }
26
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils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AAW,CAAC,OAAO;IAIvC,eAAe,CAAE,EACb,OAA6C,EAC7C,QAA+C,EAC/C,UAAU,GACb,GAAE,cAAmB;IA4BtB,MAAM,CAAC,iBAAiB,CAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM;CAU5E"}
@@ -1,49 +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 minimatch_1 = __importDefault(require("minimatch"));
7
- const Timer_1 = __importDefault(require("../Timer"));
8
- class Interception {
9
- constructor(url, filterOptions = {}, browser) {
10
- this.url = url;
11
- this.filterOptions = filterOptions;
12
- this.browser = browser;
13
- this.respondOverwrites = [];
14
- this.matches = [];
15
- }
16
- waitForResponse({ timeout = this.browser.options.waitforTimeout, interval = this.browser.options.waitforInterval, timeoutMsg, } = {}) {
17
- /*!
18
- * ensure that timeout and interval are set properly
19
- */
20
- if (typeof timeout !== 'number') {
21
- timeout = this.browser.options.waitforTimeout;
22
- }
23
- if (typeof interval !== 'number') {
24
- interval = this.browser.options.waitforInterval;
25
- }
26
- /* istanbul ignore next */
27
- const fn = async () => this.calls && (await this.calls).length > 0;
28
- const timer = new Timer_1.default(interval, timeout, fn, true);
29
- return this.browser.call(() => timer.catch((e) => {
30
- if (e.message === 'timeout') {
31
- if (typeof timeoutMsg === 'string') {
32
- throw new Error(timeoutMsg);
33
- }
34
- throw new Error(`waitForResponse timed out after ${timeout}ms`);
35
- }
36
- throw new Error(`waitForResponse failed with the following reason: ${(e && e.message) || e}`);
37
- }));
38
- }
39
- static isMatchingRequest(expectedUrl, actualUrl) {
40
- if (typeof expectedUrl === 'string') {
41
- return (0, minimatch_1.default)(actualUrl, expectedUrl);
42
- }
43
- if (expectedUrl instanceof RegExp) {
44
- return Boolean(actualUrl.match(expectedUrl));
45
- }
46
- throw new Error(`Unexpected type for mock url: ${expectedUrl}`);
47
- }
48
- }
49
- exports.default = Interception;
@@ -1,94 +0,0 @@
1
- /// <reference types="node" />
2
- import type { CDPSession } from 'puppeteer-core/lib/cjs/puppeteer/common/Connection';
3
- import { JsonCompatible } from '@wdio/types';
4
- /**
5
- * HTTP request data. (copied from the puppeteer-core package as there is currently
6
- * no way to access these types otherwise)
7
- */
8
- export declare type ResourcePriority = 'VeryLow' | 'Low' | 'Medium' | 'High' | 'VeryHigh';
9
- export declare type MixedContentType = 'blockable' | 'optionally-blockable' | 'none';
10
- export declare type ReferrerPolicy = 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin';
11
- export interface Request {
12
- /**
13
- * Request URL (without fragment).
14
- */
15
- url: string;
16
- /**
17
- * Fragment of the requested URL starting with hash, if present.
18
- */
19
- urlFragment?: string;
20
- /**
21
- * HTTP request method.
22
- */
23
- method: string;
24
- /**
25
- * HTTP request headers.
26
- */
27
- headers: Record<string, string>;
28
- /**
29
- * HTTP POST request data.
30
- */
31
- postData?: string;
32
- /**
33
- * True when the request has POST data. Note that postData might still be omitted when this flag is true when the data is too long.
34
- */
35
- hasPostData?: boolean;
36
- /**
37
- * The mixed content export type of the request.
38
- */
39
- mixedContentType?: MixedContentType;
40
- /**
41
- * Priority of the resource request at the time request is sent.
42
- */
43
- initialPriority: ResourcePriority;
44
- /**
45
- * The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/
46
- */
47
- referrerPolicy: ReferrerPolicy;
48
- /**
49
- * Whether is loaded via link preload.
50
- */
51
- isLinkPreload?: boolean;
52
- }
53
- export interface Matches extends Request {
54
- /**
55
- * body response of actual resource
56
- */
57
- body: string | Buffer | JsonCompatible;
58
- /**
59
- * HTTP response headers.
60
- */
61
- responseHeaders: Record<string, string>;
62
- /**
63
- * HTTP response status code.
64
- */
65
- statusCode: number;
66
- }
67
- export declare type MockOverwriteFunction = (request: Matches, client: CDPSession) => Promise<string | Record<string, any>>;
68
- export declare type MockOverwrite = string | Record<string, any> | MockOverwriteFunction;
69
- export declare type MockResponseParams = {
70
- statusCode?: number | ((request: Matches) => number);
71
- headers?: Record<string, string> | ((request: Matches) => Record<string, string>);
72
- /**
73
- * fetch real response before responding with mocked data. Default: true
74
- */
75
- fetchResponse?: boolean;
76
- };
77
- export declare type MockFilterOptions = {
78
- method?: string | ((method: string) => boolean);
79
- headers?: Record<string, string> | ((headers: Record<string, string>) => boolean);
80
- requestHeaders?: Record<string, string> | ((headers: Record<string, string>) => boolean);
81
- responseHeaders?: Record<string, string> | ((headers: Record<string, string>) => boolean);
82
- statusCode?: number | ((statusCode: number) => boolean);
83
- postData?: string | ((payload: string | undefined) => boolean);
84
- };
85
- export declare type ErrorCode = 'Failed' | 'Aborted' | 'TimedOut' | 'AccessDenied' | 'ConnectionClosed' | 'ConnectionReset' | 'ConnectionRefused' | 'ConnectionAborted' | 'ConnectionFailed' | 'NameNotResolved' | 'InternetDisconnected' | 'AddressUnreachable' | 'BlockedByClient' | 'BlockedByResponse';
86
- export declare type ThrottlePreset = 'offline' | 'GPRS' | 'Regular2G' | 'Good2G' | 'Regular3G' | 'Good3G' | 'Regular4G' | 'DSL' | 'WiFi' | 'online';
87
- export interface CustomThrottle {
88
- offline: boolean;
89
- downloadThroughput: number;
90
- uploadThroughput: number;
91
- latency: number;
92
- }
93
- export declare type ThrottleOptions = ThrottlePreset | CustomThrottle;
94
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/interception/types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oDAAoD,CAAA;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C;;;GAGG;AACH,oBAAY,gBAAgB,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAA;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,GAAG,oBAAoB,GAAG,iBAAiB,GAAG,mBAAmB,CAAA;AAElS,oBAAY,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAA;AAC3I,MAAM,WAAW,cAAc;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,gBAAgB,EAAE,MAAM,CAAA;IACxB,OAAO,EAAE,MAAM,CAAA;CAClB;AACD,oBAAY,eAAe,GAAG,cAAc,GAAG,cAAc,CAAA"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,48 +0,0 @@
1
- import Interception from '.';
2
- import type { Matches, MockResponseParams, MockOverwrite } from './types';
3
- /**
4
- * Network interception class based on a WebDriver compliant endpoint.
5
- * Instead of directly using the CDP with Puppeteer this version of the
6
- * class uses a WebDriver extension to trigger the same behavior on a
7
- * compliant backend.
8
- */
9
- export default class WebDriverInterception extends Interception {
10
- mockId?: string;
11
- init(): Promise<void>;
12
- /**
13
- * allows access to all requests made with given pattern
14
- */
15
- get calls(): Matches[] | Promise<Matches[]>;
16
- /**
17
- * Resets all information stored in the `mock.calls` set.
18
- */
19
- clear(): Promise<void> | Promise<Promise<void>>;
20
- /**
21
- * Does everything that `mock.clear()` does, and also
22
- * removes any mocked return values or implementations.
23
- */
24
- restore(): Promise<void> | Promise<Promise<void>>;
25
- /**
26
- * Always respond with same overwrite
27
- * @param {*} overwrites payload to overwrite the response
28
- * @param {*} params additional respond parameters to overwrite
29
- */
30
- respond(overwrite: MockOverwrite, params?: MockResponseParams): Promise<void> | Promise<Promise<void>>;
31
- /**
32
- * Respond request once with given overwrite
33
- * @param {*} overwrites payload to overwrite the response
34
- * @param {*} params additional respond parameters to overwrite
35
- */
36
- respondOnce(overwrite: MockOverwrite, params?: MockResponseParams): Promise<void> | Promise<Promise<void>>;
37
- /**
38
- * Abort the request with an error code
39
- * @param {string} errorCode error code of the response
40
- */
41
- abort(errorReason: string, sticky?: boolean): Promise<void> | Promise<Promise<void>>;
42
- /**
43
- * Abort the request once with an error code
44
- * @param {string} errorReason error code of the response
45
- */
46
- abortOnce(errorReason: string): Promise<void> | Promise<Promise<void>>;
47
- }
48
- //# sourceMappingURL=webdriver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webdriver.d.ts","sourceRoot":"","sources":["../../../src/utils/interception/webdriver.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,GAAG,CAAA;AAE5B,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEzE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,YAAY;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAA;IAET,IAAI;IAQV;;OAEG;IACH,IAAI,KAAK,mCAIR;IAED;;OAEG;IACH,KAAK;IAKL;;;OAGG;IACH,OAAO;IAKP;;;;OAIG;IACH,OAAO,CAAE,SAAS,EAAE,aAAa,EAAE,MAAM,GAAE,kBAAuB;IASlE;;;;OAIG;IACH,WAAW,CAAE,SAAS,EAAE,aAAa,EAAE,MAAM,GAAE,kBAAuB;IAStE;;;OAGG;IACH,KAAK,CAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAE,OAAc;IAYlD;;;OAGG;IACH,SAAS,CAAE,WAAW,EAAE,MAAM;CAGjC"}
@@ -1,75 +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 _1 = __importDefault(require("."));
7
- const constants_1 = require("../../constants");
8
- /**
9
- * Network interception class based on a WebDriver compliant endpoint.
10
- * Instead of directly using the CDP with Puppeteer this version of the
11
- * class uses a WebDriver extension to trigger the same behavior on a
12
- * compliant backend.
13
- */
14
- class WebDriverInterception extends _1.default {
15
- async init() {
16
- if (this.url instanceof RegExp) {
17
- throw new Error('Regular Expressions as mock url are not supported');
18
- }
19
- const { mockId } = await this.browser.mockRequest(this.url, this.filterOptions);
20
- this.mockId = mockId;
21
- }
22
- /**
23
- * allows access to all requests made with given pattern
24
- */
25
- get calls() {
26
- return this.browser.call(() => this.browser.getMockCalls(this.mockId));
27
- }
28
- /**
29
- * Resets all information stored in the `mock.calls` set.
30
- */
31
- clear() {
32
- return this.browser.call(async () => this.browser.clearMockCalls(this.mockId));
33
- }
34
- /**
35
- * Does everything that `mock.clear()` does, and also
36
- * removes any mocked return values or implementations.
37
- */
38
- restore() {
39
- return this.browser.call(async () => this.browser.clearMockCalls(this.mockId, true));
40
- }
41
- /**
42
- * Always respond with same overwrite
43
- * @param {*} overwrites payload to overwrite the response
44
- * @param {*} params additional respond parameters to overwrite
45
- */
46
- respond(overwrite, params = {}) {
47
- return this.browser.call(async () => this.browser.respondMock(this.mockId, { overwrite, params, sticky: true }));
48
- }
49
- /**
50
- * Respond request once with given overwrite
51
- * @param {*} overwrites payload to overwrite the response
52
- * @param {*} params additional respond parameters to overwrite
53
- */
54
- respondOnce(overwrite, params = {}) {
55
- return this.browser.call(async () => this.browser.respondMock(this.mockId, { overwrite, params }));
56
- }
57
- /**
58
- * Abort the request with an error code
59
- * @param {string} errorCode error code of the response
60
- */
61
- abort(errorReason, sticky = true) {
62
- if (typeof errorReason !== 'string' || !constants_1.ERROR_REASON.includes(errorReason)) {
63
- throw new Error(`Invalid value for errorReason, allowed are: ${constants_1.ERROR_REASON.join(', ')}`);
64
- }
65
- return this.browser.call(async () => this.browser.respondMock(this.mockId, { errorReason, sticky }));
66
- }
67
- /**
68
- * Abort the request once with an error code
69
- * @param {string} errorReason error code of the response
70
- */
71
- abortOnce(errorReason) {
72
- return this.abort(errorReason, false);
73
- }
74
- }
75
- exports.default = WebDriverInterception;
@@ -1,6 +0,0 @@
1
- /**
2
- * helper utility to refetch an element and all its parent elements when running
3
- * into stale element exception errors
4
- */
5
- export default function refetchElement(currentElement: WebdriverIO.Element, commandName: string): Promise<WebdriverIO.Element>;
6
- //# sourceMappingURL=refetchElement.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"refetchElement.d.ts","sourceRoot":"","sources":["../../src/utils/refetchElement.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAA8B,cAAc,CACxC,cAAc,EAAE,WAAW,CAAC,OAAO,EACnC,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CA0B9B"}