@serenity-js/webdriverio 2.32.3 → 3.0.0-rc.1

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 (240) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/lib/adapter/WebdriverIOFrameworkAdapter.js +1 -1
  3. package/lib/adapter/WebdriverIOFrameworkAdapter.js.map +1 -1
  4. package/lib/adapter/WebdriverIONotifier.d.ts +35 -1
  5. package/lib/adapter/WebdriverIONotifier.js +174 -13
  6. package/lib/adapter/WebdriverIONotifier.js.map +1 -1
  7. package/lib/index.d.ts +0 -3
  8. package/lib/index.js +0 -3
  9. package/lib/index.js.map +1 -1
  10. package/lib/screenplay/abilities/{BrowseTheWeb.d.ts → BrowseTheWebWithWebdriverIO.d.ts} +79 -23
  11. package/lib/screenplay/abilities/{BrowseTheWeb.js → BrowseTheWebWithWebdriverIO.js} +160 -25
  12. package/lib/screenplay/abilities/BrowseTheWebWithWebdriverIO.js.map +1 -0
  13. package/lib/screenplay/abilities/index.d.ts +1 -1
  14. package/lib/screenplay/abilities/index.js +1 -1
  15. package/lib/screenplay/abilities/index.js.map +1 -1
  16. package/lib/screenplay/index.d.ts +1 -2
  17. package/lib/screenplay/index.js +1 -2
  18. package/lib/screenplay/index.js.map +1 -1
  19. package/lib/screenplay/models/WebdriverIOCookie.d.ts +8 -0
  20. package/lib/screenplay/models/WebdriverIOCookie.js +39 -0
  21. package/lib/screenplay/models/WebdriverIOCookie.js.map +1 -0
  22. package/lib/screenplay/models/WebdriverIOModalDialog.d.ts +11 -0
  23. package/lib/screenplay/models/WebdriverIOModalDialog.js +40 -0
  24. package/lib/screenplay/models/WebdriverIOModalDialog.js.map +1 -0
  25. package/lib/screenplay/models/WebdriverIONativeElementRoot.d.ts +2 -0
  26. package/lib/screenplay/{interactions/EnterBuilder.js → models/WebdriverIONativeElementRoot.js} +1 -1
  27. package/lib/screenplay/models/WebdriverIONativeElementRoot.js.map +1 -0
  28. package/lib/screenplay/models/WebdriverIOPage.d.ts +24 -0
  29. package/lib/screenplay/models/WebdriverIOPage.js +98 -0
  30. package/lib/screenplay/models/WebdriverIOPage.js.map +1 -0
  31. package/lib/screenplay/models/WebdriverIOPageElement.d.ts +22 -0
  32. package/lib/screenplay/models/WebdriverIOPageElement.js +75 -0
  33. package/lib/screenplay/models/WebdriverIOPageElement.js.map +1 -0
  34. package/lib/screenplay/models/WebdriverIOPageElements.d.ts +15 -0
  35. package/lib/screenplay/models/WebdriverIOPageElements.js +65 -0
  36. package/lib/screenplay/models/WebdriverIOPageElements.js.map +1 -0
  37. package/lib/screenplay/models/index.d.ts +6 -0
  38. package/lib/{input → screenplay/models}/index.js +6 -1
  39. package/lib/screenplay/models/index.js.map +1 -0
  40. package/package.json +21 -31
  41. package/src/adapter/WebdriverIOFrameworkAdapter.ts +2 -0
  42. package/src/adapter/WebdriverIONotifier.ts +225 -23
  43. package/src/index.ts +0 -3
  44. package/src/screenplay/abilities/{BrowseTheWeb.ts → BrowseTheWebWithWebdriverIO.ts} +200 -31
  45. package/src/screenplay/abilities/index.ts +1 -1
  46. package/src/screenplay/index.ts +1 -2
  47. package/src/screenplay/models/WebdriverIOCookie.ts +44 -0
  48. package/src/screenplay/models/WebdriverIOModalDialog.ts +45 -0
  49. package/src/screenplay/models/WebdriverIONativeElementRoot.ts +3 -0
  50. package/src/screenplay/models/WebdriverIOPage.ts +120 -0
  51. package/src/screenplay/models/WebdriverIOPageElement.ts +92 -0
  52. package/src/screenplay/models/WebdriverIOPageElements.ts +91 -0
  53. package/src/screenplay/models/index.ts +6 -0
  54. package/lib/expectations/ElementExpectation.d.ts +0 -11
  55. package/lib/expectations/ElementExpectation.js +0 -27
  56. package/lib/expectations/ElementExpectation.js.map +0 -1
  57. package/lib/expectations/index.d.ts +0 -6
  58. package/lib/expectations/index.js +0 -19
  59. package/lib/expectations/index.js.map +0 -1
  60. package/lib/expectations/isActive.d.ts +0 -15
  61. package/lib/expectations/isActive.js +0 -21
  62. package/lib/expectations/isActive.js.map +0 -1
  63. package/lib/expectations/isClickable.d.ts +0 -20
  64. package/lib/expectations/isClickable.js +0 -26
  65. package/lib/expectations/isClickable.js.map +0 -1
  66. package/lib/expectations/isEnabled.d.ts +0 -14
  67. package/lib/expectations/isEnabled.js +0 -20
  68. package/lib/expectations/isEnabled.js.map +0 -1
  69. package/lib/expectations/isPresent.d.ts +0 -15
  70. package/lib/expectations/isPresent.js +0 -21
  71. package/lib/expectations/isPresent.js.map +0 -1
  72. package/lib/expectations/isSelected.d.ts +0 -14
  73. package/lib/expectations/isSelected.js +0 -20
  74. package/lib/expectations/isSelected.js.map +0 -1
  75. package/lib/expectations/isVisible.d.ts +0 -14
  76. package/lib/expectations/isVisible.js +0 -20
  77. package/lib/expectations/isVisible.js.map +0 -1
  78. package/lib/input/Key.d.ts +0 -73
  79. package/lib/input/Key.js +0 -84
  80. package/lib/input/Key.js.map +0 -1
  81. package/lib/input/index.d.ts +0 -1
  82. package/lib/input/index.js.map +0 -1
  83. package/lib/screenplay/abilities/BrowseTheWeb.js.map +0 -1
  84. package/lib/screenplay/interactions/Clear.d.ts +0 -79
  85. package/lib/screenplay/interactions/Clear.js +0 -97
  86. package/lib/screenplay/interactions/Clear.js.map +0 -1
  87. package/lib/screenplay/interactions/Click.d.ts +0 -73
  88. package/lib/screenplay/interactions/Click.js +0 -84
  89. package/lib/screenplay/interactions/Click.js.map +0 -1
  90. package/lib/screenplay/interactions/DoubleClick.d.ts +0 -90
  91. package/lib/screenplay/interactions/DoubleClick.js +0 -101
  92. package/lib/screenplay/interactions/DoubleClick.js.map +0 -1
  93. package/lib/screenplay/interactions/Enter.d.ts +0 -73
  94. package/lib/screenplay/interactions/Enter.js +0 -87
  95. package/lib/screenplay/interactions/Enter.js.map +0 -1
  96. package/lib/screenplay/interactions/EnterBuilder.d.ts +0 -25
  97. package/lib/screenplay/interactions/EnterBuilder.js.map +0 -1
  98. package/lib/screenplay/interactions/ExecuteScript.d.ts +0 -206
  99. package/lib/screenplay/interactions/ExecuteScript.js +0 -311
  100. package/lib/screenplay/interactions/ExecuteScript.js.map +0 -1
  101. package/lib/screenplay/interactions/Hover.d.ts +0 -78
  102. package/lib/screenplay/interactions/Hover.js +0 -89
  103. package/lib/screenplay/interactions/Hover.js.map +0 -1
  104. package/lib/screenplay/interactions/Navigate.d.ts +0 -141
  105. package/lib/screenplay/interactions/Navigate.js +0 -197
  106. package/lib/screenplay/interactions/Navigate.js.map +0 -1
  107. package/lib/screenplay/interactions/Press.d.ts +0 -84
  108. package/lib/screenplay/interactions/Press.js +0 -152
  109. package/lib/screenplay/interactions/Press.js.map +0 -1
  110. package/lib/screenplay/interactions/PressBuilder.d.ts +0 -26
  111. package/lib/screenplay/interactions/PressBuilder.js +0 -3
  112. package/lib/screenplay/interactions/PressBuilder.js.map +0 -1
  113. package/lib/screenplay/interactions/RightClick.d.ts +0 -89
  114. package/lib/screenplay/interactions/RightClick.js +0 -100
  115. package/lib/screenplay/interactions/RightClick.js.map +0 -1
  116. package/lib/screenplay/interactions/Scroll.d.ts +0 -75
  117. package/lib/screenplay/interactions/Scroll.js +0 -86
  118. package/lib/screenplay/interactions/Scroll.js.map +0 -1
  119. package/lib/screenplay/interactions/Wait.d.ts +0 -143
  120. package/lib/screenplay/interactions/Wait.js +0 -247
  121. package/lib/screenplay/interactions/Wait.js.map +0 -1
  122. package/lib/screenplay/interactions/WaitBuilder.d.ts +0 -32
  123. package/lib/screenplay/interactions/WaitBuilder.js +0 -3
  124. package/lib/screenplay/interactions/WaitBuilder.js.map +0 -1
  125. package/lib/screenplay/interactions/WebElementInteraction.d.ts +0 -37
  126. package/lib/screenplay/interactions/WebElementInteraction.js +0 -52
  127. package/lib/screenplay/interactions/WebElementInteraction.js.map +0 -1
  128. package/lib/screenplay/interactions/index.d.ts +0 -13
  129. package/lib/screenplay/interactions/index.js +0 -26
  130. package/lib/screenplay/interactions/index.js.map +0 -1
  131. package/lib/screenplay/questions/Attribute.d.ts +0 -82
  132. package/lib/screenplay/questions/Attribute.js +0 -102
  133. package/lib/screenplay/questions/Attribute.js.map +0 -1
  134. package/lib/screenplay/questions/CSSClasses.d.ts +0 -92
  135. package/lib/screenplay/questions/CSSClasses.js +0 -112
  136. package/lib/screenplay/questions/CSSClasses.js.map +0 -1
  137. package/lib/screenplay/questions/LastScriptExecution.d.ts +0 -14
  138. package/lib/screenplay/questions/LastScriptExecution.js +0 -22
  139. package/lib/screenplay/questions/LastScriptExecution.js.map +0 -1
  140. package/lib/screenplay/questions/NestedTargetBuilder.d.ts +0 -27
  141. package/lib/screenplay/questions/NestedTargetBuilder.js +0 -3
  142. package/lib/screenplay/questions/NestedTargetBuilder.js.map +0 -1
  143. package/lib/screenplay/questions/TargetBuilder.d.ts +0 -25
  144. package/lib/screenplay/questions/TargetBuilder.js +0 -3
  145. package/lib/screenplay/questions/TargetBuilder.js.map +0 -1
  146. package/lib/screenplay/questions/Text.d.ts +0 -95
  147. package/lib/screenplay/questions/Text.js +0 -130
  148. package/lib/screenplay/questions/Text.js.map +0 -1
  149. package/lib/screenplay/questions/Value.d.ts +0 -63
  150. package/lib/screenplay/questions/Value.js +0 -78
  151. package/lib/screenplay/questions/Value.js.map +0 -1
  152. package/lib/screenplay/questions/Website.d.ts +0 -21
  153. package/lib/screenplay/questions/Website.js +0 -31
  154. package/lib/screenplay/questions/Website.js.map +0 -1
  155. package/lib/screenplay/questions/index.d.ts +0 -10
  156. package/lib/screenplay/questions/index.js +0 -23
  157. package/lib/screenplay/questions/index.js.map +0 -1
  158. package/lib/screenplay/questions/lists.d.ts +0 -86
  159. package/lib/screenplay/questions/lists.js +0 -137
  160. package/lib/screenplay/questions/lists.js.map +0 -1
  161. package/lib/screenplay/questions/locators.d.ts +0 -196
  162. package/lib/screenplay/questions/locators.js +0 -219
  163. package/lib/screenplay/questions/locators.js.map +0 -1
  164. package/lib/screenplay/questions/targets.d.ts +0 -254
  165. package/lib/screenplay/questions/targets.js +0 -334
  166. package/lib/screenplay/questions/targets.js.map +0 -1
  167. package/lib/stage/crew/index.d.ts +0 -1
  168. package/lib/stage/crew/index.js +0 -14
  169. package/lib/stage/crew/index.js.map +0 -1
  170. package/lib/stage/crew/photographer/Photographer.d.ts +0 -83
  171. package/lib/stage/crew/photographer/Photographer.js +0 -102
  172. package/lib/stage/crew/photographer/Photographer.js.map +0 -1
  173. package/lib/stage/crew/photographer/index.d.ts +0 -2
  174. package/lib/stage/crew/photographer/index.js +0 -15
  175. package/lib/stage/crew/photographer/index.js.map +0 -1
  176. package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.d.ts +0 -28
  177. package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js +0 -65
  178. package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js.map +0 -1
  179. package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.d.ts +0 -18
  180. package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js +0 -30
  181. package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js.map +0 -1
  182. package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.d.ts +0 -17
  183. package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js +0 -28
  184. package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js.map +0 -1
  185. package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.d.ts +0 -19
  186. package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js +0 -28
  187. package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js.map +0 -1
  188. package/lib/stage/crew/photographer/strategies/index.d.ts +0 -4
  189. package/lib/stage/crew/photographer/strategies/index.js +0 -17
  190. package/lib/stage/crew/photographer/strategies/index.js.map +0 -1
  191. package/lib/stage/index.d.ts +0 -1
  192. package/lib/stage/index.js +0 -14
  193. package/lib/stage/index.js.map +0 -1
  194. package/src/expectations/ElementExpectation.ts +0 -31
  195. package/src/expectations/index.ts +0 -6
  196. package/src/expectations/isActive.ts +0 -21
  197. package/src/expectations/isClickable.ts +0 -26
  198. package/src/expectations/isEnabled.ts +0 -19
  199. package/src/expectations/isPresent.ts +0 -20
  200. package/src/expectations/isSelected.ts +0 -19
  201. package/src/expectations/isVisible.ts +0 -19
  202. package/src/input/Key.ts +0 -83
  203. package/src/input/index.ts +0 -1
  204. package/src/screenplay/interactions/Clear.ts +0 -102
  205. package/src/screenplay/interactions/Click.ts +0 -85
  206. package/src/screenplay/interactions/DoubleClick.ts +0 -102
  207. package/src/screenplay/interactions/Enter.ts +0 -93
  208. package/src/screenplay/interactions/EnterBuilder.ts +0 -27
  209. package/src/screenplay/interactions/ExecuteScript.ts +0 -344
  210. package/src/screenplay/interactions/Hover.ts +0 -90
  211. package/src/screenplay/interactions/Navigate.ts +0 -208
  212. package/src/screenplay/interactions/Press.ts +0 -172
  213. package/src/screenplay/interactions/PressBuilder.ts +0 -28
  214. package/src/screenplay/interactions/RightClick.ts +0 -100
  215. package/src/screenplay/interactions/Scroll.ts +0 -87
  216. package/src/screenplay/interactions/Wait.ts +0 -267
  217. package/src/screenplay/interactions/WaitBuilder.ts +0 -34
  218. package/src/screenplay/interactions/WebElementInteraction.ts +0 -56
  219. package/src/screenplay/interactions/index.ts +0 -13
  220. package/src/screenplay/questions/Attribute.ts +0 -112
  221. package/src/screenplay/questions/CSSClasses.ts +0 -116
  222. package/src/screenplay/questions/LastScriptExecution.ts +0 -21
  223. package/src/screenplay/questions/NestedTargetBuilder.ts +0 -30
  224. package/src/screenplay/questions/TargetBuilder.ts +0 -27
  225. package/src/screenplay/questions/Text.ts +0 -140
  226. package/src/screenplay/questions/Value.ts +0 -82
  227. package/src/screenplay/questions/Website.ts +0 -34
  228. package/src/screenplay/questions/index.ts +0 -10
  229. package/src/screenplay/questions/lists.ts +0 -161
  230. package/src/screenplay/questions/locators.ts +0 -254
  231. package/src/screenplay/questions/targets.ts +0 -401
  232. package/src/stage/crew/index.ts +0 -1
  233. package/src/stage/crew/photographer/Photographer.ts +0 -108
  234. package/src/stage/crew/photographer/index.ts +0 -2
  235. package/src/stage/crew/photographer/strategies/PhotoTakingStrategy.ts +0 -103
  236. package/src/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.ts +0 -28
  237. package/src/stage/crew/photographer/strategies/TakePhotosOfFailures.ts +0 -26
  238. package/src/stage/crew/photographer/strategies/TakePhotosOfInteractions.ts +0 -26
  239. package/src/stage/crew/photographer/strategies/index.ts +0 -4
  240. package/src/stage/index.ts +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"PhotoTakingStrategy.js","sourceRoot":"","sources":["../../../../../src/stage/crew/photographer/strategies/PhotoTakingStrategy.ts"],"names":[],"mappings":";;;AACA,yDAQsC;AACtC,uDAAsF;AAGtF,uDAAsD;AAEtD;;;;;;;;GAQG;AACH,MAAsB,mBAAmB;IAErC;;;;;;;;;OASG;IACH,mBAAmB,CAAC,KAAwC,EAAE,KAAY;QACtE,IAAI,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE;YAChC,IAAI,YAA0B,CAAC;YAE/B,IAAI;gBACA,YAAY,GAAG,yBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,sBAAsB,EAAE,CAAC,CAAC;aAClE;YAAC,MAAM;gBACJ,OAAO,KAAK,CAAC,CAAC;aACjB;YAED,MACI,EAAE,GAAgB,qBAAa,CAAC,MAAM,EAAE,EACxC,UAAU,GAAQ,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;YAC1C,6FAA6F;YAC7F,YAAY,GAAM,YAAY,CAAC,OAAO,CAAC,YAAgD,CAAC;YAE5F,KAAK,CAAC,QAAQ,CAAC,IAAI,gCAAuB,CACtC,IAAI,mBAAW,CAAC,iBAAkB,IAAI,CAAC,WAAW,CAAC,IAAK,2BAA4B,UAAW,MAAM,CAAC,EACtG,EAAE,CACL,CAAC,CAAC;YAEH,YAAY,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;gBAE5C,MACI,OAAO,GAAK,CAAE,YAAY,CAAC,YAAY,EAAE,YAAY,CAAC,WAAW,EAAE,YAAY,CAAC,cAAc,CAAE,EAChG,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,OAAO,EAAE,UAAU,CAAC,CAAC;gBAE9D,KAAK,CAAC,QAAQ,CAAC,IAAI,yCAAgC,CAC/C,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,UAAU,EAChB,SAAS,EACT,aAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAC/B,CAAC,CAAC;gBAEH,KAAK,CAAC,QAAQ,CAAC,IAAI,gCAAuB,CACtC,IAAI,mBAAW,CAAC,IAAK,IAAI,CAAC,WAAW,CAAC,IAAK,yBAA0B,UAAW,QAAS,OAAQ,EAAE,CAAC,EACpG,EAAE,CACL,CAAC,CAAC;YACP,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACb,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;oBAC1B,KAAK,CAAC,QAAQ,CAAC,IAAI,gCAAuB,CACtC,IAAI,mBAAW,CAAC,IAAK,IAAI,CAAC,WAAW,CAAC,IAAK,mCAAoC,UAAW,gBAAiB,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,CAAC,IAAK,EAAE,CAAC,EAC1J,EAAE,CACL,CAAC,CAAC;iBACN;qBACI;oBACD,KAAK,CAAC,QAAQ,CAAC,IAAI,6BAAoB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;iBACvD;YACL,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IAMO,gBAAgB,CAAC,GAAG,KAAe;QACvC,OAAO,IAAI,YAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;IAEO,YAAY,CAAC,KAAY;QAC7B,OAAO;QACP,uDAAuD;QACvD,6DAA6D;QAC7D,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA9ED,kDA8EC"}
@@ -1,18 +0,0 @@
1
- import { DomainEvent, InteractionFinished, InteractionStarts } from '@serenity-js/core/lib/events';
2
- import { PhotoTakingStrategy } from './PhotoTakingStrategy';
3
- /**
4
- * @desc
5
- * Configures the {@link Photographer} to take photos (a.k.a. screenshots) both before and after
6
- * every single {@link @serenity-js/core/lib/screenplay~Interaction} performed
7
- * by the {@link @serenity-js/core/lib/screenplay/actor~Actor} in the spotlight.
8
- *
9
- * *Please note* that this strategy will result in _a lot_ of screenshots being taken,
10
- * which will seriously affect the performance of your tests.
11
- * For this reason, it's best to use it only for debugging purposes.
12
- *
13
- * @extends {PhotoTakingStrategy}
14
- */
15
- export declare class TakePhotosBeforeAndAfterInteractions extends PhotoTakingStrategy {
16
- protected shouldTakeAPhotoOf(event: DomainEvent): boolean;
17
- protected photoNameFor(event: InteractionStarts | InteractionFinished): string;
18
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TakePhotosBeforeAndAfterInteractions = void 0;
4
- const events_1 = require("@serenity-js/core/lib/events");
5
- const PhotoTakingStrategy_1 = require("./PhotoTakingStrategy");
6
- /**
7
- * @desc
8
- * Configures the {@link Photographer} to take photos (a.k.a. screenshots) both before and after
9
- * every single {@link @serenity-js/core/lib/screenplay~Interaction} performed
10
- * by the {@link @serenity-js/core/lib/screenplay/actor~Actor} in the spotlight.
11
- *
12
- * *Please note* that this strategy will result in _a lot_ of screenshots being taken,
13
- * which will seriously affect the performance of your tests.
14
- * For this reason, it's best to use it only for debugging purposes.
15
- *
16
- * @extends {PhotoTakingStrategy}
17
- */
18
- class TakePhotosBeforeAndAfterInteractions extends PhotoTakingStrategy_1.PhotoTakingStrategy {
19
- shouldTakeAPhotoOf(event) {
20
- return event instanceof events_1.InteractionStarts
21
- || event instanceof events_1.InteractionFinished;
22
- }
23
- photoNameFor(event) {
24
- return event instanceof events_1.InteractionStarts
25
- ? `Before ${event.details.name.value}`
26
- : `After ${event.details.name.value}`;
27
- }
28
- }
29
- exports.TakePhotosBeforeAndAfterInteractions = TakePhotosBeforeAndAfterInteractions;
30
- //# sourceMappingURL=TakePhotosBeforeAndAfterInteractions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TakePhotosBeforeAndAfterInteractions.js","sourceRoot":"","sources":["../../../../../src/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.ts"],"names":[],"mappings":";;;AAAA,yDAAmG;AAEnG,+DAA4D;AAE5D;;;;;;;;;;;GAWG;AACH,MAAa,oCAAqC,SAAQ,yCAAmB;IAC/D,kBAAkB,CAAC,KAAkB;QAC3C,OAAO,KAAK,YAAY,0BAAiB;eAClC,KAAK,YAAY,4BAAmB,CAAC;IAChD,CAAC;IAES,YAAY,CAAC,KAA8C;QACjE,OAAO,KAAK,YAAY,0BAAiB;YACrC,CAAC,CAAC,UAAW,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAM,EAAE;YACxC,CAAC,CAAC,SAAU,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAM,EAAE,CAAC;IAChD,CAAC;CACJ;AAXD,oFAWC"}
@@ -1,17 +0,0 @@
1
- import { DomainEvent, InteractionFinished } from '@serenity-js/core/lib/events';
2
- import { PhotoTakingStrategy } from './PhotoTakingStrategy';
3
- /**
4
- * @desc
5
- * Configures the {@link Photographer} to take photos (a.k.a. screenshots) when
6
- * the {@link @serenity-js/core/lib/screenplay~Interaction} performed
7
- * by the {@link @serenity-js/core/lib/screenplay/actor~Actor} in the spotlight results in an error.
8
- *
9
- * This strategy works best when you are interested in the screenshots only when
10
- * a scenario fails.
11
- *
12
- * @extends {PhotoTakingStrategy}
13
- */
14
- export declare class TakePhotosOfFailures extends PhotoTakingStrategy {
15
- protected shouldTakeAPhotoOf(event: DomainEvent): boolean;
16
- protected photoNameFor(event: InteractionFinished): string;
17
- }
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TakePhotosOfFailures = void 0;
4
- const events_1 = require("@serenity-js/core/lib/events");
5
- const model_1 = require("@serenity-js/core/lib/model");
6
- const PhotoTakingStrategy_1 = require("./PhotoTakingStrategy");
7
- /**
8
- * @desc
9
- * Configures the {@link Photographer} to take photos (a.k.a. screenshots) when
10
- * the {@link @serenity-js/core/lib/screenplay~Interaction} performed
11
- * by the {@link @serenity-js/core/lib/screenplay/actor~Actor} in the spotlight results in an error.
12
- *
13
- * This strategy works best when you are interested in the screenshots only when
14
- * a scenario fails.
15
- *
16
- * @extends {PhotoTakingStrategy}
17
- */
18
- class TakePhotosOfFailures extends PhotoTakingStrategy_1.PhotoTakingStrategy {
19
- shouldTakeAPhotoOf(event) {
20
- return event instanceof events_1.InteractionFinished
21
- && event.outcome.isWorseThan(model_1.ImplementationPending);
22
- }
23
- photoNameFor(event) {
24
- return event.details.name.value;
25
- }
26
- }
27
- exports.TakePhotosOfFailures = TakePhotosOfFailures;
28
- //# sourceMappingURL=TakePhotosOfFailures.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TakePhotosOfFailures.js","sourceRoot":"","sources":["../../../../../src/stage/crew/photographer/strategies/TakePhotosOfFailures.ts"],"names":[],"mappings":";;;AAAA,yDAAgF;AAChF,uDAAoE;AAEpE,+DAA4D;AAE5D;;;;;;;;;;GAUG;AACH,MAAa,oBAAqB,SAAQ,yCAAmB;IAC/C,kBAAkB,CAAC,KAAkB;QAC3C,OAAO,KAAK,YAAY,4BAAmB;eACpC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,6BAAqB,CAAC,CAAC;IAC5D,CAAC;IAES,YAAY,CAAC,KAA0B;QAC7C,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;IACpC,CAAC;CACJ;AATD,oDASC"}
@@ -1,19 +0,0 @@
1
- import { DomainEvent, InteractionFinished } from '@serenity-js/core/lib/events';
2
- import { PhotoTakingStrategy } from './PhotoTakingStrategy';
3
- /**
4
- * @desc
5
- * Configures the {@link Photographer} to take photos (a.k.a. screenshots) when
6
- * the the {@link @serenity-js/core/lib/screenplay/actor~Actor} in the spotlight
7
- * performs any {@link @serenity-js/core/lib/screenplay~Interaction}.
8
- *
9
- * This strategy works best when you want the results of your automated tests
10
- * to become comprehensive living documentation of your system.
11
- *
12
- * *Please note* that taking screenshots affects the performance of your tests.
13
- *
14
- * @extends {PhotoTakingStrategy}
15
- */
16
- export declare class TakePhotosOfInteractions extends PhotoTakingStrategy {
17
- protected shouldTakeAPhotoOf(event: DomainEvent): boolean;
18
- protected photoNameFor(event: InteractionFinished): string;
19
- }
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TakePhotosOfInteractions = void 0;
4
- const events_1 = require("@serenity-js/core/lib/events");
5
- const PhotoTakingStrategy_1 = require("./PhotoTakingStrategy");
6
- /**
7
- * @desc
8
- * Configures the {@link Photographer} to take photos (a.k.a. screenshots) when
9
- * the the {@link @serenity-js/core/lib/screenplay/actor~Actor} in the spotlight
10
- * performs any {@link @serenity-js/core/lib/screenplay~Interaction}.
11
- *
12
- * This strategy works best when you want the results of your automated tests
13
- * to become comprehensive living documentation of your system.
14
- *
15
- * *Please note* that taking screenshots affects the performance of your tests.
16
- *
17
- * @extends {PhotoTakingStrategy}
18
- */
19
- class TakePhotosOfInteractions extends PhotoTakingStrategy_1.PhotoTakingStrategy {
20
- shouldTakeAPhotoOf(event) {
21
- return event instanceof events_1.InteractionFinished;
22
- }
23
- photoNameFor(event) {
24
- return event.details.name.value;
25
- }
26
- }
27
- exports.TakePhotosOfInteractions = TakePhotosOfInteractions;
28
- //# sourceMappingURL=TakePhotosOfInteractions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TakePhotosOfInteractions.js","sourceRoot":"","sources":["../../../../../src/stage/crew/photographer/strategies/TakePhotosOfInteractions.ts"],"names":[],"mappings":";;;AAAA,yDAAgF;AAEhF,+DAA4D;AAE5D;;;;;;;;;;;;GAYG;AACH,MAAa,wBAAyB,SAAQ,yCAAmB;IACnD,kBAAkB,CAAC,KAAkB;QAC3C,OAAO,KAAK,YAAY,4BAAmB,CAAC;IAChD,CAAC;IAES,YAAY,CAAC,KAA0B;QAC7C,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;IACpC,CAAC;CACJ;AARD,4DAQC"}
@@ -1,4 +0,0 @@
1
- export * from './PhotoTakingStrategy';
2
- export * from './TakePhotosBeforeAndAfterInteractions';
3
- export * from './TakePhotosOfFailures';
4
- export * from './TakePhotosOfInteractions';
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./PhotoTakingStrategy"), exports);
14
- __exportStar(require("./TakePhotosBeforeAndAfterInteractions"), exports);
15
- __exportStar(require("./TakePhotosOfFailures"), exports);
16
- __exportStar(require("./TakePhotosOfInteractions"), exports);
17
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/stage/crew/photographer/strategies/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wDAAsC;AACtC,yEAAuD;AACvD,yDAAuC;AACvC,6DAA2C"}
@@ -1 +0,0 @@
1
- export * from './crew';
@@ -1,14 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./crew"), exports);
14
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stage/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAuB"}
@@ -1,31 +0,0 @@
1
- import { AnswersQuestions, Expectation, ExpectationMet, ExpectationNotMet, ExpectationOutcome } from '@serenity-js/core';
2
- import { Element } from 'webdriverio';
3
-
4
- /**
5
- * @access private
6
- */
7
- export class ElementExpectation extends Expectation<any, Element<'async'>> {
8
- static forElementTo(message: string, fn: (actual: Element<'async'>) => Promise<boolean>): Expectation<any, Element<'async'>> {
9
- return new ElementExpectation(message, fn);
10
- }
11
-
12
- constructor(
13
- subject: string,
14
- private readonly fn: (actual: Element<'async'>) => Promise<boolean>,
15
- ) {
16
- super(subject);
17
- }
18
-
19
- answeredBy(actor: AnswersQuestions): (actual: Element<'async'>) => Promise<ExpectationOutcome<boolean, Element<'async'>>> {
20
- return (actual: Element<'async'>) =>
21
- this.fn(actual)
22
- .then(expectationMet =>
23
- expectationMet
24
- ? new ExpectationMet(this.toString(), undefined, actual)
25
- : new ExpectationNotMet(this.toString(), undefined, actual),
26
- )
27
- .catch(error => {
28
- return new ExpectationNotMet(`${ this.toString() } (${ error.message })`, undefined, actual);
29
- });
30
- }
31
- }
@@ -1,6 +0,0 @@
1
- export * from './isActive';
2
- export * from './isClickable';
3
- export * from './isEnabled';
4
- export * from './isPresent';
5
- export * from './isSelected';
6
- export * from './isVisible';
@@ -1,21 +0,0 @@
1
- import { Expectation } from '@serenity-js/core';
2
- import { Element } from 'webdriverio';
3
-
4
- import { ElementExpectation } from './ElementExpectation';
5
-
6
- /**
7
- * @desc
8
- * Expectation that the element is active (has focus).
9
- * If the selector matches multiple elements, it will return true if one of the elements has focus.
10
- *
11
- * @returns {@serenity-js/core/lib/screenplay/questions~Expectation<boolean, Element<'async'>>}
12
- *
13
- * @see https://webdriver.io/docs/api/element/isFocused/
14
- * @see {@link @serenity-js/assertions~Ensure}
15
- * @see {@link @serenity-js/core/lib/screenplay/questions~Check}
16
- * @see {@link Wait}
17
- */
18
- export function isActive(): Expectation<boolean, Element<'async'>> {
19
- return ElementExpectation.forElementTo('become active', actual => actual.isFocused());
20
- }
21
-
@@ -1,26 +0,0 @@
1
- import { Expectation } from '@serenity-js/core';
2
- import { Element } from 'webdriverio';
3
-
4
- import { ElementExpectation } from './ElementExpectation';
5
-
6
- /**
7
- * @desc
8
- * Expectation that an element is clickable, which means:
9
- * - it exists
10
- * - it is visible
11
- * - it is within viewport (if not, try to scroll to it)
12
- * - its center is not overlapped with another element
13
- * - it is not disabled
14
- * otherwise return false.
15
- *
16
- * @returns {@serenity-js/core/lib/screenplay/questions~Expectation<boolean, Element<'async'>>}
17
- *
18
- * @see https://webdriver.io/docs/api/element/isClickable/
19
- * @see {@link @serenity-js/assertions~Ensure}
20
- * @see {@link @serenity-js/core/lib/screenplay/questions~Check}
21
- * @see {@link Wait}
22
- */
23
- export function isClickable(): Expectation<boolean, Element<'async'>> {
24
- return ElementExpectation.forElementTo('become clickable', actual => actual.isClickable());
25
- }
26
-
@@ -1,19 +0,0 @@
1
- import { Expectation } from '@serenity-js/core';
2
- import { Element } from 'webdriverio';
3
-
4
- import { ElementExpectation } from './ElementExpectation';
5
-
6
- /**
7
- * @desc
8
- * Expectation that the element is enabled.
9
- *
10
- * @returns {@serenity-js/core/lib/screenplay/questions~Expectation<boolean, Element<'async'>>}
11
- *
12
- * @see https://webdriver.io/docs/api/element/isEnabled/
13
- * @see {@link @serenity-js/assertions~Ensure}
14
- * @see {@link @serenity-js/core/lib/screenplay/questions~Check}
15
- * @see {@link Wait}
16
- */
17
- export function isEnabled(): Expectation<boolean, Element<'async'>> {
18
- return ElementExpectation.forElementTo('become enabled', actual => actual.isEnabled());
19
- }
@@ -1,20 +0,0 @@
1
- import { Expectation } from '@serenity-js/core';
2
- import { Element } from 'webdriverio';
3
-
4
- import { ElementExpectation } from './ElementExpectation';
5
-
6
- /**
7
- * @desc
8
- * Expectation that the element is present in the DOM of a page.
9
- * Please note that this does not necessarily mean that the element is visible.
10
- *
11
- * @returns {@serenity-js/core/lib/screenplay/questions~Expectation<boolean, Element<'async'>>}
12
- *
13
- * @see https://webdriver.io/docs/api/element/isExisting/
14
- * @see {@link @serenity-js/assertions~Ensure}
15
- * @see {@link @serenity-js/core/lib/screenplay/questions~Check}
16
- * @see {@link Wait}
17
- */
18
- export function isPresent(): Expectation<boolean, Element<'async'>> {
19
- return ElementExpectation.forElementTo('become present', actual => actual.isExisting());
20
- }
@@ -1,19 +0,0 @@
1
- import { Expectation } from '@serenity-js/core';
2
- import { Element } from 'webdriverio';
3
-
4
- import { ElementExpectation } from './ElementExpectation';
5
-
6
- /**
7
- * @desc
8
- * Expectation that an `<option>` or `<input>` element of type checkbox or radio is currently selected.
9
- *
10
- * @returns {@serenity-js/core/lib/screenplay/questions~Expectation<boolean, Element<'async'>>}
11
- *
12
- * @see https://webdriver.io/docs/api/element/isSelected/
13
- * @see {@link @serenity-js/assertions~Ensure}
14
- * @see {@link @serenity-js/core/lib/screenplay/questions~Check}
15
- * @see {@link Wait}
16
- */
17
- export function isSelected(): Expectation<boolean, Element<'async'>> {
18
- return ElementExpectation.forElementTo('become selected', actual => actual.isSelected());
19
- }
@@ -1,19 +0,0 @@
1
- import { Expectation } from '@serenity-js/core';
2
- import { Element } from 'webdriverio';
3
-
4
- import { ElementExpectation } from './ElementExpectation';
5
-
6
- /**
7
- * @desc
8
- * Expectation that the element is present in the DOM of the page and visible.
9
- *
10
- * @returns {@serenity-js/core/lib/screenplay/questions~Expectation<boolean, Element<'async'>>}
11
- *
12
- * @see https://webdriver.io/docs/api/element/isDisplayed/
13
- * @see {@link @serenity-js/assertions~Ensure}
14
- * @see {@link @serenity-js/core/lib/screenplay/questions~Check}
15
- * @see {@link Wait}
16
- */
17
- export function isVisible(): Expectation<boolean, Element<'async'>> {
18
- return ElementExpectation.forElementTo('become visible', actual => actual.isDisplayed());
19
- }
package/src/input/Key.ts DELETED
@@ -1,83 +0,0 @@
1
- /**
2
- * @desc
3
- * Represents pressable keys that aren't text to be used with {@link Press}.
4
- *
5
- * Note that modifier like Shift, Alt and Meta (a.k.a. Command on Mac) will stay pressed
6
- *
7
- * @enum {string}
8
- * @see {@link Press}
9
- * @see https://w3c.github.io/webdriver/webdriver-spec.html#keyboard-actions
10
- * @see https://github.com/puppeteer/puppeteer/blob/v7.1.0/src/common/USKeyboardLayout.ts
11
- * @see https://github.com/SeleniumHQ/selenium/blob/trunk/javascript/node/selenium-webdriver/lib/input.js#L46
12
- * @see https://github.com/webdriverio/webdriverio/blob/main/packages/wdio-utils/src/constants.ts#L5
13
- */
14
- export class Key {
15
- public static Alt = new Key('Alt', '\uE00A', true);
16
- public static ArrowDown = new Key('ArrowDown', '\uE015');
17
- public static ArrowLeft = new Key('ArrowLeft', '\uE012');
18
- public static ArrowRight = new Key('ArrowRight', '\uE014');
19
- public static ArrowUp = new Key('ArrowUp', '\uE013');
20
- public static Backspace = new Key('Backspace', '\uE003');
21
- public static Cancel = new Key('Cancel', '\uE001');
22
- public static Clear = new Key('Clear', '\uE005');
23
- public static Control = new Key('Control', '\uE009', true);
24
- public static Delete = new Key('Delete', '\uE017');
25
- public static End = new Key('End', '\uE010');
26
- public static Enter = new Key('Enter', '\uE007');
27
- public static Escape = new Key('Escape', '\uE00C');
28
- public static F1 = new Key('F1', '\uE031');
29
- public static F2 = new Key('F2', '\uE032');
30
- public static F3 = new Key('F3', '\uE033');
31
- public static F4 = new Key('F4', '\uE034');
32
- public static F5 = new Key('F5', '\uE035');
33
- public static F6 = new Key('F6', '\uE036');
34
- public static F7 = new Key('F7', '\uE037');
35
- public static F8 = new Key('F8', '\uE038');
36
- public static F9 = new Key('F9', '\uE039');
37
- public static F10 = new Key('F10', '\uE03A');
38
- public static F11 = new Key('F11', '\uE03B');
39
- public static F12 = new Key('F12', '\uE03C');
40
- public static Help = new Key('Help', '\uE002');
41
- public static Home = new Key('Home', '\uE011');
42
- public static Insert = new Key('Insert', '\uE016');
43
- public static Meta = new Key('Meta', '\uE03D', true);
44
- public static Numpad0 = new Key('Numpad0', '\uE01A');
45
- public static Numpad1 = new Key('Numpad1', '\uE01B');
46
- public static Numpad2 = new Key('Numpad2', '\uE01C');
47
- public static Numpad3 = new Key('Numpad3', '\uE01D');
48
- public static Numpad4 = new Key('Numpad4', '\uE01E');
49
- public static Numpad5 = new Key('Numpad5', '\uE01F');
50
- public static Numpad6 = new Key('Numpad6', '\uE020');
51
- public static Numpad7 = new Key('Numpad7', '\uE021');
52
- public static Numpad8 = new Key('Numpad8', '\uE022');
53
- public static Numpad9 = new Key('Numpad9', '\uE023');
54
- public static NumpadAdd = new Key('NumpadAdd', '\uE025');
55
- public static NumpadDecimal = new Key('NumpadDecimal', '\uE028');
56
- public static NumpadDivide = new Key('NumpadDivide', '\uE029');
57
- public static NumpadEqual = new Key('NumpadEqual', '\uE019');
58
- public static NumpadMultiply = new Key('NumpadMultiply', '\uE024');
59
- public static NumpadSubtract = new Key('NumpadSubtract', '\uE027');
60
- public static PageDown = new Key('PageDown', '\uE00F');
61
- public static PageUp = new Key('PageUp', '\uE00E');
62
- public static Pause = new Key('Pause', '\uE00B');
63
- public static Semicolon = new Key('Semicolon', '\uE018');
64
- public static Shift = new Key('Shift', '\uE008', true);
65
- public static Space = new Key('Space', '\uE00D');
66
- public static Tab = new Key('Tab', '\uE004');
67
-
68
- public static isKey(maybeKey: unknown): maybeKey is Key {
69
- return !! maybeKey
70
- && maybeKey instanceof Key;
71
- }
72
-
73
- constructor(
74
- public readonly devtoolsName: string,
75
- public readonly utf16codePoint: string,
76
- public readonly isModifier: boolean = false,
77
- ) {
78
- }
79
-
80
- toString(): string {
81
- return this.devtoolsName;
82
- }
83
- }
@@ -1 +0,0 @@
1
- export * from './Key';
@@ -1,102 +0,0 @@
1
- import { Answerable, AnswersQuestions, Interaction, LogicError, UsesAbilities } from '@serenity-js/core';
2
- import { formatted } from '@serenity-js/core/lib/io';
3
- import { Element } from 'webdriverio';
4
-
5
- import { WebElementInteraction } from './WebElementInteraction';
6
-
7
- /**
8
- * @desc
9
- * Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
10
- * clear the `value` of a [form `input`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
11
- *
12
- * @example <caption>Example widget</caption>
13
- * <form>
14
- * <input type="text" name="example" id="example" />
15
- * </form>
16
- *
17
- * @example <caption>Lean Page Object describing the widget</caption>
18
- * import { by, Target } from '@serenity-js/webdriverio';
19
- *
20
- * class Form {
21
- * static exampleInput = Target.the('example input')
22
- * .located(by.id('example'));
23
- * }
24
- *
25
- * @example <caption>Clearing the value of an input field</caption>
26
- * import { actorCalled } from '@serenity-js/core';
27
- * import { BrowseTheWeb, Clear, Enter, Value } from '@serenity-js/webdriverio';
28
- * import { Ensure, equals } from '@serenity-js/assertions';
29
- *
30
- * actorCalled('Inés')
31
- * .whoCan(BrowseTheWeb.using(browser))
32
- * .attemptsTo(
33
- * Enter.theValue('Hello world!').into(Form.exampleInput),
34
- * Ensure.that(Value.of(Form.exampleInput), equals('Hello world!')),
35
- *
36
- * Clear.theValueOf(Form.exampleInput),
37
- * Ensure.that(Value.of(Form.exampleInput), equals('')),
38
- * );
39
- *
40
- * @see {@link BrowseTheWeb}
41
- * @see {@link Enter}
42
- * @see {@link Value}
43
- * @see {@link Target}
44
- * @see {@link @serenity-js/assertions~Ensure}
45
- * @see {@link @serenity-js/assertions/lib/expectations~equals}
46
- *
47
- * @extends {@serenity-js/core/lib/screenplay~Interaction}
48
- */
49
- export class Clear extends WebElementInteraction {
50
-
51
- /**
52
- * @desc
53
- * Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
54
- *
55
- * @param {Answerable<Element<'async'>>} field
56
- * The field to be cleared
57
- *
58
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
59
- */
60
- static theValueOf(field: Answerable<Element<'async'>>): Interaction {
61
- return new Clear(field);
62
- }
63
-
64
- /**
65
- * @param {Answerable<Element<'async'>>} field
66
- * The element to be clicked on
67
- */
68
- constructor(private readonly field: Answerable<Element<'async'>>) {
69
- super(formatted `#actor clears the value of ${ field }`);
70
- }
71
-
72
- /**
73
- * @desc
74
- * Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
75
- * perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
76
- *
77
- * @param {UsesAbilities & AnswersQuestions} actor
78
- * An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
79
- *
80
- * @returns {PromiseLike<void>}
81
- *
82
- * @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
83
- * @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
84
- * @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
85
- */
86
- async performAs(actor: UsesAbilities & AnswersQuestions): Promise<void> {
87
- const element = await this.resolve(actor, this.field);
88
- const value = await element.getValue();
89
-
90
- if (value === undefined) {
91
- throw new LogicError(
92
- this.capitaliseFirstLetter(formatted `${ this.field } doesn't seem to have a 'value' attribute that could be cleared.`),
93
- );
94
- }
95
-
96
- return element.clearValue();
97
- }
98
-
99
- private capitaliseFirstLetter(text: string) {
100
- return text.charAt(0).toUpperCase() + text.slice(1);
101
- }
102
- }