@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
@@ -3,95 +3,101 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Press = void 0;
4
4
  const core_1 = require("@serenity-js/core");
5
5
  const io_1 = require("@serenity-js/core/lib/io");
6
- const input_1 = require("../../input");
7
6
  const abilities_1 = require("../abilities");
7
+ const models_1 = require("../models");
8
8
  const PageElementInteraction_1 = require("./PageElementInteraction");
9
9
  /**
10
- * @desc
11
- * Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
12
- * send a key press or a sequence of keys to a Web element.
10
+ * Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
11
+ * to send a key press or a sequence of keys to a Web element.
13
12
  *
14
- * *Please note*: On macOS, some keyboard shortcuts might not work with the [`devtools` protocol](https://webdriver.io/docs/automationProtocols/#devtools-protocol).
13
+ * **Note:** On macOS, some keyboard shortcuts might not work
14
+ * with the [`devtools` protocol](https://webdriver.io/docs/automationProtocols/#devtools-protocol).
15
15
  *
16
16
  * For example:
17
- * - to *copy*, instead of `Meta+C`, use `Control+Insert`
18
- * - to *cut*, instead of `Meta+X`, use `Control+Delete`
19
- * - to *paste*, instead of `Meta+V`, use `Shift+Insert`
17
+ * - to *copy*, instead of {@apilink Key.Meta}+`C`, use {@apilink Key.Control}+{@apilink Key.Insert}
18
+ * - to *cut*, instead of {@apilink Key.Meta}+`X`, use {@apilink Key.Control}+{@apilink Key.Delete}
19
+ * - to *paste*, instead of {@apilink Key.Meta}+`V`, use {@apilink Key.Shift}+{@apilink Key.Insert}
20
20
  *
21
- * @example <caption>Example widget</caption>
22
- * <form>
23
- * <input type="text" name="example" id="example" />
24
- * </form>
21
+ * ## Example widget
25
22
  *
26
- * @example <caption>Lean Page Object describing the widget</caption>
27
- * import { by, Target } from '@serenity-js/webdriverio';
23
+ * ```html
24
+ * <form>
25
+ * <input type="text" name="example" id="example" />
26
+ * </form>
27
+ * ```
28
28
  *
29
- * class Form {
30
- * static exampleInput = Target.the('example input')
31
- * .located(by.id('example'));
32
- * }
29
+ * ## Lean Page Object describing the widget
33
30
  *
34
- * @example <caption>Pressing keys</caption>
35
- * import { actorCalled } from '@serenity-js/core';
36
- * import { BrowseTheWeb, Key, Press, Value } from '@serenity-js/webdriverio';
37
- * import { Ensure, equals } from '@serenity-js/assertions';
31
+ * ```ts
32
+ * import { By, PageElement } from '@serenity-js/web'
38
33
  *
39
- * actorCalled('Priyanka')
40
- * .whoCan(BrowseTheWeb.using(browser))
41
- * .attemptsTo(
42
- * Press.the('H', 'i', '!', Key.ENTER).in(Form.exampleInput),
43
- * Ensure.that(Value.of(Form.exampleInput), equals('Hi!')),
44
- * );
34
+ * class Form {
35
+ * static exampleInput = () =>
36
+ * PageElement.located(By.id('example'))
37
+ * .describedAs('example input')
38
+ * }
39
+ * ```
45
40
  *
46
- * @see {@link Key}
47
- * @see {@link BrowseTheWeb}
48
- * @see {@link Target}
49
- * @see {@link @serenity-js/assertions~Ensure}
50
- * @see {@link @serenity-js/assertions/lib/expectations~equals}
41
+ * ## Pressing keys
51
42
  *
52
- * @extends {ElementInteraction}
43
+ * ```ts
44
+ * import { actorCalled } from '@serenity-js/core'
45
+ * import { Key, Press, Value } from '@serenity-js/web'
46
+ * import { Ensure, equals } from '@serenity-js/assertions'
47
+ *
48
+ * await actorCalled('Priyanka')
49
+ * .attemptsTo(
50
+ * Press.the('H', 'i', '!', Key.ENTER).in(Form.exampleInput()),
51
+ * Ensure.that(Value.of(Form.exampleInput), equals('Hi!')),
52
+ * )
53
+ * ```
54
+ *
55
+ * ## Learn more
56
+ *
57
+ * - {@apilink Key}
58
+ * - {@apilink BrowseTheWeb}
59
+ * - {@apilink PageElement}
60
+ *
61
+ * @group Activities
53
62
  */
54
63
  class Press extends PageElementInteraction_1.PageElementInteraction {
55
64
  /**
56
- * @param {Answerable<Array<Key | string>>} keys
57
- * A sequence of one or more keys to press
58
- */
59
- constructor(keys) {
60
- super((0, io_1.formatted) `#actor presses ${keys}`);
61
- this.keys = keys;
62
- }
63
- /**
64
- * @desc
65
- * Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
65
+ * Instantiates an {@apilink Interaction|interaction}
66
+ * that instructs the {@apilink Actor|actor}
67
+ * to press a sequence of {@apilink Key|keys},
66
68
  *
67
- * @param {...keys: Array<Answerable<Key | string | Key[] | string[]>>} keys
68
- * A sequence of one or more keys to press
69
+ * When no `field` is specified, the key sequence will be sent to the currently focused element,
70
+ * and if no element is focused - to the `document.body` to handle.
69
71
  *
70
- * @returns {PressBuilder}
72
+ * @param keys
73
+ * A sequence of one or more keys to press
71
74
  */
72
75
  static the(...keys) {
73
76
  return new Press(KeySequence.of(keys));
74
77
  }
75
- in(field /* | Question<AlertPromise> | AlertPromise */) {
78
+ /**
79
+ * Send the key sequence to a specific element.
80
+ *
81
+ * @param field
82
+ */
83
+ in(field) {
76
84
  return new PressKeyInField(this.keys, field);
77
85
  }
78
86
  /**
79
- * @desc
80
- * Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
81
- * perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
82
- *
83
- * @param {UsesAbilities & AnswersQuestions} actor
84
- * An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
85
- *
86
- * @returns {PromiseLike<void>}
87
- *
88
- * @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
89
- * @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
90
- * @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
87
+ * @param keys
88
+ * A sequence of one or more keys to press
89
+ */
90
+ constructor(keys) {
91
+ super((0, core_1.d) `#actor presses ${keys}`);
92
+ this.keys = keys;
93
+ }
94
+ /**
95
+ * @inheritDoc
91
96
  */
92
97
  async performAs(actor) {
93
98
  const keys = await actor.answer(this.keys);
94
- return abilities_1.BrowseTheWeb.as(actor).sendKeys(keys);
99
+ const page = await abilities_1.BrowseTheWeb.as(actor).currentPage();
100
+ return page.sendKeys(keys);
95
101
  }
96
102
  }
97
103
  exports.Press = Press;
@@ -104,34 +110,38 @@ class PressKeyInField extends PageElementInteraction_1.PageElementInteraction {
104
110
  * Web element to send the keys to
105
111
  */
106
112
  constructor(keys, field /* todo | Question<AlertPromise> | AlertPromise */) {
107
- super((0, io_1.formatted) `#actor presses ${keys} in ${field}`);
113
+ super((0, core_1.d) `#actor presses ${keys} in ${field}`, core_1.Interaction.callerLocation(3));
108
114
  this.keys = keys;
109
115
  this.field = field;
110
116
  }
117
+ /**
118
+ * @inheritDoc
119
+ */
111
120
  async performAs(actor) {
112
121
  const field = await this.resolve(actor, this.field);
113
122
  const keys = await actor.answer(this.keys);
123
+ const page = await abilities_1.BrowseTheWeb.as(actor).currentPage();
114
124
  // fix for protractor
115
- await abilities_1.BrowseTheWeb.as(actor).executeScript(
125
+ await page.executeScript(
116
126
  /* istanbul ignore next */
117
127
  function focus(element) {
118
128
  element.focus();
119
129
  }, await field.nativeElement());
120
- return abilities_1.BrowseTheWeb.as(actor).sendKeys(keys);
130
+ return page.sendKeys(keys);
121
131
  }
122
132
  }
123
133
  /**
124
134
  * @package
125
135
  */
126
136
  class KeySequence extends core_1.Question {
137
+ static of(keys) {
138
+ return new KeySequence(keys);
139
+ }
127
140
  constructor(keys) {
128
141
  super();
129
142
  this.keys = keys;
130
143
  this.subject = KeySequence.describe(keys);
131
144
  }
132
- static of(keys) {
133
- return new KeySequence(keys);
134
- }
135
145
  async answeredBy(actor) {
136
146
  const keys = await (0, io_1.asyncMap)(this.keys, key => actor.answer(key));
137
147
  return keys
@@ -139,23 +149,24 @@ class KeySequence extends core_1.Question {
139
149
  .filter(key => !!key);
140
150
  }
141
151
  /**
142
- * @desc
143
- * Changes the description of this question's subject.
152
+ * Changes the description of this question's subject.
144
153
  *
145
- * @param {string} subject
146
- * @returns {Question<T>}
154
+ * @param subject
147
155
  */
148
156
  describedAs(subject) {
149
157
  this.subject = subject;
150
158
  return this;
151
159
  }
160
+ /**
161
+ * @inheritDoc
162
+ */
152
163
  toString() {
153
164
  return this.subject;
154
165
  }
155
166
  static describe(keys) {
156
167
  const prefix = keys.length === 1 ? 'key' : 'keys';
157
168
  const description = keys.reduce((acc, key, index) => {
158
- const separator = input_1.Key.isKey(key) && key.isModifier
169
+ const separator = models_1.Key.isKey(key) && key.isModifier
159
170
  ? '-'
160
171
  : acc.separator;
161
172
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"Press.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Press.ts"],"names":[],"mappings":";;;AAAA,4CAAiH;AACjH,iDAA+D;AAE/D,uCAAkC;AAClC,4CAA4C;AAE5C,qEAAkE;AAGlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,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AEpB,OAAO;gBACH,WAAW,EAAE,KAAK,KAAK,CAAC;oBACpB,CAAC,CAAC,GAAI,GAAI,EAAE;oBACZ,CAAC,CAAC,GAAI,GAAG,CAAC,WAAY,GAAG,GAAG,CAAC,SAAS,GAAI,GAAI,EAAE;gBACpD,SAAS;aACZ,CAAA;QACL,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,WAAW,CAAC;QAErD,OAAO,GAAI,MAAO,IAAK,WAAY,EAAE,CAAC;IAC1C,CAAC;CACJ"}
@@ -2,88 +2,82 @@ import { Answerable, AnswersQuestions, Interaction, UsesAbilities } from '@seren
2
2
  import { PageElement } from '../models';
3
3
  import { PageElementInteraction } from './PageElementInteraction';
4
4
  /**
5
- * @desc
6
- * Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
7
- * perfom a right click on a given Web element.
5
+ * Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
6
+ * to perfom a right click on a given {@apilink PageElement}.
8
7
  *
9
- * This is typically used to open a [custom context menu](https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event)
10
- * on a given Web element, since it's not possible to interact with the standard context menu offered by your browser
8
+ * This is typically used to open a [custom context menu](https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event)
9
+ * on a given Web element, since it's not possible to interact with the standard context menu offered by your browser.
11
10
  *
12
- * @example <caption>Example widget</caption>
13
- * <form>
14
- * <input type="text" id="field"
15
- * oncontextmenu="showMenu(); return false;" />
11
+ * ## Example widget
16
12
  *
17
- * <div id="context-menu" style="display:none">
18
- * Custom context menu
19
- * </div>
20
- * </form>
13
+ * ```html
14
+ * <form>
15
+ * <input type="text" id="field"
16
+ * oncontextmenu="showMenu(); return false;" />
21
17
  *
22
- * <script>
23
- * function showMenu() {
24
- * document.getElementById("context-menu").style.display = 'block';
25
- * }
26
- * </script>
18
+ * <div id="context-menu" style="display:none">
19
+ * Custom context menu
20
+ * </div>
21
+ * </form>
27
22
  *
28
- * @example <caption>Lean Page Object describing the widget</caption>
29
- * import { by, Target } from '@serenity-js/webdriverio';
23
+ * <script>
24
+ * function showMenu() {
25
+ * document.getElementById("context-menu").style.display = 'block';
26
+ * }
27
+ * </script>
28
+ * ```
30
29
  *
31
- * class Form {
32
- * static exampleInput = Target.the('example input')
33
- * .located(by.id('example'));
34
- * static exampleContextMenu = Target.the('example context menu')
35
- * .located(by.id('context-menu'));
36
- * }
30
+ * ## Lean Page Object describing the widget
37
31
  *
38
- * @example <caption>Right-click on an element</caption>
39
- * import { actorCalled } from '@serenity-js/core';
40
- * import { BrowseTheWeb, RightClick, isVisible } from '@serenity-js/webdriverio';
41
- * import { Ensure } from '@serenity-js/assertions';
32
+ * ```ts
33
+ * import { By, PageElement } from '@serenity-js/web'
42
34
  *
43
- * actorCalled('Chloé')
44
- * .whoCan(BrowseTheWeb.using(browser))
45
- * .attemptsTo(
46
- * RightClick.on(Form.exampleInput),
47
- * Ensure.that(Form.exampleContextMenu, isVisible()),
48
- * );
35
+ * class Form {
36
+ * static exampleInput = () =>
37
+ * PageElement.located(By.id('example'))
38
+ * .describedAs('example input')
49
39
  *
50
- * @see {@link BrowseTheWeb}
51
- * @see {@link Target}
52
- * @see {@link @serenity-js/assertions~Ensure}
53
- * @see {@link isVisible}
40
+ * static exampleContextMenu = () =>
41
+ * PageElement.located(By.id('context-menu'))
42
+ * .describedAs('example context menu')
43
+ * }
44
+ * ```
54
45
  *
55
- * @extends {ElementInteraction}
46
+ * ## Right-click on an element
47
+ *
48
+ * ```ts
49
+ * import { actorCalled } from '@serenity-js/core'
50
+ * import { RightClick, isVisible } from '@serenity-js/web'
51
+ * import { Ensure } from '@serenity-js/assertions'
52
+ *
53
+ * await actorCalled('Chloé')
54
+ * .whoCan(BrowseTheWeb.using(browser))
55
+ * .attemptsTo(
56
+ * RightClick.on(Form.exampleInput()),
57
+ * Ensure.that(Form.exampleContextMenu(), isVisible()),
58
+ * )
59
+ * ```
60
+ *
61
+ * ## Learn more
62
+ *
63
+ * - {@apilink BrowseTheWeb}
64
+ * - {@apilink PageElement}
65
+ *
66
+ * @group Activities
56
67
  */
57
68
  export declare class RightClick extends PageElementInteraction {
58
- private readonly target;
69
+ private readonly pageElement;
59
70
  /**
60
- * @desc
61
- * Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
62
- *
63
- * @param {Answerable<PageElement>} target
64
- * The element to be right-clicked on
71
+ * Instantiates this {@apilink Interaction}.
65
72
  *
66
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
67
- */
68
- static on(target: Answerable<PageElement>): Interaction;
69
- /**
70
- * @param {Answerable<PageElement>} target
73
+ * @param pageElement
71
74
  * The element to be right-clicked on
72
75
  */
73
- constructor(target: Answerable<PageElement>);
76
+ static on(pageElement: Answerable<PageElement>): Interaction;
77
+ protected constructor(pageElement: Answerable<PageElement>);
74
78
  /**
75
- * @desc
76
- * Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
77
- * perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
78
- *
79
- * @param {UsesAbilities & AnswersQuestions} actor
80
- * An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
81
- *
82
- * @returns {PromiseLike<void>}
83
- *
84
- * @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
85
- * @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
86
- * @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
79
+ * @inheritDoc
87
80
  */
88
81
  performAs(actor: UsesAbilities & AnswersQuestions): Promise<void>;
89
82
  }
83
+ //# sourceMappingURL=RightClick.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RightClick.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/RightClick.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAK,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEhG,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,qBAAa,UAAW,SAAQ,sBAAsB;IAW5B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAVlD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,WAAW;IAI5D,SAAS,aAA8B,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC;IAI3E;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAI1E"}
@@ -1,98 +1,91 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RightClick = void 0;
4
- const io_1 = require("@serenity-js/core/lib/io");
4
+ const core_1 = require("@serenity-js/core");
5
5
  const PageElementInteraction_1 = require("./PageElementInteraction");
6
6
  /**
7
- * @desc
8
- * Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
9
- * perfom a right click on a given Web element.
7
+ * Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
8
+ * to perfom a right click on a given {@apilink PageElement}.
10
9
  *
11
- * This is typically used to open a [custom context menu](https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event)
12
- * on a given Web element, since it's not possible to interact with the standard context menu offered by your browser
10
+ * This is typically used to open a [custom context menu](https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event)
11
+ * on a given Web element, since it's not possible to interact with the standard context menu offered by your browser.
13
12
  *
14
- * @example <caption>Example widget</caption>
15
- * <form>
16
- * <input type="text" id="field"
17
- * oncontextmenu="showMenu(); return false;" />
13
+ * ## Example widget
18
14
  *
19
- * <div id="context-menu" style="display:none">
20
- * Custom context menu
21
- * </div>
22
- * </form>
15
+ * ```html
16
+ * <form>
17
+ * <input type="text" id="field"
18
+ * oncontextmenu="showMenu(); return false;" />
23
19
  *
24
- * <script>
25
- * function showMenu() {
26
- * document.getElementById("context-menu").style.display = 'block';
27
- * }
28
- * </script>
20
+ * <div id="context-menu" style="display:none">
21
+ * Custom context menu
22
+ * </div>
23
+ * </form>
29
24
  *
30
- * @example <caption>Lean Page Object describing the widget</caption>
31
- * import { by, Target } from '@serenity-js/webdriverio';
25
+ * <script>
26
+ * function showMenu() {
27
+ * document.getElementById("context-menu").style.display = 'block';
28
+ * }
29
+ * </script>
30
+ * ```
32
31
  *
33
- * class Form {
34
- * static exampleInput = Target.the('example input')
35
- * .located(by.id('example'));
36
- * static exampleContextMenu = Target.the('example context menu')
37
- * .located(by.id('context-menu'));
38
- * }
32
+ * ## Lean Page Object describing the widget
39
33
  *
40
- * @example <caption>Right-click on an element</caption>
41
- * import { actorCalled } from '@serenity-js/core';
42
- * import { BrowseTheWeb, RightClick, isVisible } from '@serenity-js/webdriverio';
43
- * import { Ensure } from '@serenity-js/assertions';
34
+ * ```ts
35
+ * import { By, PageElement } from '@serenity-js/web'
44
36
  *
45
- * actorCalled('Chloé')
46
- * .whoCan(BrowseTheWeb.using(browser))
47
- * .attemptsTo(
48
- * RightClick.on(Form.exampleInput),
49
- * Ensure.that(Form.exampleContextMenu, isVisible()),
50
- * );
37
+ * class Form {
38
+ * static exampleInput = () =>
39
+ * PageElement.located(By.id('example'))
40
+ * .describedAs('example input')
51
41
  *
52
- * @see {@link BrowseTheWeb}
53
- * @see {@link Target}
54
- * @see {@link @serenity-js/assertions~Ensure}
55
- * @see {@link isVisible}
42
+ * static exampleContextMenu = () =>
43
+ * PageElement.located(By.id('context-menu'))
44
+ * .describedAs('example context menu')
45
+ * }
46
+ * ```
56
47
  *
57
- * @extends {ElementInteraction}
48
+ * ## Right-click on an element
49
+ *
50
+ * ```ts
51
+ * import { actorCalled } from '@serenity-js/core'
52
+ * import { RightClick, isVisible } from '@serenity-js/web'
53
+ * import { Ensure } from '@serenity-js/assertions'
54
+ *
55
+ * await actorCalled('Chloé')
56
+ * .whoCan(BrowseTheWeb.using(browser))
57
+ * .attemptsTo(
58
+ * RightClick.on(Form.exampleInput()),
59
+ * Ensure.that(Form.exampleContextMenu(), isVisible()),
60
+ * )
61
+ * ```
62
+ *
63
+ * ## Learn more
64
+ *
65
+ * - {@apilink BrowseTheWeb}
66
+ * - {@apilink PageElement}
67
+ *
68
+ * @group Activities
58
69
  */
59
70
  class RightClick extends PageElementInteraction_1.PageElementInteraction {
60
71
  /**
61
- * @param {Answerable<PageElement>} target
62
- * The element to be right-clicked on
63
- */
64
- constructor(target) {
65
- super((0, io_1.formatted) `#actor right-clicks on ${target}`);
66
- this.target = target;
67
- }
68
- /**
69
- * @desc
70
- * Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
72
+ * Instantiates this {@apilink Interaction}.
71
73
  *
72
- * @param {Answerable<PageElement>} target
74
+ * @param pageElement
73
75
  * The element to be right-clicked on
74
- *
75
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
76
76
  */
77
- static on(target) {
78
- return new RightClick(target);
77
+ static on(pageElement) {
78
+ return new RightClick(pageElement);
79
+ }
80
+ constructor(pageElement) {
81
+ super((0, core_1.d) `#actor right-clicks on ${pageElement}`);
82
+ this.pageElement = pageElement;
79
83
  }
80
84
  /**
81
- * @desc
82
- * Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
83
- * perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
84
- *
85
- * @param {UsesAbilities & AnswersQuestions} actor
86
- * An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
87
- *
88
- * @returns {PromiseLike<void>}
89
- *
90
- * @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
91
- * @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
92
- * @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
85
+ * @inheritDoc
93
86
  */
94
87
  async performAs(actor) {
95
- const element = await this.resolve(actor, this.target);
88
+ const element = await this.resolve(actor, this.pageElement);
96
89
  return element.rightClick();
97
90
  }
98
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RightClick.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/RightClick.ts"],"names":[],"mappings":";;;AACA,iDAAqD;AAGrD,qEAAkE;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,MAAa,UAAW,SAAQ,+CAAsB;IAclD;;;OAGG;IACH,YAA6B,MAA+B;QACxD,KAAK,CAAC,IAAA,cAAS,EAAC,0BAA2B,MAAO,EAAE,CAAC,CAAC;QAD7B,WAAM,GAAN,MAAM,CAAyB;IAE5D,CAAC;IAnBD;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,CAAC,MAA+B;QACrC,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAUD;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,SAAS,CAAC,KAAuC;QACnD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACvD,OAAO,OAAO,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC;CACJ;AAxCD,gCAwCC"}
1
+ {"version":3,"file":"RightClick.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/RightClick.ts"],"names":[],"mappings":";;;AAAA,4CAAgG;AAGhG,qEAAkE;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,MAAa,UAAW,SAAQ,+CAAsB;IAClD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,WAAoC;QAC1C,OAAO,IAAI,UAA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