@serenity-js/protractor 2.33.1 → 3.0.0-rc.11

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 (343) hide show
  1. package/CHANGELOG.md +481 -0
  2. package/lib/adapter/ProtractorFrameworkAdapter.js +5 -0
  3. package/lib/adapter/ProtractorFrameworkAdapter.js.map +1 -1
  4. package/lib/index.d.ts +0 -2
  5. package/lib/index.js +0 -2
  6. package/lib/index.js.map +1 -1
  7. package/lib/screenplay/abilities/{BrowseTheWeb.d.ts → BrowseTheWebWithProtractor.d.ts} +38 -191
  8. package/lib/screenplay/abilities/{BrowseTheWeb.js → BrowseTheWebWithProtractor.js} +129 -251
  9. package/lib/screenplay/abilities/BrowseTheWebWithProtractor.js.map +1 -0
  10. package/lib/screenplay/abilities/index.d.ts +1 -1
  11. package/lib/screenplay/abilities/index.js +1 -1
  12. package/lib/screenplay/abilities/index.js.map +1 -1
  13. package/lib/screenplay/index.d.ts +1 -0
  14. package/lib/screenplay/index.js +1 -0
  15. package/lib/screenplay/index.js.map +1 -1
  16. package/lib/screenplay/interactions/UseAngular.js +2 -2
  17. package/lib/screenplay/interactions/UseAngular.js.map +1 -1
  18. package/lib/screenplay/interactions/index.d.ts +0 -19
  19. package/lib/screenplay/interactions/index.js +0 -19
  20. package/lib/screenplay/interactions/index.js.map +1 -1
  21. package/lib/screenplay/models/ProtractorCookie.d.ts +11 -0
  22. package/lib/screenplay/models/ProtractorCookie.js +39 -0
  23. package/lib/screenplay/models/ProtractorCookie.js.map +1 -0
  24. package/lib/screenplay/models/ProtractorFrame.d.ts +10 -0
  25. package/lib/screenplay/models/ProtractorFrame.js +39 -0
  26. package/lib/screenplay/models/ProtractorFrame.js.map +1 -0
  27. package/lib/screenplay/models/ProtractorModalDialog.d.ts +11 -0
  28. package/lib/screenplay/models/ProtractorModalDialog.js +43 -0
  29. package/lib/screenplay/models/ProtractorModalDialog.js.map +1 -0
  30. package/lib/screenplay/models/ProtractorPage.d.ts +26 -0
  31. package/lib/screenplay/models/ProtractorPage.js +98 -0
  32. package/lib/screenplay/models/ProtractorPage.js.map +1 -0
  33. package/lib/screenplay/models/ProtractorPageElement.d.ts +21 -0
  34. package/lib/screenplay/models/ProtractorPageElement.js +230 -0
  35. package/lib/screenplay/models/ProtractorPageElement.js.map +1 -0
  36. package/lib/screenplay/models/index.d.ts +5 -0
  37. package/lib/screenplay/{questions/lists → models}/index.js +5 -1
  38. package/lib/screenplay/models/index.js.map +1 -0
  39. package/lib/screenplay/models/locators/ProtractorLocator.d.ts +9 -0
  40. package/lib/screenplay/models/locators/ProtractorLocator.js +28 -0
  41. package/lib/screenplay/models/locators/ProtractorLocator.js.map +1 -0
  42. package/lib/screenplay/models/locators/ProtractorNativeElementRoot.d.ts +5 -0
  43. package/lib/screenplay/{interactions/EnterBuilder.js → models/locators/ProtractorNativeElementRoot.js} +1 -1
  44. package/lib/screenplay/models/locators/ProtractorNativeElementRoot.js.map +1 -0
  45. package/lib/screenplay/models/locators/index.d.ts +2 -0
  46. package/lib/{stage/crew → screenplay/models/locators}/index.js +2 -1
  47. package/lib/screenplay/models/locators/index.js.map +1 -0
  48. package/lib/{promiseOf.d.ts → screenplay/promised.d.ts} +1 -1
  49. package/lib/{promiseOf.js → screenplay/promised.js} +4 -4
  50. package/lib/screenplay/promised.js.map +1 -0
  51. package/lib/screenplay/questions/ProtractorParam.d.ts +24 -29
  52. package/lib/screenplay/questions/ProtractorParam.js +26 -33
  53. package/lib/screenplay/questions/ProtractorParam.js.map +1 -1
  54. package/lib/screenplay/questions/index.d.ts +0 -13
  55. package/lib/screenplay/questions/index.js +0 -16
  56. package/lib/screenplay/questions/index.js.map +1 -1
  57. package/lib/screenplay/unpromisedWebElement.d.ts +11 -0
  58. package/lib/screenplay/unpromisedWebElement.js +24 -0
  59. package/lib/screenplay/unpromisedWebElement.js.map +1 -0
  60. package/package.json +19 -20
  61. package/src/adapter/ProtractorFrameworkAdapter.ts +5 -0
  62. package/src/index.ts +0 -2
  63. package/src/screenplay/abilities/{BrowseTheWeb.ts → BrowseTheWebWithProtractor.ts} +148 -263
  64. package/src/screenplay/abilities/index.ts +1 -1
  65. package/src/screenplay/index.ts +1 -0
  66. package/src/screenplay/interactions/UseAngular.ts +3 -3
  67. package/src/screenplay/interactions/index.ts +0 -19
  68. package/src/screenplay/models/ProtractorCookie.ts +41 -0
  69. package/src/screenplay/models/ProtractorFrame.ts +44 -0
  70. package/src/screenplay/models/ProtractorModalDialog.ts +49 -0
  71. package/src/screenplay/models/ProtractorPage.ts +124 -0
  72. package/src/screenplay/models/ProtractorPageElement.ts +285 -0
  73. package/src/screenplay/models/index.ts +6 -0
  74. package/src/screenplay/models/locators/ProtractorLocator.ts +50 -0
  75. package/src/screenplay/models/locators/ProtractorNativeElementRoot.ts +6 -0
  76. package/src/screenplay/models/locators/index.ts +2 -0
  77. package/src/{promiseOf.ts → screenplay/promised.ts} +1 -1
  78. package/src/screenplay/questions/ProtractorParam.ts +29 -38
  79. package/src/screenplay/questions/index.ts +0 -13
  80. package/src/screenplay/unpromisedWebElement.ts +25 -0
  81. package/lib/expectations/ElementFinderExpectation.d.ts +0 -11
  82. package/lib/expectations/ElementFinderExpectation.js +0 -24
  83. package/lib/expectations/ElementFinderExpectation.js.map +0 -1
  84. package/lib/expectations/index.d.ts +0 -6
  85. package/lib/expectations/index.js +0 -19
  86. package/lib/expectations/index.js.map +0 -1
  87. package/lib/expectations/isActive.d.ts +0 -13
  88. package/lib/expectations/isActive.js +0 -19
  89. package/lib/expectations/isActive.js.map +0 -1
  90. package/lib/expectations/isClickable.d.ts +0 -13
  91. package/lib/expectations/isClickable.js +0 -22
  92. package/lib/expectations/isClickable.js.map +0 -1
  93. package/lib/expectations/isEnabled.d.ts +0 -13
  94. package/lib/expectations/isEnabled.js +0 -19
  95. package/lib/expectations/isEnabled.js.map +0 -1
  96. package/lib/expectations/isPresent.d.ts +0 -14
  97. package/lib/expectations/isPresent.js +0 -20
  98. package/lib/expectations/isPresent.js.map +0 -1
  99. package/lib/expectations/isSelected.d.ts +0 -13
  100. package/lib/expectations/isSelected.js +0 -22
  101. package/lib/expectations/isSelected.js.map +0 -1
  102. package/lib/expectations/isVisible.d.ts +0 -13
  103. package/lib/expectations/isVisible.js +0 -25
  104. package/lib/expectations/isVisible.js.map +0 -1
  105. package/lib/promiseOf.js.map +0 -1
  106. package/lib/screenplay/abilities/BrowseTheWeb.js.map +0 -1
  107. package/lib/screenplay/interactions/Accept.d.ts +0 -81
  108. package/lib/screenplay/interactions/Accept.js +0 -95
  109. package/lib/screenplay/interactions/Accept.js.map +0 -1
  110. package/lib/screenplay/interactions/Clear.d.ts +0 -88
  111. package/lib/screenplay/interactions/Clear.js +0 -121
  112. package/lib/screenplay/interactions/Clear.js.map +0 -1
  113. package/lib/screenplay/interactions/Click.d.ts +0 -81
  114. package/lib/screenplay/interactions/Click.js +0 -95
  115. package/lib/screenplay/interactions/Click.js.map +0 -1
  116. package/lib/screenplay/interactions/Close.d.ts +0 -89
  117. package/lib/screenplay/interactions/Close.js +0 -169
  118. package/lib/screenplay/interactions/Close.js.map +0 -1
  119. package/lib/screenplay/interactions/DeleteCookies.d.ts +0 -72
  120. package/lib/screenplay/interactions/DeleteCookies.js +0 -149
  121. package/lib/screenplay/interactions/DeleteCookies.js.map +0 -1
  122. package/lib/screenplay/interactions/Dismiss.d.ts +0 -85
  123. package/lib/screenplay/interactions/Dismiss.js +0 -99
  124. package/lib/screenplay/interactions/Dismiss.js.map +0 -1
  125. package/lib/screenplay/interactions/DoubleClick.d.ts +0 -99
  126. package/lib/screenplay/interactions/DoubleClick.js +0 -121
  127. package/lib/screenplay/interactions/DoubleClick.js.map +0 -1
  128. package/lib/screenplay/interactions/Enter.d.ts +0 -81
  129. package/lib/screenplay/interactions/Enter.js +0 -96
  130. package/lib/screenplay/interactions/Enter.js.map +0 -1
  131. package/lib/screenplay/interactions/EnterBuilder.d.ts +0 -27
  132. package/lib/screenplay/interactions/EnterBuilder.js.map +0 -1
  133. package/lib/screenplay/interactions/ExecuteScript.d.ts +0 -171
  134. package/lib/screenplay/interactions/ExecuteScript.js +0 -291
  135. package/lib/screenplay/interactions/ExecuteScript.js.map +0 -1
  136. package/lib/screenplay/interactions/Hover.d.ts +0 -86
  137. package/lib/screenplay/interactions/Hover.js +0 -103
  138. package/lib/screenplay/interactions/Hover.js.map +0 -1
  139. package/lib/screenplay/interactions/Navigate.d.ts +0 -149
  140. package/lib/screenplay/interactions/Navigate.js +0 -345
  141. package/lib/screenplay/interactions/Navigate.js.map +0 -1
  142. package/lib/screenplay/interactions/Press.d.ts +0 -90
  143. package/lib/screenplay/interactions/Press.js +0 -127
  144. package/lib/screenplay/interactions/Press.js.map +0 -1
  145. package/lib/screenplay/interactions/PressBuilder.d.ts +0 -27
  146. package/lib/screenplay/interactions/PressBuilder.js +0 -3
  147. package/lib/screenplay/interactions/PressBuilder.js.map +0 -1
  148. package/lib/screenplay/interactions/ResizeBrowserWindow.d.ts +0 -69
  149. package/lib/screenplay/interactions/ResizeBrowserWindow.js +0 -144
  150. package/lib/screenplay/interactions/ResizeBrowserWindow.js.map +0 -1
  151. package/lib/screenplay/interactions/RightClick.d.ts +0 -97
  152. package/lib/screenplay/interactions/RightClick.js +0 -113
  153. package/lib/screenplay/interactions/RightClick.js.map +0 -1
  154. package/lib/screenplay/interactions/Scroll.d.ts +0 -83
  155. package/lib/screenplay/interactions/Scroll.js +0 -98
  156. package/lib/screenplay/interactions/Scroll.js.map +0 -1
  157. package/lib/screenplay/interactions/Select.d.ts +0 -212
  158. package/lib/screenplay/interactions/Select.js +0 -342
  159. package/lib/screenplay/interactions/Select.js.map +0 -1
  160. package/lib/screenplay/interactions/SelectBuilder.d.ts +0 -33
  161. package/lib/screenplay/interactions/SelectBuilder.js +0 -3
  162. package/lib/screenplay/interactions/SelectBuilder.js.map +0 -1
  163. package/lib/screenplay/interactions/Switch.d.ts +0 -210
  164. package/lib/screenplay/interactions/Switch.js +0 -345
  165. package/lib/screenplay/interactions/Switch.js.map +0 -1
  166. package/lib/screenplay/interactions/TakeScreenshot.d.ts +0 -67
  167. package/lib/screenplay/interactions/TakeScreenshot.js +0 -86
  168. package/lib/screenplay/interactions/TakeScreenshot.js.map +0 -1
  169. package/lib/screenplay/interactions/Wait.d.ts +0 -147
  170. package/lib/screenplay/interactions/Wait.js +0 -247
  171. package/lib/screenplay/interactions/Wait.js.map +0 -1
  172. package/lib/screenplay/interactions/WaitBuilder.d.ts +0 -33
  173. package/lib/screenplay/interactions/WaitBuilder.js +0 -3
  174. package/lib/screenplay/interactions/WaitBuilder.js.map +0 -1
  175. package/lib/screenplay/questions/Attribute.d.ts +0 -29
  176. package/lib/screenplay/questions/Attribute.js +0 -56
  177. package/lib/screenplay/questions/Attribute.js.map +0 -1
  178. package/lib/screenplay/questions/Browser.d.ts +0 -47
  179. package/lib/screenplay/questions/Browser.js +0 -55
  180. package/lib/screenplay/questions/Browser.js.map +0 -1
  181. package/lib/screenplay/questions/CSSClasses.d.ts +0 -94
  182. package/lib/screenplay/questions/CSSClasses.js +0 -118
  183. package/lib/screenplay/questions/CSSClasses.js.map +0 -1
  184. package/lib/screenplay/questions/Cookie.d.ts +0 -9
  185. package/lib/screenplay/questions/Cookie.js +0 -65
  186. package/lib/screenplay/questions/Cookie.js.map +0 -1
  187. package/lib/screenplay/questions/LastScriptExecution.d.ts +0 -14
  188. package/lib/screenplay/questions/LastScriptExecution.js +0 -22
  189. package/lib/screenplay/questions/LastScriptExecution.js.map +0 -1
  190. package/lib/screenplay/questions/ModalDialog.d.ts +0 -120
  191. package/lib/screenplay/questions/ModalDialog.js +0 -142
  192. package/lib/screenplay/questions/ModalDialog.js.map +0 -1
  193. package/lib/screenplay/questions/Pick.d.ts +0 -72
  194. package/lib/screenplay/questions/Pick.js +0 -254
  195. package/lib/screenplay/questions/Pick.js.map +0 -1
  196. package/lib/screenplay/questions/Selected.d.ts +0 -185
  197. package/lib/screenplay/questions/Selected.js +0 -254
  198. package/lib/screenplay/questions/Selected.js.map +0 -1
  199. package/lib/screenplay/questions/Value.d.ts +0 -47
  200. package/lib/screenplay/questions/Value.js +0 -67
  201. package/lib/screenplay/questions/Value.js.map +0 -1
  202. package/lib/screenplay/questions/Website.d.ts +0 -15
  203. package/lib/screenplay/questions/Website.js +0 -25
  204. package/lib/screenplay/questions/Website.js.map +0 -1
  205. package/lib/screenplay/questions/Window.d.ts +0 -23
  206. package/lib/screenplay/questions/Window.js +0 -28
  207. package/lib/screenplay/questions/Window.js.map +0 -1
  208. package/lib/screenplay/questions/lists/ElementArrayFinderListAdapter.d.ts +0 -89
  209. package/lib/screenplay/questions/lists/ElementArrayFinderListAdapter.js +0 -138
  210. package/lib/screenplay/questions/lists/ElementArrayFinderListAdapter.js.map +0 -1
  211. package/lib/screenplay/questions/lists/index.d.ts +0 -1
  212. package/lib/screenplay/questions/lists/index.js.map +0 -1
  213. package/lib/screenplay/questions/targets/Target.d.ts +0 -168
  214. package/lib/screenplay/questions/targets/Target.js +0 -190
  215. package/lib/screenplay/questions/targets/Target.js.map +0 -1
  216. package/lib/screenplay/questions/targets/TargetElement.d.ts +0 -50
  217. package/lib/screenplay/questions/targets/TargetElement.js +0 -62
  218. package/lib/screenplay/questions/targets/TargetElement.js.map +0 -1
  219. package/lib/screenplay/questions/targets/TargetElements.d.ts +0 -102
  220. package/lib/screenplay/questions/targets/TargetElements.js +0 -124
  221. package/lib/screenplay/questions/targets/TargetElements.js.map +0 -1
  222. package/lib/screenplay/questions/targets/TargetNestedElement.d.ts +0 -49
  223. package/lib/screenplay/questions/targets/TargetNestedElement.js +0 -61
  224. package/lib/screenplay/questions/targets/TargetNestedElement.js.map +0 -1
  225. package/lib/screenplay/questions/targets/TargetNestedElements.d.ts +0 -101
  226. package/lib/screenplay/questions/targets/TargetNestedElements.js +0 -123
  227. package/lib/screenplay/questions/targets/TargetNestedElements.js.map +0 -1
  228. package/lib/screenplay/questions/targets/builders.d.ts +0 -8
  229. package/lib/screenplay/questions/targets/builders.js +0 -3
  230. package/lib/screenplay/questions/targets/builders.js.map +0 -1
  231. package/lib/screenplay/questions/targets/index.d.ts +0 -5
  232. package/lib/screenplay/questions/targets/index.js +0 -18
  233. package/lib/screenplay/questions/targets/index.js.map +0 -1
  234. package/lib/screenplay/questions/targets/override.d.ts +0 -7
  235. package/lib/screenplay/questions/targets/override.js +0 -21
  236. package/lib/screenplay/questions/targets/override.js.map +0 -1
  237. package/lib/screenplay/questions/text/Text.d.ts +0 -41
  238. package/lib/screenplay/questions/text/Text.js +0 -50
  239. package/lib/screenplay/questions/text/Text.js.map +0 -1
  240. package/lib/screenplay/questions/text/TextOfMultipleElements.d.ts +0 -23
  241. package/lib/screenplay/questions/text/TextOfMultipleElements.js +0 -37
  242. package/lib/screenplay/questions/text/TextOfMultipleElements.js.map +0 -1
  243. package/lib/screenplay/questions/text/TextOfSingleElement.d.ts +0 -23
  244. package/lib/screenplay/questions/text/TextOfSingleElement.js +0 -35
  245. package/lib/screenplay/questions/text/TextOfSingleElement.js.map +0 -1
  246. package/lib/screenplay/questions/text/index.d.ts +0 -1
  247. package/lib/screenplay/questions/text/index.js +0 -14
  248. package/lib/screenplay/questions/text/index.js.map +0 -1
  249. package/lib/screenplay/withAnswerOf.d.ts +0 -8
  250. package/lib/screenplay/withAnswerOf.js +0 -18
  251. package/lib/screenplay/withAnswerOf.js.map +0 -1
  252. package/lib/stage/crew/index.d.ts +0 -1
  253. package/lib/stage/crew/index.js.map +0 -1
  254. package/lib/stage/crew/photographer/Photographer.d.ts +0 -83
  255. package/lib/stage/crew/photographer/Photographer.js +0 -102
  256. package/lib/stage/crew/photographer/Photographer.js.map +0 -1
  257. package/lib/stage/crew/photographer/index.d.ts +0 -2
  258. package/lib/stage/crew/photographer/index.js +0 -15
  259. package/lib/stage/crew/photographer/index.js.map +0 -1
  260. package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.d.ts +0 -28
  261. package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js +0 -65
  262. package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js.map +0 -1
  263. package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.d.ts +0 -18
  264. package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js +0 -30
  265. package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js.map +0 -1
  266. package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.d.ts +0 -17
  267. package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js +0 -28
  268. package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js.map +0 -1
  269. package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.d.ts +0 -19
  270. package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js +0 -28
  271. package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js.map +0 -1
  272. package/lib/stage/crew/photographer/strategies/index.d.ts +0 -4
  273. package/lib/stage/crew/photographer/strategies/index.js +0 -17
  274. package/lib/stage/crew/photographer/strategies/index.js.map +0 -1
  275. package/lib/stage/index.d.ts +0 -1
  276. package/lib/stage/index.js +0 -14
  277. package/lib/stage/index.js.map +0 -1
  278. package/src/expectations/ElementFinderExpectation.ts +0 -29
  279. package/src/expectations/index.ts +0 -6
  280. package/src/expectations/isActive.ts +0 -24
  281. package/src/expectations/isClickable.ts +0 -20
  282. package/src/expectations/isEnabled.ts +0 -18
  283. package/src/expectations/isPresent.ts +0 -19
  284. package/src/expectations/isSelected.ts +0 -23
  285. package/src/expectations/isVisible.ts +0 -27
  286. package/src/screenplay/interactions/Accept.ts +0 -95
  287. package/src/screenplay/interactions/Clear.ts +0 -130
  288. package/src/screenplay/interactions/Click.ts +0 -96
  289. package/src/screenplay/interactions/Close.ts +0 -184
  290. package/src/screenplay/interactions/DeleteCookies.ts +0 -154
  291. package/src/screenplay/interactions/Dismiss.ts +0 -99
  292. package/src/screenplay/interactions/DoubleClick.ts +0 -124
  293. package/src/screenplay/interactions/Enter.ts +0 -104
  294. package/src/screenplay/interactions/EnterBuilder.ts +0 -29
  295. package/src/screenplay/interactions/ExecuteScript.ts +0 -325
  296. package/src/screenplay/interactions/Hover.ts +0 -106
  297. package/src/screenplay/interactions/Navigate.ts +0 -363
  298. package/src/screenplay/interactions/Press.ts +0 -137
  299. package/src/screenplay/interactions/PressBuilder.ts +0 -29
  300. package/src/screenplay/interactions/ResizeBrowserWindow.ts +0 -148
  301. package/src/screenplay/interactions/RightClick.ts +0 -114
  302. package/src/screenplay/interactions/Scroll.ts +0 -99
  303. package/src/screenplay/interactions/Select.ts +0 -402
  304. package/src/screenplay/interactions/SelectBuilder.ts +0 -35
  305. package/src/screenplay/interactions/Switch.ts +0 -393
  306. package/src/screenplay/interactions/TakeScreenshot.ts +0 -89
  307. package/src/screenplay/interactions/Wait.ts +0 -267
  308. package/src/screenplay/interactions/WaitBuilder.ts +0 -35
  309. package/src/screenplay/questions/Attribute.ts +0 -67
  310. package/src/screenplay/questions/Browser.ts +0 -55
  311. package/src/screenplay/questions/CSSClasses.ts +0 -121
  312. package/src/screenplay/questions/Cookie.ts +0 -70
  313. package/src/screenplay/questions/LastScriptExecution.ts +0 -21
  314. package/src/screenplay/questions/ModalDialog.ts +0 -149
  315. package/src/screenplay/questions/Pick.ts +0 -334
  316. package/src/screenplay/questions/Selected.ts +0 -268
  317. package/src/screenplay/questions/Value.ts +0 -73
  318. package/src/screenplay/questions/Website.ts +0 -27
  319. package/src/screenplay/questions/Window.ts +0 -29
  320. package/src/screenplay/questions/lists/ElementArrayFinderListAdapter.ts +0 -158
  321. package/src/screenplay/questions/lists/index.ts +0 -1
  322. package/src/screenplay/questions/targets/Target.ts +0 -198
  323. package/src/screenplay/questions/targets/TargetElement.ts +0 -70
  324. package/src/screenplay/questions/targets/TargetElements.ts +0 -142
  325. package/src/screenplay/questions/targets/TargetNestedElement.ts +0 -71
  326. package/src/screenplay/questions/targets/TargetNestedElements.ts +0 -142
  327. package/src/screenplay/questions/targets/builders.ts +0 -10
  328. package/src/screenplay/questions/targets/index.ts +0 -5
  329. package/src/screenplay/questions/targets/override.ts +0 -17
  330. package/src/screenplay/questions/text/Text.ts +0 -55
  331. package/src/screenplay/questions/text/TextOfMultipleElements.ts +0 -40
  332. package/src/screenplay/questions/text/TextOfSingleElement.ts +0 -37
  333. package/src/screenplay/questions/text/index.ts +0 -1
  334. package/src/screenplay/withAnswerOf.ts +0 -19
  335. package/src/stage/crew/index.ts +0 -1
  336. package/src/stage/crew/photographer/Photographer.ts +0 -108
  337. package/src/stage/crew/photographer/index.ts +0 -2
  338. package/src/stage/crew/photographer/strategies/PhotoTakingStrategy.ts +0 -102
  339. package/src/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.ts +0 -28
  340. package/src/stage/crew/photographer/strategies/TakePhotosOfFailures.ts +0 -26
  341. package/src/stage/crew/photographer/strategies/TakePhotosOfInteractions.ts +0 -26
  342. package/src/stage/crew/photographer/strategies/index.ts +0 -4
  343. package/src/stage/index.ts +0 -1
@@ -1,267 +0,0 @@
1
- import { Answerable, AnswersQuestions, AssertionError, Duration, Expectation, ExpectationMet, ExpectationOutcome, Interaction, UsesAbilities } from '@serenity-js/core';
2
- import { formatted } from '@serenity-js/core/lib/io';
3
-
4
- import { BrowseTheWeb } from '../abilities';
5
- import { WaitBuilder } from './WaitBuilder';
6
-
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
- * Useful when a test scenario can't take advantage of automatic synchronisation between
14
- * Protractor and Angular (see {@link UseAngular}), or when the application under test is animation-heavy.
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 { Target } from '@serenity-js/protractor';
31
- * import { by } from 'protractor';
32
- *
33
- * class App {
34
- * static status = Target.the('status widget')
35
- * .located(by.id('status'));
36
- * }
37
- *
38
- * @example <caption>Waiting for a set amount of time</caption>
39
- * import { actorCalled, Duration } from '@serenity-js/core';
40
- * import { BrowseTheWeb, Wait } from '@serenity-js/protractor';
41
- * import { Ensure, equals } from '@serenity-js/assertions';
42
- * import { protractor } from 'protractor';
43
- *
44
- * actorCalled('Aurora')
45
- * .whoCan(BrowseTheWeb.using(protractor.browser))
46
- * .attemptsTo(
47
- * Wait.for(Duration.ofSeconds(1.5)),
48
- * Ensure.that(App.status, equals('Ready!')),
49
- * );
50
- *
51
- * // Please note that while the above implementation works,
52
- * // this approach is inefficient because at best
53
- * // the actor might wait too long and at worst the test
54
- * // might become "flaky" if any external interference
55
- * // (like network glitches, animations taking a bit too long etc.)
56
- * // makes the actor wait not long enough.
57
- *
58
- * @example <caption>Waiting until a condition is met</caption>
59
- * import { actorCalled } from '@serenity-js/core';
60
- * import { BrowseTheWeb, Wait, Text } from '@serenity-js/protractor';
61
- * import { equals } from '@serenity-js/assertions';
62
- * import { protractor } from 'protractor';
63
- *
64
- * actorCalled('Aurora')
65
- * .whoCan(BrowseTheWeb.using(protractor.browser))
66
- * .attemptsTo(
67
- * Wait.until(Text.of(App.status), equals('Ready!')),
68
- * // app is ready, proceed with the scenario
69
- * );
70
- *
71
- * // Wait.until makes the Actor keep asking a Question,
72
- * // in this case Text.of(App.status), until the answer meets
73
- * // the expectation, or a timeout expires (default: 5s).
74
- * //
75
- * // Please note that both Ensure and Wait can be used with
76
- * // the same expectations, like `equals`.
77
- *
78
- * @example <caption>Changing the default timeout</caption>
79
- * import { actorCalled, Duration } from '@serenity-js/core';
80
- * import { BrowseTheWeb, Wait, Text } from '@serenity-js/protractor';
81
- * import { equals } from '@serenity-js/assertions';
82
- * import { protractor } from 'protractor';
83
- *
84
- * actorCalled('Aurora')
85
- * .whoCan(BrowseTheWeb.using(protractor.browser))
86
- * .attemptsTo(
87
- * Wait.upTo(Duration.ofSeconds(3))
88
- * .until(Text.of(App.status), equals('Ready!')),
89
- * // app is ready, proceed with the scenario
90
- * );
91
- *
92
- * @see {@link BrowseTheWeb}
93
- * @see {@link Target}
94
- * @see {@link Text}
95
- * @see {@link @serenity-js/assertions~Ensure}
96
- * @see {@link @serenity-js/assertions/lib/expectations~equals}
97
- * @see {@link @serenity-js/core/lib/model~Duration}
98
- *
99
- * @extends {@serenity-js/core/lib/screenplay~Interaction}
100
- */
101
- export class Wait {
102
-
103
- /**
104
- * @desc
105
- * Default timeout of 5 seconds used with {@link Wait.until}.
106
- *
107
- * @type {@serenity-js/core~Duration}
108
- */
109
- static readonly Default_Timeout = Duration.ofSeconds(5);
110
-
111
- /**
112
- * @desc
113
- * Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
114
- * configured to wait for a set duration.
115
- *
116
- * @param {Answerable<Duration>} duration
117
- * A set duration the {@link @serenity-js/core/lib/screenplay/actor~Actor} should wait for
118
- * before proceeding
119
- *
120
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
121
- */
122
- static for(duration: Answerable<Duration>): Interaction {
123
- return new WaitFor(duration);
124
- }
125
-
126
- /**
127
- * @desc
128
- * Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
129
- * configured to wait until the answer to the question (`actual`) meets the `expectation`,
130
- * or a custom timeout expires.
131
- *
132
- * @param {Duration} duration
133
- * Custom timeout to override {@link Wait.Default_Timeout}
134
- *
135
- * @returns {WaitBuilder}
136
- */
137
- static upTo(duration: Duration): WaitBuilder {
138
- return {
139
- until: <Actual>(actual: Answerable<Actual>, expectation: Expectation<any, Actual>): Interaction =>
140
- new WaitUntil(actual, expectation, duration),
141
- };
142
- }
143
-
144
- /**
145
- * @desc
146
- * Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
147
- * configured to wait until the answer to the question (`actual`) meets the `expectation`,
148
- * or a {@link Wait.Default_Timeout} expires.
149
- *
150
- * @param {Answerable<Actual>} actual
151
- * A {@link @serenity-js/core/lib/screenplay~Question}
152
- * that the {@link @serenity-js/core/lib/screenplay/actor~Actor}
153
- * will keep asking until the answer meets
154
- * the {@link @serenity-js/core/lib/screenplay/questions~Expectation} provided
155
- *
156
- * @param {@serenity-js/core/lib/screenplay/questions~<any,Actual>} expectation
157
- * An {@link @serenity-js/core/lib/screenplay/questions~Expectation} to be met before proceeding
158
- *
159
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
160
- */
161
- static until<Actual>(actual: Answerable<Actual>, expectation: Expectation<any, Actual>): Interaction {
162
- return new WaitUntil(actual, expectation, Wait.Default_Timeout);
163
- }
164
- }
165
-
166
- /**
167
- * @package
168
- */
169
- class WaitFor extends Interaction {
170
- constructor(private readonly duration: Answerable<Duration>) {
171
- super();
172
- }
173
-
174
- /**
175
- * @desc
176
- * Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
177
- * perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
178
- *
179
- * @param {UsesAbilities & AnswersQuestions} actor
180
- * @returns {Promise<void>}
181
- *
182
- * @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
183
- * @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
184
- * @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
185
- */
186
- performAs(actor: UsesAbilities & AnswersQuestions): PromiseLike<void> {
187
- return actor.answer(this.duration)
188
- .then(duration => BrowseTheWeb.as(actor).sleep(duration.inMilliseconds()));
189
- }
190
-
191
- /**
192
- * @desc
193
- * Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
194
- *
195
- * @returns {string}
196
- */
197
- toString(): string {
198
- return formatted`#actor waits for ${ this.duration }`;
199
- }
200
- }
201
-
202
- /**
203
- * @package
204
- */
205
- class WaitUntil<Actual> extends Interaction {
206
- constructor(
207
- private readonly actual: Answerable<Actual>,
208
- private readonly expectation: Expectation<any, Actual>,
209
- private readonly timeout: Duration,
210
- ) {
211
- super();
212
- }
213
-
214
- /**
215
- * @desc
216
- * Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
217
- * perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
218
- *
219
- * @param {UsesAbilities & AnswersQuestions} actor
220
- * @returns {Promise<void>}
221
- *
222
- * @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
223
- * @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
224
- * @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
225
- */
226
- performAs(actor: UsesAbilities & AnswersQuestions): PromiseLike<void> {
227
- const
228
- actual = this.actual,
229
- expectation = this.expectation.answeredBy(actor);
230
-
231
- let expectationOutcome: ExpectationOutcome<any, Actual>;
232
-
233
- return BrowseTheWeb.as(actor)
234
- .wait(function () {
235
- return actor.answer(actual)
236
- .then(act => expectation(act))
237
- .then(outcome => {
238
- expectationOutcome = outcome;
239
-
240
- return outcome instanceof ExpectationMet;
241
- });
242
- }, this.timeout.inMilliseconds())
243
- .then(_ => void 0)
244
- .catch(error => {
245
- if (expectationOutcome) {
246
- throw new AssertionError(
247
- `Waited ${ this.timeout.toString() } for ${ formatted `${ this.actual }` } to ${ this.expectation.toString() }`,
248
- expectationOutcome.expected,
249
- expectationOutcome.actual,
250
- error,
251
- );
252
- }
253
-
254
- throw error;
255
- });
256
- }
257
-
258
- /**
259
- * @desc
260
- * Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
261
- *
262
- * @returns {string}
263
- */
264
- toString(): string {
265
- return formatted`#actor waits up to ${ this.timeout } until ${ this.actual } does ${ this.expectation }`;
266
- }
267
- }
@@ -1,35 +0,0 @@
1
- import { Answerable, Expectation } from '@serenity-js/core';
2
- import { Interaction } from '@serenity-js/core/lib/screenplay';
3
-
4
- /**
5
- * @desc
6
- * Fluent interface to make the instantiation of
7
- * the {@link @serenity-js/core/lib/screenplay~Interaction}
8
- * to {@link Wait} more readable.
9
- *
10
- * @see {@link Wait}
11
- *
12
- * @interface
13
- */
14
- export interface WaitBuilder {
15
-
16
- /**
17
- * @desc
18
- * Instantiates an {@link @serenity-js/core/lib/screenplay~Interaction}
19
- * to {@link Wait}.
20
- *
21
- * @param {Answerable<Actual>} actual
22
- * A {@link @serenity-js/core/lib/screenplay~Question}
23
- * that the {@link @serenity-js/core/lib/screenplay/actor~Actor}
24
- * will keep asking until the answer meets
25
- * the {@link @serenity-js/core/lib/screenplay/questions~Expectation} provided
26
- *
27
- * @param {@serenity-js/core/lib/screenplay/questions~Expectation<any,Actual>} expectation
28
- * An {@link @serenity-js/assertions~Expectation} to be met before proceeding
29
- *
30
- * @returns {Interaction}
31
- *
32
- * @see {@link Target}
33
- */
34
- until: <Actual>(actual: Answerable<Actual>, expectation: Expectation<any, Actual>) => Interaction;
35
- }
@@ -1,67 +0,0 @@
1
- import { Answerable, AnswersQuestions, Question, UsesAbilities } from '@serenity-js/core';
2
- import { formatted } from '@serenity-js/core/lib/io';
3
- import { ElementFinder } from 'protractor';
4
-
5
- import { BrowseTheWeb } from '../abilities';
6
- import { withAnswerOf } from '../withAnswerOf';
7
-
8
- // todo: it might be better to swap the order of arguments
9
- // - Attribute.called('href').of(link) to make it work with ArrayListFilter
10
-
11
- export class Attribute extends Question<Promise<string>> {
12
- /**
13
- * @param {Question<ElementFinder> | ElementFinder} target
14
- * @returns {AttributeBuilder}
15
- */
16
- static of(target: Question<ElementFinder> | ElementFinder): AttributeBuilder {
17
- return {
18
- called: (name: Answerable<string>) => new Attribute(target, name),
19
- };
20
- }
21
-
22
- constructor(
23
- private readonly target: Question<ElementFinder> | ElementFinder,
24
- private readonly name: Answerable<string>,
25
- ) {
26
- super(formatted `the value of the ${ name } attribute of ${ target}`);
27
- }
28
-
29
- /**
30
- * @desc
31
- * Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
32
- * answer this {@link @serenity-js/core/lib/screenplay~Question}.
33
- *
34
- * @param {AnswersQuestions & UsesAbilities} actor
35
- * @returns {Promise<void>}
36
- *
37
- * @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
38
- * @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
39
- * @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
40
- */
41
- answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<string> {
42
- return actor.answer(this.name)
43
- .then(name => withAnswerOf(actor, this.target, (elf: ElementFinder) =>
44
- elf.getAttribute(name).then(value => {
45
- return value !== null // workaround for bug in Chromium 91 - https://bugs.chromium.org/p/chromium/issues/detail?id=1205107&start=300
46
- ? value
47
- : BrowseTheWeb.as(actor).executeFunction(
48
- /* istanbul ignore next */
49
- function getAttribute(webElement, attributeName: string) {
50
- // eslint-disable-next-line no-var
51
- var value = (webElement[attributeName] || webElement.getAttribute(attributeName));
52
- if (value !== null && value !== undefined) {
53
- return '' + value;
54
- }
55
- return value;
56
- },
57
- elf.getWebElement(),
58
- name
59
- );
60
- })
61
- ));
62
- }
63
- }
64
-
65
- interface AttributeBuilder {
66
- called(name: Answerable<string>): Attribute;
67
- }
@@ -1,55 +0,0 @@
1
- import { Question } from '@serenity-js/core';
2
- import { logging } from 'selenium-webdriver';
3
-
4
- import { promiseOf } from '../../promiseOf';
5
- import { BrowseTheWeb } from '../abilities';
6
-
7
- export class Browser {
8
-
9
- /**
10
- * @desc
11
- * Creates a {@link Question} that reads the entries of the browser log
12
- * so that they can be asserted on.
13
- *
14
- * Please note that in order to ensure that the automated test has access to the browser log,
15
- * Protractor needs to be configured with the desired logging level, as per the example below.
16
- *
17
- * @example <caption>Enabling Protractor browser logging</caption>
18
- * // protractor.conf.js
19
- * exports.config = {
20
- * capabilities: {
21
- * loggingPrefs: {
22
- * // available options: OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL
23
- * browser: 'SEVERE'
24
- * },
25
- * }
26
- * }
27
- *
28
- * @example <caption>Ensure the app didn't log anything to the console during the test</caption>
29
- * import { Actor, BrowseTheWeb, Browser } from '@serenity-js/core';
30
- * import { Ensure, property, equals } from '@serenity-js/assertions';
31
- *
32
- * actor.attemptsTo(
33
- * Ensure.that(Browser.log(), property('length', equals(0))),
34
- * );
35
- *
36
- * @example <caption>Mark the test as "compromised" if the server responds with a 500 to any AJAX request during the test</caption>
37
- * import { Actor, BrowseTheWeb, Browser, TestCompromisedError } from '@serenity-js/core';
38
- * import { Ensure, property, equals, not, contrainAtLeastOneItemThat } from '@serenity-js/assertions'
39
- *
40
- * actor.attemptsTo(
41
- * Ensure.that(Browser.log(),
42
- * not(contrainAtLeastOneItemThat(
43
- * property('message', includes('the server responded with a status of 500'))
44
- * ))
45
- * ).otherwiseFailWith(TestCompromisedError, 'The server is down'),
46
- * );
47
- *
48
- * @see https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities#loggingpreferences-json-object
49
- * @returns {Question<Promise<logging.Entry[]>>}
50
- */
51
- static log(): Question<Promise<logging.Entry[]>> {
52
- return Question.about<Promise<logging.Entry[]>>(`browser log`, actor =>
53
- promiseOf(BrowseTheWeb.as(actor).manage().logs().get('browser')));
54
- }
55
- }
@@ -1,121 +0,0 @@
1
- import { AnswersQuestions, MetaQuestion, Question, UsesAbilities } from '@serenity-js/core';
2
- import { formatted } from '@serenity-js/core/lib/io';
3
- import { ElementFinder } from 'protractor';
4
-
5
- import { Attribute } from './Attribute';
6
- import { TargetNestedElement } from './targets';
7
-
8
- /**
9
- * @desc
10
- * Resolves to an array of [CSS classes](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#attr-class)
11
- * of a given {@link WebElement}, represented by {@link ElementFinder} or `Question<ElementFinder>`.
12
- *
13
- * @example <caption>Example widget</caption>
14
- * <ul id="shopping-list" class="active favourite">
15
- * <li class="bought">Coffee<li>
16
- * <li class="buy">Honey<li>
17
- * <li class="buy">Chocolate<li>
18
- * </ul>
19
- *
20
- * @example <caption>Retrieve CSS classes of a given WebElement</caption>
21
- * import { actorCalled } from '@serenity-js/core';
22
- * import { Ensure, equals } from '@serenity-js/assertions';
23
- * import { BrowseTheWeb, CSSClasses, Target } from '@serenity-js/protractor';
24
- * import { by } from 'protractor';
25
- *
26
- * const shoppingList = () =>
27
- * Target.the('shopping list').located(by.id('shopping-list'))
28
- *
29
- * actorCalled('Lisa')
30
- * .whoCan(BrowseTheWeb.using(protractor.browser))
31
- * .attemptsTo(
32
- * Ensure.that(CSSClasses.of(shoppingList()), equals([ 'active', 'favourite' ])),
33
- * )
34
- *
35
- * @example <caption>Find WebElements with a given class</caption>
36
- * import { actorCalled } from '@serenity-js/core';
37
- * import { Ensure, equals } from '@serenity-js/assertions';
38
- * import { BrowseTheWeb, CSSClasses, Target } from '@serenity-js/protractor';
39
- * import { by } from 'protractor';
40
- *
41
- * class ShoppingList {
42
- * static items = () =>
43
- * Target.all('items')
44
- * .located(by.css('#shopping-list li'))
45
- *
46
- * static outstandingItems = () =>
47
- * ShoppingList.items
48
- * .where(CSSClasses, contain('buy'))
49
- * }
50
- *
51
- * actorCalled('Lisa')
52
- * .whoCan(BrowseTheWeb.using(protractor.browser))
53
- * .attemptsTo(
54
- * Ensure.that(
55
- * Text.ofAll(ShoppingList.outstandingItems()),
56
- * equals([ 'Honey', 'Chocolate' ])
57
- * ),
58
- * )
59
- *
60
- * @extends {@serenity-js/core/lib/screenplay~Question}
61
- * @implements {@serenity-js/core/lib/screenplay/questions~MetaQuestion}
62
- */
63
- export class CSSClasses
64
- extends Question<Promise<string[]>>
65
- implements MetaQuestion<Question<ElementFinder> | ElementFinder, Promise<string[]>>
66
- {
67
- /**
68
- * @param {Question<ElementFinder> | ElementFinder} target
69
- * @returns {CSSClasses}
70
- */
71
- static of(target: Question<ElementFinder> | ElementFinder): CSSClasses {
72
- return new CSSClasses(target);
73
- }
74
-
75
- /**
76
- * @param {Question<ElementFinder> | ElementFinder} target
77
- */
78
- constructor(private readonly target: Question<ElementFinder> | ElementFinder) {
79
- super(formatted `CSS classes of ${ target}`);
80
- }
81
-
82
- /**
83
- * @desc
84
- * Resolves to an array of CSS classes of the `target` element,
85
- * located in the context of a `parent` element.
86
- *
87
- * @param {Question<ElementFinder> | ElementFinder} parent
88
- * @returns {Question<Promise<string[]>>}
89
- *
90
- * @see {@link Target.all}
91
- * @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
92
- */
93
- of(parent: Question<ElementFinder> | ElementFinder): Question<Promise<string[]>> {
94
- return new CSSClasses(new TargetNestedElement(parent, this.target));
95
- }
96
-
97
- /**
98
- * @desc
99
- * Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
100
- * answer this {@link @serenity-js/core/lib/screenplay~Question}.
101
- *
102
- * @param {AnswersQuestions & UsesAbilities} actor
103
- * @returns {Promise<void>}
104
- *
105
- * @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
106
- * @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
107
- * @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
108
- */
109
- answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<string[]> {
110
- return Attribute.of(this.target).called('class').answeredBy(actor)
111
- .then(value => {
112
- return typeof value !== 'string'
113
- ? []
114
- : value
115
- .replace(/\s+/, ' ')
116
- .trim()
117
- .split(' ')
118
- .filter(cssClass => !!cssClass);
119
- });
120
- }
121
- }
@@ -1,70 +0,0 @@
1
- /* eslint-disable unicorn/consistent-function-scoping */
2
- import { Answerable, AnswersQuestions, Question, Transform, UsesAbilities } from '@serenity-js/core';
3
- import { IWebDriverOptionsCookie } from 'selenium-webdriver';
4
-
5
- import { BrowseTheWeb } from '../abilities';
6
-
7
- export class Cookie {
8
- static valueOf(cookieName: Answerable<string>): Question<Promise<string>> {
9
- return Transform.the(new CookieDetails(cookieName), details => details && details.value)
10
- .as(`the value of the "${ cookieName }" cookie`);
11
- }
12
-
13
- static pathOf(cookieName: Answerable<string>): Question<Promise<string>> {
14
- return Transform.the(new CookieDetails(cookieName), details => details && details.path)
15
- .as(`the path of the "${ cookieName }" cookie`);
16
- }
17
-
18
- static domainOf(cookieName: string): Question<Promise<string>> {
19
- return new CookieDetails(cookieName)
20
- .map(actor => details => details?.domain)
21
- .describedAs(`the domain of the "${ cookieName }" cookie`);
22
- }
23
-
24
- static isHTTPOnly(cookieName: string): Question<Promise<boolean>> {
25
- return new CookieDetails(cookieName)
26
- .map(actor => details => details && !! details.httpOnly)
27
- .describedAs(`the HTTP-only status of the "${ cookieName }" cookie`);
28
- }
29
-
30
- static isSecure(cookieName: string): Question<Promise<boolean>> {
31
- return new CookieDetails(cookieName)
32
- .map(actor => details => details && !! details.secure)
33
- .describedAs(`the "secure" status of the "${ cookieName }" cookie`);
34
- }
35
-
36
- static expiryDateOf(cookieName: string): Question<Promise<Date>> {
37
- return new CookieDetails(cookieName)
38
- .map(actor => details =>
39
- details?.expiry && new Date(Number(details.expiry) * 1000) // expiry date coming from webdriver is expressed in seconds
40
- )
41
- .describedAs(`the expiry date of the "${ cookieName }" cookie`);
42
- }
43
- }
44
-
45
- /**
46
- * @package
47
- */
48
- class CookieDetails extends Question<Promise<IWebDriverOptionsCookie>> {
49
- constructor(private readonly name: Answerable<string>) {
50
- super(`the details of the "${ name } cookie`);
51
- }
52
-
53
- /**
54
- * @desc
55
- * Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
56
- * answer this {@link @serenity-js/core/lib/screenplay~Question}.
57
- *
58
- * @param {AnswersQuestions & UsesAbilities} actor
59
- * @returns {Promise<void>}
60
- *
61
- * @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
62
- * @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
63
- * @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
64
- */
65
- answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<IWebDriverOptionsCookie> {
66
- return actor.answer(this.name)
67
- .then(name => BrowseTheWeb.as(actor).manage().getCookie(name))
68
- .then(details => details ? details : undefined);
69
- }
70
- }
@@ -1,21 +0,0 @@
1
- import { Question } from '@serenity-js/core';
2
-
3
- import { BrowseTheWeb } from '../abilities';
4
-
5
- /**
6
- * @desc
7
- * Returns the result of last script executed via {@link ExecuteScript}
8
- */
9
- export class LastScriptExecution {
10
-
11
- /**
12
- * @desc
13
- * Enables asserting on the result of a function executed via {@link ExecuteScript}.
14
- *
15
- * @returns {Question<R>}
16
- */
17
- static result<R>(): Question<R> {
18
- return Question.about(`last script execution result`, actor =>
19
- BrowseTheWeb.as(actor).getLastScriptExecutionResult());
20
- }
21
- }