@serenity-js/web 3.0.0-rc.8 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (413) hide show
  1. package/CHANGELOG.md +336 -73
  2. package/README.md +8 -12
  3. package/lib/errors/BrowserWindowClosedError.d.ts +15 -0
  4. package/lib/errors/BrowserWindowClosedError.d.ts.map +1 -0
  5. package/lib/errors/BrowserWindowClosedError.js +21 -0
  6. package/lib/errors/BrowserWindowClosedError.js.map +1 -0
  7. package/lib/errors/CookieMissingError.d.ts +11 -0
  8. package/lib/errors/CookieMissingError.d.ts.map +1 -0
  9. package/lib/errors/CookieMissingError.js +10 -0
  10. package/lib/errors/CookieMissingError.js.map +1 -1
  11. package/lib/errors/ModalDialogObstructsScreenshotError.d.ts +15 -0
  12. package/lib/errors/ModalDialogObstructsScreenshotError.d.ts.map +1 -0
  13. package/lib/errors/ModalDialogObstructsScreenshotError.js +21 -0
  14. package/lib/errors/ModalDialogObstructsScreenshotError.js.map +1 -0
  15. package/lib/errors/index.d.ts +3 -0
  16. package/lib/errors/index.d.ts.map +1 -0
  17. package/lib/errors/index.js +7 -1
  18. package/lib/errors/index.js.map +1 -1
  19. package/lib/expectations/index.d.ts +1 -1
  20. package/lib/expectations/index.d.ts.map +1 -0
  21. package/lib/expectations/index.js +5 -2
  22. package/lib/expectations/index.js.map +1 -1
  23. package/lib/expectations/isActive.d.ts +14 -8
  24. package/lib/expectations/isActive.d.ts.map +1 -0
  25. package/lib/expectations/isActive.js +17 -11
  26. package/lib/expectations/isActive.js.map +1 -1
  27. package/lib/expectations/isClickable.d.ts +14 -13
  28. package/lib/expectations/isClickable.d.ts.map +1 -0
  29. package/lib/expectations/isClickable.js +15 -17
  30. package/lib/expectations/isClickable.js.map +1 -1
  31. package/lib/expectations/isEnabled.d.ts +14 -7
  32. package/lib/expectations/isEnabled.d.ts.map +1 -0
  33. package/lib/expectations/isEnabled.js +17 -9
  34. package/lib/expectations/isEnabled.js.map +1 -1
  35. package/lib/expectations/isSelected.d.ts +14 -7
  36. package/lib/expectations/isSelected.d.ts.map +1 -0
  37. package/lib/expectations/isSelected.js +15 -9
  38. package/lib/expectations/isSelected.js.map +1 -1
  39. package/lib/expectations/isVisible.d.ts +14 -7
  40. package/lib/expectations/isVisible.d.ts.map +1 -0
  41. package/lib/expectations/isVisible.js +17 -9
  42. package/lib/expectations/isVisible.js.map +1 -1
  43. package/lib/index.d.ts +1 -1
  44. package/lib/index.d.ts.map +1 -0
  45. package/lib/index.js +5 -2
  46. package/lib/index.js.map +1 -1
  47. package/lib/screenplay/abilities/BrowseTheWeb.d.ts +88 -45
  48. package/lib/screenplay/abilities/BrowseTheWeb.d.ts.map +1 -0
  49. package/lib/screenplay/abilities/BrowseTheWeb.js +89 -19
  50. package/lib/screenplay/abilities/BrowseTheWeb.js.map +1 -1
  51. package/lib/screenplay/abilities/index.d.ts +1 -1
  52. package/lib/screenplay/abilities/index.d.ts.map +1 -0
  53. package/lib/screenplay/abilities/index.js +5 -2
  54. package/lib/screenplay/abilities/index.js.map +1 -1
  55. package/lib/screenplay/index.d.ts +1 -0
  56. package/lib/screenplay/index.d.ts.map +1 -0
  57. package/lib/screenplay/index.js +5 -1
  58. package/lib/screenplay/index.js.map +1 -1
  59. package/lib/screenplay/interactions/Clear.d.ts +50 -55
  60. package/lib/screenplay/interactions/Clear.d.ts.map +1 -0
  61. package/lib/screenplay/interactions/Clear.js +70 -63
  62. package/lib/screenplay/interactions/Clear.js.map +1 -1
  63. package/lib/screenplay/interactions/Click.d.ts +41 -50
  64. package/lib/screenplay/interactions/Click.d.ts.map +1 -0
  65. package/lib/screenplay/interactions/Click.js +45 -55
  66. package/lib/screenplay/interactions/Click.js.map +1 -1
  67. package/lib/screenplay/interactions/DoubleClick.d.ts +64 -67
  68. package/lib/screenplay/interactions/DoubleClick.d.ts.map +1 -0
  69. package/lib/screenplay/interactions/DoubleClick.js +68 -72
  70. package/lib/screenplay/interactions/DoubleClick.js.map +1 -1
  71. package/lib/screenplay/interactions/Enter.d.ts +42 -51
  72. package/lib/screenplay/interactions/Enter.d.ts.map +1 -0
  73. package/lib/screenplay/interactions/Enter.js +42 -52
  74. package/lib/screenplay/interactions/Enter.js.map +1 -1
  75. package/lib/screenplay/interactions/ExecuteScript.d.ts +144 -148
  76. package/lib/screenplay/interactions/ExecuteScript.d.ts.map +1 -0
  77. package/lib/screenplay/interactions/ExecuteScript.js +163 -185
  78. package/lib/screenplay/interactions/ExecuteScript.js.map +1 -1
  79. package/lib/screenplay/interactions/Hover.d.ts +40 -50
  80. package/lib/screenplay/interactions/Hover.d.ts.map +1 -0
  81. package/lib/screenplay/interactions/Hover.js +44 -55
  82. package/lib/screenplay/interactions/Hover.js.map +1 -1
  83. package/lib/screenplay/interactions/Navigate.d.ts +106 -113
  84. package/lib/screenplay/interactions/Navigate.d.ts.map +1 -0
  85. package/lib/screenplay/interactions/Navigate.js +124 -146
  86. package/lib/screenplay/interactions/Navigate.js.map +1 -1
  87. package/lib/screenplay/interactions/PageElementInteraction.d.ts +12 -28
  88. package/lib/screenplay/interactions/PageElementInteraction.d.ts.map +1 -0
  89. package/lib/screenplay/interactions/PageElementInteraction.js +12 -33
  90. package/lib/screenplay/interactions/PageElementInteraction.js.map +1 -1
  91. package/lib/screenplay/interactions/Press.d.ts +61 -55
  92. package/lib/screenplay/interactions/Press.d.ts.map +1 -0
  93. package/lib/screenplay/interactions/Press.js +83 -72
  94. package/lib/screenplay/interactions/Press.js.map +1 -1
  95. package/lib/screenplay/interactions/RightClick.d.ts +59 -65
  96. package/lib/screenplay/interactions/RightClick.d.ts.map +1 -0
  97. package/lib/screenplay/interactions/RightClick.js +63 -70
  98. package/lib/screenplay/interactions/RightClick.js.map +1 -1
  99. package/lib/screenplay/interactions/Scroll.d.ts +46 -64
  100. package/lib/screenplay/interactions/Scroll.d.ts.map +1 -0
  101. package/lib/screenplay/interactions/Scroll.js +49 -71
  102. package/lib/screenplay/interactions/Scroll.js.map +1 -1
  103. package/lib/screenplay/interactions/Select.d.ts +217 -193
  104. package/lib/screenplay/interactions/Select.d.ts.map +1 -0
  105. package/lib/screenplay/interactions/Select.js +218 -245
  106. package/lib/screenplay/interactions/Select.js.map +1 -1
  107. package/lib/screenplay/interactions/Switch.d.ts +105 -128
  108. package/lib/screenplay/interactions/Switch.d.ts.map +1 -0
  109. package/lib/screenplay/interactions/Switch.js +121 -172
  110. package/lib/screenplay/interactions/Switch.js.map +1 -1
  111. package/lib/screenplay/interactions/TakeScreenshot.d.ts +28 -50
  112. package/lib/screenplay/interactions/TakeScreenshot.d.ts.map +1 -0
  113. package/lib/screenplay/interactions/TakeScreenshot.js +32 -57
  114. package/lib/screenplay/interactions/TakeScreenshot.js.map +1 -1
  115. package/lib/screenplay/interactions/index.d.ts +2 -3
  116. package/lib/screenplay/interactions/index.d.ts.map +1 -0
  117. package/lib/screenplay/interactions/index.js +6 -4
  118. package/lib/screenplay/interactions/index.js.map +1 -1
  119. package/lib/screenplay/models/BrowserCapabilities.d.ts +24 -0
  120. package/lib/screenplay/models/BrowserCapabilities.d.ts.map +1 -0
  121. package/lib/screenplay/models/BrowserCapabilities.js.map +1 -0
  122. package/lib/screenplay/models/BrowsingSession.d.ts +69 -0
  123. package/lib/screenplay/models/BrowsingSession.d.ts.map +1 -0
  124. package/lib/screenplay/models/BrowsingSession.js +101 -0
  125. package/lib/screenplay/models/BrowsingSession.js.map +1 -0
  126. package/lib/screenplay/models/Cookie.d.ts +104 -64
  127. package/lib/screenplay/models/Cookie.d.ts.map +1 -0
  128. package/lib/screenplay/models/Cookie.js +110 -59
  129. package/lib/screenplay/models/Cookie.js.map +1 -1
  130. package/lib/screenplay/models/CookieData.d.ts +20 -58
  131. package/lib/screenplay/models/CookieData.d.ts.map +1 -0
  132. package/lib/{input → screenplay/models}/Key.d.ts +13 -9
  133. package/lib/screenplay/models/Key.d.ts.map +1 -0
  134. package/lib/{input → screenplay/models}/Key.js +16 -13
  135. package/lib/screenplay/models/Key.js.map +1 -0
  136. package/lib/screenplay/models/Locator.d.ts +29 -8
  137. package/lib/screenplay/models/Locator.d.ts.map +1 -0
  138. package/lib/screenplay/models/Locator.js +53 -7
  139. package/lib/screenplay/models/Locator.js.map +1 -1
  140. package/lib/screenplay/models/Page.d.ts +398 -36
  141. package/lib/screenplay/models/Page.d.ts.map +1 -0
  142. package/lib/screenplay/models/Page.js +209 -4
  143. package/lib/screenplay/models/Page.js.map +1 -1
  144. package/lib/screenplay/models/PageElement.d.ts +77 -5
  145. package/lib/screenplay/models/PageElement.d.ts.map +1 -0
  146. package/lib/screenplay/models/PageElement.js +29 -7
  147. package/lib/screenplay/models/PageElement.js.map +1 -1
  148. package/lib/screenplay/models/PageElements.d.ts +16 -3
  149. package/lib/screenplay/models/PageElements.d.ts.map +1 -0
  150. package/lib/screenplay/models/PageElements.js +21 -8
  151. package/lib/screenplay/models/PageElements.js.map +1 -1
  152. package/lib/screenplay/models/RootLocator.d.ts +25 -0
  153. package/lib/screenplay/models/RootLocator.d.ts.map +1 -0
  154. package/lib/screenplay/models/RootLocator.js +52 -0
  155. package/lib/screenplay/models/RootLocator.js.map +1 -0
  156. package/lib/screenplay/models/SelectOption.d.ts +25 -0
  157. package/lib/screenplay/models/SelectOption.d.ts.map +1 -0
  158. package/lib/screenplay/models/SelectOption.js +37 -0
  159. package/lib/screenplay/models/SelectOption.js.map +1 -0
  160. package/lib/screenplay/models/Switchable.d.ts +23 -0
  161. package/lib/screenplay/models/Switchable.d.ts.map +1 -0
  162. package/lib/screenplay/{interactions/WaitBuilder.js → models/Switchable.js} +1 -1
  163. package/lib/screenplay/models/Switchable.js.map +1 -0
  164. package/lib/screenplay/models/SwitchableOrigin.d.ts +18 -0
  165. package/lib/screenplay/models/SwitchableOrigin.d.ts.map +1 -0
  166. package/lib/screenplay/{interactions/EnterBuilder.js → models/SwitchableOrigin.js} +1 -1
  167. package/lib/screenplay/models/SwitchableOrigin.js.map +1 -0
  168. package/lib/screenplay/models/dialogs/AbsentModalDialog.d.ts +15 -0
  169. package/lib/screenplay/models/dialogs/AbsentModalDialog.d.ts.map +1 -0
  170. package/lib/screenplay/models/dialogs/AbsentModalDialog.js +24 -0
  171. package/lib/screenplay/models/dialogs/AbsentModalDialog.js.map +1 -0
  172. package/lib/screenplay/models/dialogs/AcceptedModalDialog.d.ts +17 -0
  173. package/lib/screenplay/models/dialogs/AcceptedModalDialog.d.ts.map +1 -0
  174. package/lib/screenplay/models/dialogs/AcceptedModalDialog.js +29 -0
  175. package/lib/screenplay/models/dialogs/AcceptedModalDialog.js.map +1 -0
  176. package/lib/screenplay/models/dialogs/DismissedModalDialog.d.ts +17 -0
  177. package/lib/screenplay/models/dialogs/DismissedModalDialog.d.ts.map +1 -0
  178. package/lib/screenplay/models/dialogs/DismissedModalDialog.js +29 -0
  179. package/lib/screenplay/models/dialogs/DismissedModalDialog.js.map +1 -0
  180. package/lib/screenplay/models/dialogs/ModalDialog.d.ts +168 -0
  181. package/lib/screenplay/models/dialogs/ModalDialog.d.ts.map +1 -0
  182. package/lib/screenplay/models/dialogs/ModalDialog.js +174 -0
  183. package/lib/screenplay/models/dialogs/ModalDialog.js.map +1 -0
  184. package/lib/screenplay/models/dialogs/ModalDialogHandler.d.ts +38 -0
  185. package/lib/screenplay/models/dialogs/ModalDialogHandler.d.ts.map +1 -0
  186. package/lib/screenplay/models/dialogs/ModalDialogHandler.js +30 -0
  187. package/lib/screenplay/models/dialogs/ModalDialogHandler.js.map +1 -0
  188. package/lib/screenplay/models/dialogs/index.d.ts +6 -0
  189. package/lib/screenplay/models/dialogs/index.d.ts.map +1 -0
  190. package/lib/screenplay/models/dialogs/index.js +22 -0
  191. package/lib/screenplay/models/dialogs/index.js.map +1 -0
  192. package/lib/screenplay/models/index.d.ts +9 -1
  193. package/lib/screenplay/models/index.d.ts.map +1 -0
  194. package/lib/screenplay/models/index.js +13 -2
  195. package/lib/screenplay/models/index.js.map +1 -1
  196. package/lib/screenplay/models/selectors/By.d.ts +38 -0
  197. package/lib/screenplay/models/selectors/By.d.ts.map +1 -0
  198. package/lib/screenplay/models/selectors/By.js +43 -0
  199. package/lib/screenplay/models/selectors/By.js.map +1 -1
  200. package/lib/screenplay/models/selectors/ByCss.d.ts +8 -0
  201. package/lib/screenplay/models/selectors/ByCss.d.ts.map +1 -0
  202. package/lib/screenplay/models/selectors/ByCss.js +7 -0
  203. package/lib/screenplay/models/selectors/ByCss.js.map +1 -1
  204. package/lib/screenplay/models/selectors/ByCssContainingText.d.ts +9 -0
  205. package/lib/screenplay/models/selectors/ByCssContainingText.d.ts.map +1 -0
  206. package/lib/screenplay/models/selectors/ByCssContainingText.js +8 -0
  207. package/lib/screenplay/models/selectors/ByCssContainingText.js.map +1 -1
  208. package/lib/screenplay/models/selectors/ByDeepCss.d.ts +14 -0
  209. package/lib/screenplay/models/selectors/ByDeepCss.d.ts.map +1 -0
  210. package/lib/screenplay/models/selectors/ByDeepCss.js +20 -0
  211. package/lib/screenplay/models/selectors/ByDeepCss.js.map +1 -0
  212. package/lib/screenplay/models/selectors/ById.d.ts +8 -0
  213. package/lib/screenplay/models/selectors/ById.d.ts.map +1 -0
  214. package/lib/screenplay/models/selectors/ById.js +7 -0
  215. package/lib/screenplay/models/selectors/ById.js.map +1 -1
  216. package/lib/screenplay/models/selectors/ByTagName.d.ts +8 -0
  217. package/lib/screenplay/models/selectors/ByTagName.d.ts.map +1 -0
  218. package/lib/screenplay/models/selectors/ByTagName.js +7 -0
  219. package/lib/screenplay/models/selectors/ByTagName.js.map +1 -1
  220. package/lib/screenplay/models/selectors/ByXPath.d.ts +8 -0
  221. package/lib/screenplay/models/selectors/ByXPath.d.ts.map +1 -0
  222. package/lib/screenplay/models/selectors/ByXPath.js +7 -0
  223. package/lib/screenplay/models/selectors/ByXPath.js.map +1 -1
  224. package/lib/screenplay/models/selectors/Selector.d.ts +6 -0
  225. package/lib/screenplay/models/selectors/Selector.d.ts.map +1 -0
  226. package/lib/screenplay/models/selectors/Selector.js +6 -1
  227. package/lib/screenplay/models/selectors/Selector.js.map +1 -1
  228. package/lib/screenplay/models/selectors/index.d.ts +2 -0
  229. package/lib/screenplay/models/selectors/index.d.ts.map +1 -0
  230. package/lib/screenplay/models/selectors/index.js +6 -1
  231. package/lib/screenplay/models/selectors/index.js.map +1 -1
  232. package/lib/screenplay/questions/Attribute.d.ts +115 -67
  233. package/lib/screenplay/questions/Attribute.d.ts.map +1 -0
  234. package/lib/screenplay/questions/Attribute.js +128 -74
  235. package/lib/screenplay/questions/Attribute.js.map +1 -1
  236. package/lib/screenplay/questions/CssClasses.d.ts +124 -79
  237. package/lib/screenplay/questions/CssClasses.d.ts.map +1 -0
  238. package/lib/screenplay/questions/CssClasses.js +132 -83
  239. package/lib/screenplay/questions/CssClasses.js.map +1 -1
  240. package/lib/screenplay/questions/LastScriptExecution.d.ts +42 -6
  241. package/lib/screenplay/questions/LastScriptExecution.d.ts.map +1 -0
  242. package/lib/screenplay/questions/LastScriptExecution.js +45 -7
  243. package/lib/screenplay/questions/LastScriptExecution.js.map +1 -1
  244. package/lib/screenplay/questions/Selected.d.ts +202 -171
  245. package/lib/screenplay/questions/Selected.d.ts.map +1 -0
  246. package/lib/screenplay/questions/Selected.js +225 -186
  247. package/lib/screenplay/questions/Selected.js.map +1 -1
  248. package/lib/screenplay/questions/Text.d.ts +101 -82
  249. package/lib/screenplay/questions/Text.d.ts.map +1 -0
  250. package/lib/screenplay/questions/Text.js +143 -92
  251. package/lib/screenplay/questions/Text.js.map +1 -1
  252. package/lib/screenplay/questions/Value.d.ts +77 -44
  253. package/lib/screenplay/questions/Value.d.ts.map +1 -0
  254. package/lib/screenplay/questions/Value.js +84 -47
  255. package/lib/screenplay/questions/Value.js.map +1 -1
  256. package/lib/screenplay/questions/index.d.ts +1 -0
  257. package/lib/screenplay/questions/index.d.ts.map +1 -0
  258. package/lib/screenplay/questions/index.js +5 -1
  259. package/lib/screenplay/questions/index.js.map +1 -1
  260. package/lib/scripts/index.d.ts +2 -0
  261. package/lib/scripts/index.d.ts.map +1 -0
  262. package/lib/{input → scripts}/index.js +6 -2
  263. package/lib/scripts/index.js.map +1 -0
  264. package/lib/scripts/isVisible.d.ts +2 -0
  265. package/lib/scripts/isVisible.d.ts.map +1 -0
  266. package/lib/scripts/isVisible.js +96 -0
  267. package/lib/scripts/isVisible.js.map +1 -0
  268. package/lib/stage/crew/index.d.ts +1 -0
  269. package/lib/stage/crew/index.d.ts.map +1 -0
  270. package/lib/stage/crew/index.js +5 -1
  271. package/lib/stage/crew/index.js.map +1 -1
  272. package/lib/stage/crew/photographer/Photographer.d.ts +126 -39
  273. package/lib/stage/crew/photographer/Photographer.d.ts.map +1 -0
  274. package/lib/stage/crew/photographer/Photographer.js +161 -42
  275. package/lib/stage/crew/photographer/Photographer.js.map +1 -1
  276. package/lib/stage/crew/photographer/index.d.ts +1 -0
  277. package/lib/stage/crew/photographer/index.d.ts.map +1 -0
  278. package/lib/stage/crew/photographer/index.js +5 -1
  279. package/lib/stage/crew/photographer/index.js.map +1 -1
  280. package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.d.ts +13 -12
  281. package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.d.ts.map +1 -0
  282. package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js +22 -33
  283. package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js.map +1 -1
  284. package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.d.ts +8 -8
  285. package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.d.ts.map +1 -0
  286. package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js +7 -8
  287. package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js.map +1 -1
  288. package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.d.ts +8 -7
  289. package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.d.ts.map +1 -0
  290. package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js +7 -7
  291. package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.d.ts +8 -8
  292. package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.d.ts.map +1 -0
  293. package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js +7 -8
  294. package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js.map +1 -1
  295. package/lib/stage/crew/photographer/strategies/index.d.ts +1 -0
  296. package/lib/stage/crew/photographer/strategies/index.d.ts.map +1 -0
  297. package/lib/stage/crew/photographer/strategies/index.js +5 -1
  298. package/lib/stage/crew/photographer/strategies/index.js.map +1 -1
  299. package/lib/stage/index.d.ts +1 -0
  300. package/lib/stage/index.d.ts.map +1 -0
  301. package/lib/stage/index.js +5 -1
  302. package/lib/stage/index.js.map +1 -1
  303. package/package.json +20 -43
  304. package/src/errors/BrowserWindowClosedError.ts +17 -0
  305. package/src/errors/CookieMissingError.ts +10 -0
  306. package/src/errors/ModalDialogObstructsScreenshotError.ts +17 -0
  307. package/src/errors/index.ts +2 -0
  308. package/src/expectations/index.ts +0 -1
  309. package/src/expectations/isActive.ts +23 -12
  310. package/src/expectations/isClickable.ts +22 -21
  311. package/src/expectations/isEnabled.ts +23 -9
  312. package/src/expectations/isSelected.ts +20 -10
  313. package/src/expectations/isVisible.ts +23 -9
  314. package/src/index.ts +0 -1
  315. package/src/screenplay/abilities/BrowseTheWeb.ts +95 -87
  316. package/src/screenplay/abilities/index.ts +0 -1
  317. package/src/screenplay/interactions/Clear.ts +75 -63
  318. package/src/screenplay/interactions/Click.ts +43 -54
  319. package/src/screenplay/interactions/DoubleClick.ts +66 -71
  320. package/src/screenplay/interactions/Enter.ts +41 -53
  321. package/src/screenplay/interactions/ExecuteScript.ts +207 -220
  322. package/src/screenplay/interactions/Hover.ts +42 -54
  323. package/src/screenplay/interactions/Navigate.ts +129 -156
  324. package/src/screenplay/interactions/PageElementInteraction.ts +14 -34
  325. package/src/screenplay/interactions/Press.ts +78 -69
  326. package/src/screenplay/interactions/RightClick.ts +61 -69
  327. package/src/screenplay/interactions/Scroll.ts +48 -71
  328. package/src/screenplay/interactions/Select.ts +229 -269
  329. package/src/screenplay/interactions/Switch.ts +123 -179
  330. package/src/screenplay/interactions/TakeScreenshot.ts +31 -57
  331. package/src/screenplay/interactions/index.ts +1 -3
  332. package/src/screenplay/models/BrowserCapabilities.ts +26 -0
  333. package/src/screenplay/models/BrowsingSession.ts +115 -0
  334. package/src/screenplay/models/Cookie.ts +115 -73
  335. package/src/screenplay/models/CookieData.ts +20 -58
  336. package/src/{input → screenplay/models}/Key.ts +12 -9
  337. package/src/screenplay/models/Locator.ts +43 -9
  338. package/src/screenplay/models/Page.ts +438 -37
  339. package/src/screenplay/models/PageElement.ts +92 -12
  340. package/src/screenplay/models/PageElements.ts +23 -9
  341. package/src/screenplay/models/RootLocator.ts +30 -0
  342. package/src/screenplay/models/SelectOption.ts +38 -0
  343. package/src/screenplay/models/Switchable.ts +24 -0
  344. package/src/screenplay/models/SwitchableOrigin.ts +18 -0
  345. package/src/screenplay/models/dialogs/AbsentModalDialog.ts +22 -0
  346. package/src/screenplay/models/dialogs/AcceptedModalDialog.ts +27 -0
  347. package/src/screenplay/models/dialogs/DismissedModalDialog.ts +27 -0
  348. package/src/screenplay/models/dialogs/ModalDialog.ts +200 -0
  349. package/src/screenplay/models/dialogs/ModalDialogHandler.ts +50 -0
  350. package/src/screenplay/models/dialogs/index.ts +5 -0
  351. package/src/screenplay/models/index.ts +8 -1
  352. package/src/screenplay/models/selectors/By.ts +45 -0
  353. package/src/screenplay/models/selectors/ByCss.ts +7 -0
  354. package/src/screenplay/models/selectors/ByCssContainingText.ts +8 -0
  355. package/src/screenplay/models/selectors/ByDeepCss.ts +15 -0
  356. package/src/screenplay/models/selectors/ById.ts +7 -0
  357. package/src/screenplay/models/selectors/ByTagName.ts +7 -0
  358. package/src/screenplay/models/selectors/ByXPath.ts +7 -0
  359. package/src/screenplay/models/selectors/Selector.ts +6 -1
  360. package/src/screenplay/models/selectors/index.ts +1 -0
  361. package/src/screenplay/questions/Attribute.ts +137 -76
  362. package/src/screenplay/questions/CssClasses.ts +135 -83
  363. package/src/screenplay/questions/LastScriptExecution.ts +45 -8
  364. package/src/screenplay/questions/Selected.ts +237 -191
  365. package/src/screenplay/questions/Text.ts +161 -96
  366. package/src/screenplay/questions/Value.ts +88 -48
  367. package/src/scripts/index.ts +1 -0
  368. package/src/scripts/isVisible.ts +113 -0
  369. package/src/stage/crew/photographer/Photographer.ts +142 -41
  370. package/src/stage/crew/photographer/strategies/PhotoTakingStrategy.ts +27 -42
  371. package/src/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.ts +7 -8
  372. package/src/stage/crew/photographer/strategies/TakePhotosOfFailures.ts +7 -7
  373. package/src/stage/crew/photographer/strategies/TakePhotosOfInteractions.ts +7 -8
  374. package/tsconfig.build.json +14 -0
  375. package/lib/expectations/ElementExpectation.d.ts +0 -83
  376. package/lib/expectations/ElementExpectation.js +0 -102
  377. package/lib/expectations/ElementExpectation.js.map +0 -1
  378. package/lib/input/Key.js.map +0 -1
  379. package/lib/input/index.d.ts +0 -1
  380. package/lib/input/index.js.map +0 -1
  381. package/lib/screenplay/abilities/BrowserCapabilities.d.ts +0 -5
  382. package/lib/screenplay/abilities/BrowserCapabilities.js.map +0 -1
  383. package/lib/screenplay/interactions/EnterBuilder.d.ts +0 -25
  384. package/lib/screenplay/interactions/EnterBuilder.js.map +0 -1
  385. package/lib/screenplay/interactions/PressBuilder.d.ts +0 -26
  386. package/lib/screenplay/interactions/PressBuilder.js +0 -3
  387. package/lib/screenplay/interactions/PressBuilder.js.map +0 -1
  388. package/lib/screenplay/interactions/SelectBuilder.d.ts +0 -33
  389. package/lib/screenplay/interactions/SelectBuilder.js +0 -3
  390. package/lib/screenplay/interactions/SelectBuilder.js.map +0 -1
  391. package/lib/screenplay/interactions/Wait.d.ts +0 -143
  392. package/lib/screenplay/interactions/Wait.js +0 -238
  393. package/lib/screenplay/interactions/Wait.js.map +0 -1
  394. package/lib/screenplay/interactions/WaitBuilder.d.ts +0 -32
  395. package/lib/screenplay/interactions/WaitBuilder.js.map +0 -1
  396. package/lib/screenplay/models/ModalDialog.d.ts +0 -9
  397. package/lib/screenplay/models/ModalDialog.js +0 -14
  398. package/lib/screenplay/models/ModalDialog.js.map +0 -1
  399. package/lib/screenplay/questions/ElementQuestion.d.ts +0 -33
  400. package/lib/screenplay/questions/ElementQuestion.js +0 -53
  401. package/lib/screenplay/questions/ElementQuestion.js.map +0 -1
  402. package/src/expectations/ElementExpectation.ts +0 -108
  403. package/src/input/index.ts +0 -1
  404. package/src/screenplay/abilities/BrowserCapabilities.ts +0 -5
  405. package/src/screenplay/interactions/EnterBuilder.ts +0 -28
  406. package/src/screenplay/interactions/PressBuilder.ts +0 -29
  407. package/src/screenplay/interactions/SelectBuilder.ts +0 -36
  408. package/src/screenplay/interactions/Wait.ts +0 -260
  409. package/src/screenplay/interactions/WaitBuilder.ts +0 -34
  410. package/src/screenplay/models/ModalDialog.ts +0 -19
  411. package/src/screenplay/questions/ElementQuestion.ts +0 -58
  412. package/tsconfig.eslint.json +0 -10
  413. /package/lib/screenplay/{abilities → models}/BrowserCapabilities.js +0 -0
@@ -1,5 +0,0 @@
1
- export interface BrowserCapabilities {
2
- platformName?: string;
3
- browserName?: string;
4
- browserVersion?: string;
5
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"BrowserCapabilities.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/BrowserCapabilities.ts"],"names":[],"mappings":""}
@@ -1,25 +0,0 @@
1
- import { Answerable, Interaction } from '@serenity-js/core';
2
- import { PageElement } from '../models';
3
- /**
4
- * @desc
5
- * Fluent interface to make the instantiation of
6
- * the {@link @serenity-js/core/lib/screenplay~Interaction}
7
- * to {@link Enter} more readable.
8
- *
9
- * @see {@link Enter}
10
- *
11
- * @interface
12
- */
13
- export interface EnterBuilder {
14
- /**
15
- * @desc
16
- * Instantiates an {@link @serenity-js/core/lib/screenplay~Interaction}
17
- * to {@link Enter}.
18
- *
19
- * @param {Answerable<PageElement>} field
20
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
21
- *
22
- * @see {@link Target}
23
- */
24
- into: (field: Answerable<PageElement>) => Interaction;
25
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"EnterBuilder.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/EnterBuilder.ts"],"names":[],"mappings":""}
@@ -1,26 +0,0 @@
1
- import { Answerable } from '@serenity-js/core';
2
- import { Interaction } from '@serenity-js/core/lib/screenplay';
3
- import { PageElement } from '../models';
4
- /**
5
- * @desc
6
- * Fluent interface to make the instantiation of
7
- * the {@link @serenity-js/core/lib/screenplay~Interaction}
8
- * to {@link Press} more readable.
9
- *
10
- * @see {@link Press}
11
- *
12
- * @interface
13
- */
14
- export interface PressBuilder {
15
- /**
16
- * @desc
17
- * Instantiates an {@link @serenity-js/core/lib/screenplay~Interaction}
18
- * to {@link Press}.
19
- *
20
- * @param {Answerable<PageElement>} field
21
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
22
- *
23
- * @see {@link Target}
24
- */
25
- in: (field: Answerable<PageElement>) => Interaction;
26
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=PressBuilder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PressBuilder.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/PressBuilder.ts"],"names":[],"mappings":""}
@@ -1,33 +0,0 @@
1
- import { Answerable } from '@serenity-js/core';
2
- import { Interaction } from '@serenity-js/core/lib/screenplay';
3
- import { PageElement } from '../models';
4
- /**
5
- * @desc
6
- * Configures the {@link Target} representing
7
- * a [HTML `<select>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select)
8
- * for the {@link @serenity-js/core/lib/screenplay/actor~Actor}
9
- * to interact with.
10
- *
11
- * @interface
12
- */
13
- export interface SelectBuilder {
14
- /**
15
- * @desc
16
- * Configures the {@link Target} representing
17
- * a [HTML `<select>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select)
18
- * for the {@link @serenity-js/core/lib/screenplay/actor~Actor}
19
- * to interact with
20
- *
21
- * @param {Answerable<PageElement>} pageElement
22
- *
23
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
24
- *
25
- * @see {@link Select}
26
- * @see {@link Select.option}
27
- * @see {@link Select.options}
28
- * @see {@link Select.value}
29
- * @see {@link Select.values}
30
- * @see {@link Target}
31
- */
32
- from: (pageElement: Answerable<PageElement>) => Interaction;
33
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=SelectBuilder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectBuilder.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/SelectBuilder.ts"],"names":[],"mappings":""}
@@ -1,143 +0,0 @@
1
- import { Answerable, Duration, Expectation, Interaction } from '@serenity-js/core';
2
- import { WaitBuilder } from './WaitBuilder';
3
- /**
4
- * @desc
5
- * Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
6
- * wait before proceeding either for a set {@link @serenity-js/core/lib/model~Duration}
7
- * or until a given {@link @serenity-js/core/lib/screenplay/questions~Expectation} is met.
8
- *
9
- * Under the hood, `Wait` uses WebdriverIO ["explicit waiting"](https://webdriver.io/docs/autowait/)
10
- * mechanism.
11
- *
12
- * @example <caption>Example widget</caption>
13
- * <!--
14
- * After about 1 second, the text will change from 'Loading...' to 'Ready!'
15
- * -->
16
- * <h1 id="status">Loading...</h1>
17
- * <script>
18
- * (function () {
19
- * setTimeout(function () {
20
- * document.getElementById('status').textContent = 'Ready!'
21
- * }, 1000);
22
- * })();
23
- * </script>
24
- *
25
- * @example <caption>Lean Page Object describing the widget</caption>
26
- * import { by, Target } from '@serenity-js/webdriverio';
27
- *
28
- * class App {
29
- * static status = Target.the('status widget')
30
- * .located(by.id('status'));
31
- * }
32
- *
33
- * @example <caption>Waiting for a set amount of time</caption>
34
- * import { actorCalled, Duration } from '@serenity-js/core';
35
- * import { BrowseTheWeb, Wait } from '@serenity-js/webdriverio';
36
- * import { Ensure, equals } from '@serenity-js/assertions';
37
- *
38
- * actorCalled('Wendy')
39
- * .whoCan(BrowseTheWeb.using(browser))
40
- * .attemptsTo(
41
- * Wait.for(Duration.ofSeconds(1.5)),
42
- * Ensure.that(App.status, equals('Ready!')),
43
- * );
44
- *
45
- * // Please note that while the above implementation works,
46
- * // this approach is inefficient because at best
47
- * // the actor might wait too long and at worst the test
48
- * // might become "flaky" if any external interference
49
- * // (like network glitches, animations taking a bit too long etc.)
50
- * // makes the actor wait not long enough.
51
- *
52
- * @example <caption>Waiting until a condition is met</caption>
53
- * import { actorCalled } from '@serenity-js/core';
54
- * import { BrowseTheWeb, Wait, Text } from '@serenity-js/webdriverio';
55
- * import { equals } from '@serenity-js/assertions';
56
- *
57
- * actorCalled('Wendy')
58
- * .whoCan(BrowseTheWeb.using(browser))
59
- * .attemptsTo(
60
- * Wait.until(Text.of(App.status), equals('Ready!')),
61
- * // app is ready, proceed with the scenario
62
- * );
63
- *
64
- * // Wait.until makes the Actor keep asking a Question,
65
- * // in this case Text.of(App.status), until the answer meets
66
- * // the expectation, or a timeout expires (default: 5s).
67
- * //
68
- * // Please note that both Ensure and Wait can be used with
69
- * // the same expectations, like `equals`.
70
- *
71
- * @example <caption>Changing the default timeout</caption>
72
- * import { actorCalled, Duration } from '@serenity-js/core';
73
- * import { BrowseTheWeb, Wait, Text } from '@serenity-js/webdriverio';
74
- * import { equals } from '@serenity-js/assertions';
75
- *
76
- * actorCalled('Wendy')
77
- * .whoCan(BrowseTheWeb.using(browser))
78
- * .attemptsTo(
79
- * Wait.upTo(Duration.ofSeconds(3))
80
- * .until(Text.of(App.status), equals('Ready!')),
81
- * // app is ready, proceed with the scenario
82
- * );
83
- *
84
- * @see {@link BrowseTheWeb}
85
- * @see {@link Target}
86
- * @see {@link Text}
87
- * @see {@link @serenity-js/assertions~Ensure}
88
- * @see {@link @serenity-js/assertions/lib/expectations~equals}
89
- * @see {@link @serenity-js/core/lib/model~Duration}
90
- *
91
- * @see {@link @serenity-js/core/lib/screenplay~Interaction}
92
- */
93
- export declare class Wait {
94
- /**
95
- * @desc
96
- * Default timeout of 5 seconds used with {@link Wait.until}.
97
- *
98
- * @type {@serenity-js/core~Duration}
99
- */
100
- static readonly Default_Timeout: Duration;
101
- /**
102
- * @desc
103
- * Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
104
- * configured to wait for a set duration.
105
- *
106
- * @param {Answerable<Duration>} duration
107
- * A set duration the {@link @serenity-js/core/lib/screenplay/actor~Actor} should wait for
108
- * before proceeding
109
- *
110
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
111
- */
112
- static for(duration: Answerable<Duration>): Interaction;
113
- /**
114
- * @desc
115
- * Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
116
- * configured to wait until the answer to the question (`actual`) meets the `expectation`,
117
- * or a custom timeout expires.
118
- *
119
- * @param {Duration} duration
120
- * Custom timeout to override {@link Wait.Default_Timeout}
121
- *
122
- * @returns {WaitBuilder}
123
- */
124
- static upTo(duration: Duration): WaitBuilder;
125
- /**
126
- * @desc
127
- * Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
128
- * configured to wait until the answer to the question (`actual`) meets the `expectation`,
129
- * or a {@link Wait.Default_Timeout} expires.
130
- *
131
- * @param {Answerable<Actual>} actual
132
- * A {@link @serenity-js/core/lib/screenplay~Question}
133
- * that the {@link @serenity-js/core/lib/screenplay/actor~Actor}
134
- * will keep asking until the answer meets
135
- * the {@link @serenity-js/core/lib/screenplay/questions~Expectation} provided
136
- *
137
- * @param {@serenity-js/core/lib/screenplay/questions~<any,Actual>} expectation
138
- * An {@link @serenity-js/core/lib/screenplay/questions~Expectation} to be met before proceeding
139
- *
140
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
141
- */
142
- static until<Actual>(actual: Answerable<Actual>, expectation: Expectation<Actual>): Interaction;
143
- }
@@ -1,238 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Wait = void 0;
4
- const core_1 = require("@serenity-js/core");
5
- const io_1 = require("@serenity-js/core/lib/io");
6
- const abilities_1 = require("../abilities");
7
- /**
8
- * @desc
9
- * Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
10
- * wait before proceeding either for a set {@link @serenity-js/core/lib/model~Duration}
11
- * or until a given {@link @serenity-js/core/lib/screenplay/questions~Expectation} is met.
12
- *
13
- * Under the hood, `Wait` uses WebdriverIO ["explicit waiting"](https://webdriver.io/docs/autowait/)
14
- * mechanism.
15
- *
16
- * @example <caption>Example widget</caption>
17
- * <!--
18
- * After about 1 second, the text will change from 'Loading...' to 'Ready!'
19
- * -->
20
- * <h1 id="status">Loading...</h1>
21
- * <script>
22
- * (function () {
23
- * setTimeout(function () {
24
- * document.getElementById('status').textContent = 'Ready!'
25
- * }, 1000);
26
- * })();
27
- * </script>
28
- *
29
- * @example <caption>Lean Page Object describing the widget</caption>
30
- * import { by, Target } from '@serenity-js/webdriverio';
31
- *
32
- * class App {
33
- * static status = Target.the('status widget')
34
- * .located(by.id('status'));
35
- * }
36
- *
37
- * @example <caption>Waiting for a set amount of time</caption>
38
- * import { actorCalled, Duration } from '@serenity-js/core';
39
- * import { BrowseTheWeb, Wait } from '@serenity-js/webdriverio';
40
- * import { Ensure, equals } from '@serenity-js/assertions';
41
- *
42
- * actorCalled('Wendy')
43
- * .whoCan(BrowseTheWeb.using(browser))
44
- * .attemptsTo(
45
- * Wait.for(Duration.ofSeconds(1.5)),
46
- * Ensure.that(App.status, equals('Ready!')),
47
- * );
48
- *
49
- * // Please note that while the above implementation works,
50
- * // this approach is inefficient because at best
51
- * // the actor might wait too long and at worst the test
52
- * // might become "flaky" if any external interference
53
- * // (like network glitches, animations taking a bit too long etc.)
54
- * // makes the actor wait not long enough.
55
- *
56
- * @example <caption>Waiting until a condition is met</caption>
57
- * import { actorCalled } from '@serenity-js/core';
58
- * import { BrowseTheWeb, Wait, Text } from '@serenity-js/webdriverio';
59
- * import { equals } from '@serenity-js/assertions';
60
- *
61
- * actorCalled('Wendy')
62
- * .whoCan(BrowseTheWeb.using(browser))
63
- * .attemptsTo(
64
- * Wait.until(Text.of(App.status), equals('Ready!')),
65
- * // app is ready, proceed with the scenario
66
- * );
67
- *
68
- * // Wait.until makes the Actor keep asking a Question,
69
- * // in this case Text.of(App.status), until the answer meets
70
- * // the expectation, or a timeout expires (default: 5s).
71
- * //
72
- * // Please note that both Ensure and Wait can be used with
73
- * // the same expectations, like `equals`.
74
- *
75
- * @example <caption>Changing the default timeout</caption>
76
- * import { actorCalled, Duration } from '@serenity-js/core';
77
- * import { BrowseTheWeb, Wait, Text } from '@serenity-js/webdriverio';
78
- * import { equals } from '@serenity-js/assertions';
79
- *
80
- * actorCalled('Wendy')
81
- * .whoCan(BrowseTheWeb.using(browser))
82
- * .attemptsTo(
83
- * Wait.upTo(Duration.ofSeconds(3))
84
- * .until(Text.of(App.status), equals('Ready!')),
85
- * // app is ready, proceed with the scenario
86
- * );
87
- *
88
- * @see {@link BrowseTheWeb}
89
- * @see {@link Target}
90
- * @see {@link Text}
91
- * @see {@link @serenity-js/assertions~Ensure}
92
- * @see {@link @serenity-js/assertions/lib/expectations~equals}
93
- * @see {@link @serenity-js/core/lib/model~Duration}
94
- *
95
- * @see {@link @serenity-js/core/lib/screenplay~Interaction}
96
- */
97
- class Wait {
98
- /**
99
- * @desc
100
- * Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
101
- * configured to wait for a set duration.
102
- *
103
- * @param {Answerable<Duration>} duration
104
- * A set duration the {@link @serenity-js/core/lib/screenplay/actor~Actor} should wait for
105
- * before proceeding
106
- *
107
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
108
- */
109
- static for(duration) {
110
- return new WaitFor(duration);
111
- }
112
- /**
113
- * @desc
114
- * Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
115
- * configured to wait until the answer to the question (`actual`) meets the `expectation`,
116
- * or a custom timeout expires.
117
- *
118
- * @param {Duration} duration
119
- * Custom timeout to override {@link Wait.Default_Timeout}
120
- *
121
- * @returns {WaitBuilder}
122
- */
123
- static upTo(duration) {
124
- return {
125
- until: (actual, expectation) => new WaitUntil(actual, expectation, duration),
126
- };
127
- }
128
- /**
129
- * @desc
130
- * Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
131
- * configured to wait until the answer to the question (`actual`) meets the `expectation`,
132
- * or a {@link Wait.Default_Timeout} expires.
133
- *
134
- * @param {Answerable<Actual>} actual
135
- * A {@link @serenity-js/core/lib/screenplay~Question}
136
- * that the {@link @serenity-js/core/lib/screenplay/actor~Actor}
137
- * will keep asking until the answer meets
138
- * the {@link @serenity-js/core/lib/screenplay/questions~Expectation} provided
139
- *
140
- * @param {@serenity-js/core/lib/screenplay/questions~<any,Actual>} expectation
141
- * An {@link @serenity-js/core/lib/screenplay/questions~Expectation} to be met before proceeding
142
- *
143
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
144
- */
145
- static until(actual, expectation) {
146
- return new WaitUntil(actual, expectation, Wait.Default_Timeout);
147
- }
148
- }
149
- exports.Wait = Wait;
150
- /**
151
- * @desc
152
- * Default timeout of 5 seconds used with {@link Wait.until}.
153
- *
154
- * @type {@serenity-js/core~Duration}
155
- */
156
- Wait.Default_Timeout = core_1.Duration.ofSeconds(5);
157
- /**
158
- * @package
159
- */
160
- class WaitFor extends core_1.Interaction {
161
- constructor(duration) {
162
- super();
163
- this.duration = duration;
164
- }
165
- /**
166
- * @desc
167
- * Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
168
- * perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
169
- *
170
- * @param {UsesAbilities & AnswersQuestions} actor
171
- * @returns {Promise<void>}
172
- *
173
- * @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
174
- * @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
175
- * @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
176
- */
177
- async performAs(actor) {
178
- return actor.answer(this.duration)
179
- .then(duration => abilities_1.BrowseTheWeb.as(actor).waitFor(duration));
180
- }
181
- /**
182
- * @desc
183
- * Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
184
- *
185
- * @returns {string}
186
- */
187
- toString() {
188
- return (0, io_1.formatted) `#actor waits for ${this.duration}`;
189
- }
190
- }
191
- /**
192
- * @package
193
- */
194
- class WaitUntil extends core_1.Interaction {
195
- constructor(actual, expectation, timeout) {
196
- super();
197
- this.actual = actual;
198
- this.expectation = expectation;
199
- this.timeout = timeout;
200
- }
201
- /**
202
- * @desc
203
- * Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
204
- * perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
205
- *
206
- * @param {UsesAbilities & AnswersQuestions} actor
207
- * @returns {Promise<void>}
208
- *
209
- * @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
210
- * @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
211
- * @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
212
- */
213
- performAs(actor) {
214
- const actual = this.actual, expectation = this.expectation;
215
- let expectationOutcome;
216
- return abilities_1.BrowseTheWeb.as(actor)
217
- .waitUntil(async function () {
218
- expectationOutcome = await actor.answer(expectation.isMetFor(actual));
219
- return expectationOutcome instanceof core_1.ExpectationMet;
220
- }, this.timeout)
221
- .catch(error => {
222
- if (expectationOutcome) {
223
- throw new core_1.AssertionError(`Waited ${this.timeout.toString()} for ${(0, io_1.formatted) `${this.actual}`} to ${this.expectation.toString()}`, expectationOutcome.expected, expectationOutcome.actual, error);
224
- }
225
- throw error;
226
- });
227
- }
228
- /**
229
- * @desc
230
- * Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
231
- *
232
- * @returns {string}
233
- */
234
- toString() {
235
- return (0, io_1.formatted) `#actor waits up to ${this.timeout} until ${this.actual} does ${this.expectation}`;
236
- }
237
- }
238
- //# sourceMappingURL=Wait.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Wait.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Wait.ts"],"names":[],"mappings":";;;AAAA,4CAAwK;AACxK,iDAAqD;AAErD,4CAA4C;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AACH,MAAa,IAAI;IAUb;;;;;;;;;;OAUG;IACH,MAAM,CAAC,GAAG,CAAC,QAA8B;QACrC,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAI,CAAC,QAAkB;QAC1B,OAAO;YACH,KAAK,EAAE,CAAS,MAA0B,EAAE,WAAgC,EAAe,EAAE,CACzF,IAAI,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,CAAC;SACnD,CAAC;IACN,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,KAAK,CAAS,MAA0B,EAAE,WAAgC;QAC7E,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;IACpE,CAAC;;AA9DL,oBA+DC;AA7DG;;;;;GAKG;AACa,oBAAe,GAAG,eAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAyD5D;;GAEG;AACH,MAAM,OAAQ,SAAQ,kBAAW;IAC7B,YAA6B,QAA8B;QACvD,KAAK,EAAE,CAAC;QADiB,aAAQ,GAAR,QAAQ,CAAsB;IAE3D,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,SAAS,CAAC,KAAuC;QACnD,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;aAC7B,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpE,CAAC;IAED;;;;;OAKG;IACH,QAAQ;QACJ,OAAO,IAAA,cAAS,EAAA,oBAAqB,IAAI,CAAC,QAAS,EAAE,CAAC;IAC1D,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,SAAkB,SAAQ,kBAAW;IACvC,YACqB,MAA0B,EAC1B,WAAgC,EAChC,OAAiB;QAElC,KAAK,EAAE,CAAC;QAJS,WAAM,GAAN,MAAM,CAAoB;QAC1B,gBAAW,GAAX,WAAW,CAAqB;QAChC,YAAO,GAAP,OAAO,CAAU;IAGtC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,KAAuC;QAC7C,MACI,MAAM,GAAQ,IAAI,CAAC,MAAM,EACzB,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAEnC,IAAI,kBAAmD,CAAC;QAExD,OAAO,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC;aACxB,SAAS,CACN,KAAK;YACD,kBAAkB,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YACtE,OAAO,kBAAkB,YAAY,qBAAc,CAAC;QACxD,CAAC,EACD,IAAI,CAAC,OAAO,CACf;aACA,KAAK,CAAC,KAAK,CAAC,EAAE;YACX,IAAI,kBAAkB,EAAE;gBACpB,MAAM,IAAI,qBAAc,CACpB,UAAW,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAG,QAAS,IAAA,cAAS,EAAC,GAAI,IAAI,CAAC,MAAO,EAAG,OAAQ,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAG,EAAE,EAC/G,kBAAkB,CAAC,QAAQ,EAC3B,kBAAkB,CAAC,MAAM,EACzB,KAAK,CACR,CAAC;aACL;YAED,MAAM,KAAK,CAAC;QAChB,CAAC,CAAC,CAAC;IACX,CAAC;IAED;;;;;OAKG;IACH,QAAQ;QACJ,OAAO,IAAA,cAAS,EAAA,sBAAuB,IAAI,CAAC,OAAQ,UAAW,IAAI,CAAC,MAAO,SAAU,IAAI,CAAC,WAAY,EAAE,CAAC;IAC7G,CAAC;CACJ"}
@@ -1,32 +0,0 @@
1
- import { Answerable, Expectation, Interaction } from '@serenity-js/core';
2
- /**
3
- * @desc
4
- * Fluent interface to make the instantiation of
5
- * the {@link @serenity-js/core/lib/screenplay~Interaction}
6
- * to {@link Wait} more readable.
7
- *
8
- * @see {@link Wait}
9
- *
10
- * @interface
11
- */
12
- export interface WaitBuilder {
13
- /**
14
- * @desc
15
- * Instantiates an {@link @serenity-js/core/lib/screenplay~Interaction}
16
- * to {@link Wait}.
17
- *
18
- * @param {Answerable<Actual>} actual
19
- * A {@link @serenity-js/core/lib/screenplay~Question}
20
- * that the {@link @serenity-js/core/lib/screenplay/actor~Actor}
21
- * will keep asking until the answer meets
22
- * the {@link @serenity-js/core/lib/screenplay/questions~Expectation} provided
23
- *
24
- * @param {@serenity-js/core/lib/screenplay/questions~Expectation<any,Actual>} expectation
25
- * An {@link @serenity-js/assertions~Expectation} to be met before proceeding
26
- *
27
- * @returns {Interaction}
28
- *
29
- * @see {@link Target}
30
- */
31
- until: <Actual>(actual: Answerable<Actual>, expectation: Expectation<Actual>) => Interaction;
32
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"WaitBuilder.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/WaitBuilder.ts"],"names":[],"mappings":""}
@@ -1,9 +0,0 @@
1
- import { Optional, QuestionAdapter } from '@serenity-js/core';
2
- export declare abstract class ModalDialog implements Optional {
3
- static window(): QuestionAdapter<ModalDialog>;
4
- abstract accept(): Promise<void>;
5
- abstract dismiss(): Promise<void>;
6
- abstract text(): Promise<string>;
7
- abstract enterValue(value: string | number | Array<string | number>): Promise<void>;
8
- abstract isPresent(): Promise<boolean>;
9
- }
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ModalDialog = void 0;
4
- const core_1 = require("@serenity-js/core");
5
- const abilities_1 = require("../abilities");
6
- class ModalDialog {
7
- static window() {
8
- return core_1.Question.about('modal dialog', actor => {
9
- return abilities_1.BrowseTheWeb.as(actor).modalDialog();
10
- });
11
- }
12
- }
13
- exports.ModalDialog = ModalDialog;
14
- //# sourceMappingURL=ModalDialog.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModalDialog.js","sourceRoot":"","sources":["../../../src/screenplay/models/ModalDialog.ts"],"names":[],"mappings":";;;AAAA,4CAAwE;AAExE,4CAA4C;AAE5C,MAAsB,WAAW;IAC7B,MAAM,CAAC,MAAM;QACT,OAAO,eAAQ,CAAC,KAAK,CAAc,cAAc,EAAE,KAAK,CAAC,EAAE;YACvD,OAAO,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QAChD,CAAC,CAAC,CAAC;IACP,CAAC;CASJ;AAdD,kCAcC"}
@@ -1,33 +0,0 @@
1
- import { Answerable, AnswersQuestions, Question } from '@serenity-js/core';
2
- /**
3
- * @desc
4
- * A base class for questions about {@link PageElement}s.
5
- *
6
- * @extends {@serenity-js/core/lib/screenplay~Question}
7
- */
8
- export declare abstract class ElementQuestion<T> extends Question<T> {
9
- protected subject: string;
10
- constructor(subject: string);
11
- /**
12
- * @desc
13
- * Changes the description of this question's subject.
14
- *
15
- * @param {string} subject
16
- * @returns {Question<T>}
17
- */
18
- describedAs(subject: string): this;
19
- toString(): string;
20
- /**
21
- * @desc
22
- * Returns the resolved {@link PageElement}, or throws a {@link @serenity-js/core/lib/errors~LogicError}
23
- * if the element is `undefined`.
24
- *
25
- * @param {@serenity-js/core/lib/screenplay/actor~AnswersQuestions} actor
26
- * @param {@serenity-js/core/lib/screenplay~Answerable<Element|ElementList>} element
27
- *
28
- * @returns {Promise<PageElement|PageElements>}
29
- *
30
- * @protected
31
- */
32
- protected resolve<T>(actor: AnswersQuestions, element: Answerable<T>): Promise<T>;
33
- }
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ElementQuestion = void 0;
4
- const core_1 = require("@serenity-js/core");
5
- const io_1 = require("@serenity-js/core/lib/io");
6
- /**
7
- * @desc
8
- * A base class for questions about {@link PageElement}s.
9
- *
10
- * @extends {@serenity-js/core/lib/screenplay~Question}
11
- */
12
- // todo: remove
13
- class ElementQuestion extends core_1.Question {
14
- constructor(subject) {
15
- super();
16
- this.subject = subject;
17
- }
18
- /**
19
- * @desc
20
- * Changes the description of this question's subject.
21
- *
22
- * @param {string} subject
23
- * @returns {Question<T>}
24
- */
25
- describedAs(subject) {
26
- this.subject = subject;
27
- return this;
28
- }
29
- toString() {
30
- return this.subject;
31
- }
32
- /**
33
- * @desc
34
- * Returns the resolved {@link PageElement}, or throws a {@link @serenity-js/core/lib/errors~LogicError}
35
- * if the element is `undefined`.
36
- *
37
- * @param {@serenity-js/core/lib/screenplay/actor~AnswersQuestions} actor
38
- * @param {@serenity-js/core/lib/screenplay~Answerable<Element|ElementList>} element
39
- *
40
- * @returns {Promise<PageElement|PageElements>}
41
- *
42
- * @protected
43
- */
44
- async resolve(actor, element) {
45
- const resolved = await actor.answer(element);
46
- if (!resolved) {
47
- throw new core_1.LogicError((0, io_1.formatted) `Couldn't find ${element}`);
48
- }
49
- return resolved;
50
- }
51
- }
52
- exports.ElementQuestion = ElementQuestion;
53
- //# sourceMappingURL=ElementQuestion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ElementQuestion.js","sourceRoot":"","sources":["../../../src/screenplay/questions/ElementQuestion.ts"],"names":[],"mappings":";;;AAAA,4CAAuF;AACvF,iDAAqD;AAErD;;;;;GAKG;AACH,eAAe;AACf,MAAsB,eAClB,SAAQ,eAAW;IAEnB,YAAsB,OAAe;QACjC,KAAK,EAAE,CAAC;QADU,YAAO,GAAP,OAAO,CAAQ;IAErC,CAAC;IAED;;;;;;OAMG;IACH,WAAW,CAAC,OAAe;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;;;;;;;;OAWG;IACO,KAAK,CAAC,OAAO,CACnB,KAAuB,EACvB,OAAsB;QAEtB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAE7C,IAAI,CAAE,QAAQ,EAAE;YACZ,MAAM,IAAI,iBAAU,CAAC,IAAA,cAAS,EAAC,iBAAkB,OAAQ,EAAE,CAAC,CAAC;SAChE;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AA/CD,0CA+CC"}