@serenity-js/webdriverio 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 (247) hide show
  1. package/CHANGELOG.md +455 -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} +42 -27
  11. package/lib/screenplay/abilities/{BrowseTheWeb.js → BrowseTheWebWithWebdriverIO.js} +104 -32
  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/WebdriverIOFrame.d.ts +10 -0
  23. package/lib/screenplay/models/WebdriverIOFrame.js +34 -0
  24. package/lib/screenplay/models/WebdriverIOFrame.js.map +1 -0
  25. package/lib/screenplay/models/WebdriverIOModalDialog.d.ts +11 -0
  26. package/lib/screenplay/models/WebdriverIOModalDialog.js +40 -0
  27. package/lib/screenplay/models/WebdriverIOModalDialog.js.map +1 -0
  28. package/lib/screenplay/models/WebdriverIOPage.d.ts +26 -0
  29. package/lib/screenplay/models/WebdriverIOPage.js +104 -0
  30. package/lib/screenplay/models/WebdriverIOPage.js.map +1 -0
  31. package/lib/screenplay/models/WebdriverIOPageElement.d.ts +31 -0
  32. package/lib/screenplay/models/WebdriverIOPageElement.js +185 -0
  33. package/lib/screenplay/models/WebdriverIOPageElement.js.map +1 -0
  34. package/lib/screenplay/models/index.d.ts +5 -0
  35. package/lib/{stage/crew/photographer/strategies → screenplay/models}/index.js +5 -4
  36. package/lib/screenplay/models/index.js.map +1 -0
  37. package/lib/screenplay/models/locators/WebdriverIOLocator.d.ts +9 -0
  38. package/lib/screenplay/models/locators/WebdriverIOLocator.js +22 -0
  39. package/lib/screenplay/models/locators/WebdriverIOLocator.js.map +1 -0
  40. package/lib/screenplay/models/locators/WebdriverIONativeElementRoot.d.ts +2 -0
  41. package/lib/screenplay/{interactions/EnterBuilder.js → models/locators/WebdriverIONativeElementRoot.js} +1 -1
  42. package/lib/screenplay/models/locators/WebdriverIONativeElementRoot.js.map +1 -0
  43. package/lib/screenplay/models/locators/index.d.ts +2 -0
  44. package/lib/{stage/crew/photographer → screenplay/models/locators}/index.js +2 -2
  45. package/lib/screenplay/models/locators/index.js.map +1 -0
  46. package/package.json +14 -24
  47. package/src/adapter/WebdriverIOFrameworkAdapter.ts +2 -0
  48. package/src/adapter/WebdriverIONotifier.ts +225 -23
  49. package/src/index.ts +0 -3
  50. package/src/screenplay/abilities/{BrowseTheWeb.ts → BrowseTheWebWithWebdriverIO.ts} +125 -35
  51. package/src/screenplay/abilities/index.ts +1 -1
  52. package/src/screenplay/index.ts +1 -2
  53. package/src/screenplay/models/WebdriverIOCookie.ts +44 -0
  54. package/src/screenplay/models/WebdriverIOFrame.ts +38 -0
  55. package/src/screenplay/models/WebdriverIOModalDialog.ts +45 -0
  56. package/src/screenplay/models/WebdriverIOPage.ts +128 -0
  57. package/src/screenplay/models/WebdriverIOPageElement.ts +227 -0
  58. package/src/screenplay/models/index.ts +5 -0
  59. package/src/screenplay/models/locators/WebdriverIOLocator.ts +43 -0
  60. package/src/screenplay/models/locators/WebdriverIONativeElementRoot.ts +3 -0
  61. package/src/screenplay/models/locators/index.ts +2 -0
  62. package/lib/expectations/ElementExpectation.d.ts +0 -11
  63. package/lib/expectations/ElementExpectation.js +0 -27
  64. package/lib/expectations/ElementExpectation.js.map +0 -1
  65. package/lib/expectations/index.d.ts +0 -6
  66. package/lib/expectations/index.js +0 -19
  67. package/lib/expectations/index.js.map +0 -1
  68. package/lib/expectations/isActive.d.ts +0 -15
  69. package/lib/expectations/isActive.js +0 -21
  70. package/lib/expectations/isActive.js.map +0 -1
  71. package/lib/expectations/isClickable.d.ts +0 -20
  72. package/lib/expectations/isClickable.js +0 -26
  73. package/lib/expectations/isClickable.js.map +0 -1
  74. package/lib/expectations/isEnabled.d.ts +0 -14
  75. package/lib/expectations/isEnabled.js +0 -20
  76. package/lib/expectations/isEnabled.js.map +0 -1
  77. package/lib/expectations/isPresent.d.ts +0 -15
  78. package/lib/expectations/isPresent.js +0 -21
  79. package/lib/expectations/isPresent.js.map +0 -1
  80. package/lib/expectations/isSelected.d.ts +0 -14
  81. package/lib/expectations/isSelected.js +0 -20
  82. package/lib/expectations/isSelected.js.map +0 -1
  83. package/lib/expectations/isVisible.d.ts +0 -14
  84. package/lib/expectations/isVisible.js +0 -20
  85. package/lib/expectations/isVisible.js.map +0 -1
  86. package/lib/input/Key.d.ts +0 -73
  87. package/lib/input/Key.js +0 -84
  88. package/lib/input/Key.js.map +0 -1
  89. package/lib/input/index.d.ts +0 -1
  90. package/lib/input/index.js +0 -14
  91. package/lib/input/index.js.map +0 -1
  92. package/lib/screenplay/abilities/BrowseTheWeb.js.map +0 -1
  93. package/lib/screenplay/interactions/Clear.d.ts +0 -79
  94. package/lib/screenplay/interactions/Clear.js +0 -97
  95. package/lib/screenplay/interactions/Clear.js.map +0 -1
  96. package/lib/screenplay/interactions/Click.d.ts +0 -73
  97. package/lib/screenplay/interactions/Click.js +0 -84
  98. package/lib/screenplay/interactions/Click.js.map +0 -1
  99. package/lib/screenplay/interactions/DoubleClick.d.ts +0 -90
  100. package/lib/screenplay/interactions/DoubleClick.js +0 -101
  101. package/lib/screenplay/interactions/DoubleClick.js.map +0 -1
  102. package/lib/screenplay/interactions/Enter.d.ts +0 -73
  103. package/lib/screenplay/interactions/Enter.js +0 -87
  104. package/lib/screenplay/interactions/Enter.js.map +0 -1
  105. package/lib/screenplay/interactions/EnterBuilder.d.ts +0 -25
  106. package/lib/screenplay/interactions/EnterBuilder.js.map +0 -1
  107. package/lib/screenplay/interactions/ExecuteScript.d.ts +0 -206
  108. package/lib/screenplay/interactions/ExecuteScript.js +0 -311
  109. package/lib/screenplay/interactions/ExecuteScript.js.map +0 -1
  110. package/lib/screenplay/interactions/Hover.d.ts +0 -78
  111. package/lib/screenplay/interactions/Hover.js +0 -89
  112. package/lib/screenplay/interactions/Hover.js.map +0 -1
  113. package/lib/screenplay/interactions/Navigate.d.ts +0 -141
  114. package/lib/screenplay/interactions/Navigate.js +0 -197
  115. package/lib/screenplay/interactions/Navigate.js.map +0 -1
  116. package/lib/screenplay/interactions/Press.d.ts +0 -84
  117. package/lib/screenplay/interactions/Press.js +0 -152
  118. package/lib/screenplay/interactions/Press.js.map +0 -1
  119. package/lib/screenplay/interactions/PressBuilder.d.ts +0 -26
  120. package/lib/screenplay/interactions/PressBuilder.js +0 -3
  121. package/lib/screenplay/interactions/PressBuilder.js.map +0 -1
  122. package/lib/screenplay/interactions/RightClick.d.ts +0 -89
  123. package/lib/screenplay/interactions/RightClick.js +0 -100
  124. package/lib/screenplay/interactions/RightClick.js.map +0 -1
  125. package/lib/screenplay/interactions/Scroll.d.ts +0 -75
  126. package/lib/screenplay/interactions/Scroll.js +0 -86
  127. package/lib/screenplay/interactions/Scroll.js.map +0 -1
  128. package/lib/screenplay/interactions/Wait.d.ts +0 -143
  129. package/lib/screenplay/interactions/Wait.js +0 -247
  130. package/lib/screenplay/interactions/Wait.js.map +0 -1
  131. package/lib/screenplay/interactions/WaitBuilder.d.ts +0 -32
  132. package/lib/screenplay/interactions/WaitBuilder.js +0 -3
  133. package/lib/screenplay/interactions/WaitBuilder.js.map +0 -1
  134. package/lib/screenplay/interactions/WebElementInteraction.d.ts +0 -37
  135. package/lib/screenplay/interactions/WebElementInteraction.js +0 -52
  136. package/lib/screenplay/interactions/WebElementInteraction.js.map +0 -1
  137. package/lib/screenplay/interactions/index.d.ts +0 -13
  138. package/lib/screenplay/interactions/index.js +0 -26
  139. package/lib/screenplay/interactions/index.js.map +0 -1
  140. package/lib/screenplay/questions/Attribute.d.ts +0 -82
  141. package/lib/screenplay/questions/Attribute.js +0 -102
  142. package/lib/screenplay/questions/Attribute.js.map +0 -1
  143. package/lib/screenplay/questions/CSSClasses.d.ts +0 -92
  144. package/lib/screenplay/questions/CSSClasses.js +0 -112
  145. package/lib/screenplay/questions/CSSClasses.js.map +0 -1
  146. package/lib/screenplay/questions/LastScriptExecution.d.ts +0 -14
  147. package/lib/screenplay/questions/LastScriptExecution.js +0 -22
  148. package/lib/screenplay/questions/LastScriptExecution.js.map +0 -1
  149. package/lib/screenplay/questions/NestedTargetBuilder.d.ts +0 -27
  150. package/lib/screenplay/questions/NestedTargetBuilder.js +0 -3
  151. package/lib/screenplay/questions/NestedTargetBuilder.js.map +0 -1
  152. package/lib/screenplay/questions/TargetBuilder.d.ts +0 -25
  153. package/lib/screenplay/questions/TargetBuilder.js +0 -3
  154. package/lib/screenplay/questions/TargetBuilder.js.map +0 -1
  155. package/lib/screenplay/questions/Text.d.ts +0 -95
  156. package/lib/screenplay/questions/Text.js +0 -130
  157. package/lib/screenplay/questions/Text.js.map +0 -1
  158. package/lib/screenplay/questions/Value.d.ts +0 -63
  159. package/lib/screenplay/questions/Value.js +0 -78
  160. package/lib/screenplay/questions/Value.js.map +0 -1
  161. package/lib/screenplay/questions/Website.d.ts +0 -21
  162. package/lib/screenplay/questions/Website.js +0 -31
  163. package/lib/screenplay/questions/Website.js.map +0 -1
  164. package/lib/screenplay/questions/index.d.ts +0 -10
  165. package/lib/screenplay/questions/index.js +0 -23
  166. package/lib/screenplay/questions/index.js.map +0 -1
  167. package/lib/screenplay/questions/lists.d.ts +0 -86
  168. package/lib/screenplay/questions/lists.js +0 -137
  169. package/lib/screenplay/questions/lists.js.map +0 -1
  170. package/lib/screenplay/questions/locators.d.ts +0 -196
  171. package/lib/screenplay/questions/locators.js +0 -219
  172. package/lib/screenplay/questions/locators.js.map +0 -1
  173. package/lib/screenplay/questions/targets.d.ts +0 -254
  174. package/lib/screenplay/questions/targets.js +0 -334
  175. package/lib/screenplay/questions/targets.js.map +0 -1
  176. package/lib/stage/crew/index.d.ts +0 -1
  177. package/lib/stage/crew/index.js +0 -14
  178. package/lib/stage/crew/index.js.map +0 -1
  179. package/lib/stage/crew/photographer/Photographer.d.ts +0 -83
  180. package/lib/stage/crew/photographer/Photographer.js +0 -102
  181. package/lib/stage/crew/photographer/Photographer.js.map +0 -1
  182. package/lib/stage/crew/photographer/index.d.ts +0 -2
  183. package/lib/stage/crew/photographer/index.js.map +0 -1
  184. package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.d.ts +0 -28
  185. package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js +0 -65
  186. package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js.map +0 -1
  187. package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.d.ts +0 -18
  188. package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js +0 -30
  189. package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js.map +0 -1
  190. package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.d.ts +0 -17
  191. package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js +0 -28
  192. package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js.map +0 -1
  193. package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.d.ts +0 -19
  194. package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js +0 -28
  195. package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js.map +0 -1
  196. package/lib/stage/crew/photographer/strategies/index.d.ts +0 -4
  197. package/lib/stage/crew/photographer/strategies/index.js.map +0 -1
  198. package/lib/stage/index.d.ts +0 -1
  199. package/lib/stage/index.js +0 -14
  200. package/lib/stage/index.js.map +0 -1
  201. package/src/expectations/ElementExpectation.ts +0 -31
  202. package/src/expectations/index.ts +0 -6
  203. package/src/expectations/isActive.ts +0 -21
  204. package/src/expectations/isClickable.ts +0 -26
  205. package/src/expectations/isEnabled.ts +0 -19
  206. package/src/expectations/isPresent.ts +0 -20
  207. package/src/expectations/isSelected.ts +0 -19
  208. package/src/expectations/isVisible.ts +0 -19
  209. package/src/input/Key.ts +0 -83
  210. package/src/input/index.ts +0 -1
  211. package/src/screenplay/interactions/Clear.ts +0 -102
  212. package/src/screenplay/interactions/Click.ts +0 -85
  213. package/src/screenplay/interactions/DoubleClick.ts +0 -102
  214. package/src/screenplay/interactions/Enter.ts +0 -93
  215. package/src/screenplay/interactions/EnterBuilder.ts +0 -27
  216. package/src/screenplay/interactions/ExecuteScript.ts +0 -344
  217. package/src/screenplay/interactions/Hover.ts +0 -90
  218. package/src/screenplay/interactions/Navigate.ts +0 -208
  219. package/src/screenplay/interactions/Press.ts +0 -172
  220. package/src/screenplay/interactions/PressBuilder.ts +0 -28
  221. package/src/screenplay/interactions/RightClick.ts +0 -100
  222. package/src/screenplay/interactions/Scroll.ts +0 -87
  223. package/src/screenplay/interactions/Wait.ts +0 -267
  224. package/src/screenplay/interactions/WaitBuilder.ts +0 -34
  225. package/src/screenplay/interactions/WebElementInteraction.ts +0 -56
  226. package/src/screenplay/interactions/index.ts +0 -13
  227. package/src/screenplay/questions/Attribute.ts +0 -112
  228. package/src/screenplay/questions/CSSClasses.ts +0 -116
  229. package/src/screenplay/questions/LastScriptExecution.ts +0 -21
  230. package/src/screenplay/questions/NestedTargetBuilder.ts +0 -30
  231. package/src/screenplay/questions/TargetBuilder.ts +0 -27
  232. package/src/screenplay/questions/Text.ts +0 -140
  233. package/src/screenplay/questions/Value.ts +0 -82
  234. package/src/screenplay/questions/Website.ts +0 -34
  235. package/src/screenplay/questions/index.ts +0 -10
  236. package/src/screenplay/questions/lists.ts +0 -161
  237. package/src/screenplay/questions/locators.ts +0 -254
  238. package/src/screenplay/questions/targets.ts +0 -401
  239. package/src/stage/crew/index.ts +0 -1
  240. package/src/stage/crew/photographer/Photographer.ts +0 -108
  241. package/src/stage/crew/photographer/index.ts +0 -2
  242. package/src/stage/crew/photographer/strategies/PhotoTakingStrategy.ts +0 -103
  243. package/src/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.ts +0 -28
  244. package/src/stage/crew/photographer/strategies/TakePhotosOfFailures.ts +0 -26
  245. package/src/stage/crew/photographer/strategies/TakePhotosOfInteractions.ts +0 -26
  246. package/src/stage/crew/photographer/strategies/index.ts +0 -4
  247. package/src/stage/index.ts +0 -1
@@ -1,26 +0,0 @@
1
- import { Answerable } from '@serenity-js/core';
2
- import { Interaction } from '@serenity-js/core/lib/screenplay';
3
- import { Element } from 'webdriverio';
4
- /**
5
- * @desc
6
- * Fluent interface to make the instantiation of
7
- * the {@link @serenity-js/core/lib/screenplay~Interaction}
8
- * to {@link Press} more readable.
9
- *
10
- * @see {@link Press}
11
- *
12
- * @interface
13
- */
14
- export interface PressBuilder {
15
- /**
16
- * @desc
17
- * Instantiates an {@link @serenity-js/core/lib/screenplay~Interaction}
18
- * to {@link Press}.
19
- *
20
- * @param {Question<ElementFinder> | ElementFinder | Question<AlertPromise> | AlertPromise} field
21
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
22
- *
23
- * @see {@link Target}
24
- */
25
- in: (field: Answerable<Element<'async'>>) => Interaction;
26
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=PressBuilder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PressBuilder.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/PressBuilder.ts"],"names":[],"mappings":""}
@@ -1,89 +0,0 @@
1
- import { Answerable, AnswersQuestions, Interaction, UsesAbilities } from '@serenity-js/core';
2
- import { Element } from 'webdriverio';
3
- import { WebElementInteraction } from './WebElementInteraction';
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.
8
- *
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
11
- *
12
- * @example <caption>Example widget</caption>
13
- * <form>
14
- * <input type="text" id="field"
15
- * oncontextmenu="showMenu(); return false;" />
16
- *
17
- * <div id="context-menu" style="display:none">
18
- * Custom context menu
19
- * </div>
20
- * </form>
21
- *
22
- * <script>
23
- * function showMenu() {
24
- * document.getElementById("context-menu").style.display = 'block';
25
- * }
26
- * </script>
27
- *
28
- * @example <caption>Lean Page Object describing the widget</caption>
29
- * import { by, Target } from '@serenity-js/webdriverio';
30
- *
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
- * }
37
- *
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';
42
- *
43
- * actorCalled('Chloé')
44
- * .whoCan(BrowseTheWeb.using(browser))
45
- * .attemptsTo(
46
- * RightClick.on(Form.exampleInput),
47
- * Ensure.that(Form.exampleContextMenu, isVisible()),
48
- * );
49
- *
50
- * @see {@link BrowseTheWeb}
51
- * @see {@link Target}
52
- * @see {@link @serenity-js/assertions~Ensure}
53
- * @see {@link isVisible}
54
- *
55
- * @extends {WebElementInteraction}
56
- */
57
- export declare class RightClick extends WebElementInteraction {
58
- private readonly target;
59
- /**
60
- * @desc
61
- * Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
62
- *
63
- * @param {Answerable<Element<'async'>>} target
64
- * The element to be right-clicked on
65
- *
66
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
67
- */
68
- static on(target: Answerable<Element<'async'>>): Interaction;
69
- /**
70
- * @param {Answerable<Element<'async'>>} target
71
- * The element to be right-clicked on
72
- */
73
- constructor(target: Answerable<Element<'async'>>);
74
- /**
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}
87
- */
88
- performAs(actor: UsesAbilities & AnswersQuestions): Promise<void>;
89
- }
@@ -1,100 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RightClick = void 0;
4
- const io_1 = require("@serenity-js/core/lib/io");
5
- const WebElementInteraction_1 = require("./WebElementInteraction");
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.
10
- *
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
13
- *
14
- * @example <caption>Example widget</caption>
15
- * <form>
16
- * <input type="text" id="field"
17
- * oncontextmenu="showMenu(); return false;" />
18
- *
19
- * <div id="context-menu" style="display:none">
20
- * Custom context menu
21
- * </div>
22
- * </form>
23
- *
24
- * <script>
25
- * function showMenu() {
26
- * document.getElementById("context-menu").style.display = 'block';
27
- * }
28
- * </script>
29
- *
30
- * @example <caption>Lean Page Object describing the widget</caption>
31
- * import { by, Target } from '@serenity-js/webdriverio';
32
- *
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
- * }
39
- *
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';
44
- *
45
- * actorCalled('Chloé')
46
- * .whoCan(BrowseTheWeb.using(browser))
47
- * .attemptsTo(
48
- * RightClick.on(Form.exampleInput),
49
- * Ensure.that(Form.exampleContextMenu, isVisible()),
50
- * );
51
- *
52
- * @see {@link BrowseTheWeb}
53
- * @see {@link Target}
54
- * @see {@link @serenity-js/assertions~Ensure}
55
- * @see {@link isVisible}
56
- *
57
- * @extends {WebElementInteraction}
58
- */
59
- class RightClick extends WebElementInteraction_1.WebElementInteraction {
60
- /**
61
- * @param {Answerable<Element<'async'>>} 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}.
71
- *
72
- * @param {Answerable<Element<'async'>>} target
73
- * The element to be right-clicked on
74
- *
75
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
76
- */
77
- static on(target) {
78
- return new RightClick(target);
79
- }
80
- /**
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}
93
- */
94
- async performAs(actor) {
95
- const element = await this.resolve(actor, this.target);
96
- return element.click({ button: 'right' });
97
- }
98
- }
99
- exports.RightClick = RightClick;
100
- //# sourceMappingURL=RightClick.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RightClick.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/RightClick.ts"],"names":[],"mappings":";;;AACA,iDAAqD;AAGrD,mEAAgE;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,MAAa,UAAW,SAAQ,6CAAqB;IAcjD;;;OAGG;IACH,YAA6B,MAAoC;QAC7D,KAAK,CAAC,IAAA,cAAS,EAAC,0BAA2B,MAAO,EAAE,CAAC,CAAC;QAD7B,WAAM,GAAN,MAAM,CAA8B;IAEjE,CAAC;IAnBD;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,CAAC,MAAoC;QAC1C,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,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9C,CAAC;CACJ;AAxCD,gCAwCC"}
@@ -1,75 +0,0 @@
1
- import { Answerable, AnswersQuestions, Interaction, UsesAbilities } from '@serenity-js/core';
2
- import { Element } from 'webdriverio';
3
- import { WebElementInteraction } from './WebElementInteraction';
4
- /**
5
- * @desc
6
- * Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
7
- * scroll until a given Web element comes into view.
8
- *
9
- * @example <caption>Example widget</caption>
10
- * <!--
11
- * an element somewhere at the bottom of the page,
12
- * outside of the visible area
13
- * -->
14
- * <input type="submit" id="submit" />
15
- *
16
- * @example <caption>Lean Page Object describing the widget</caption>
17
- * import { by, Target } from '@serenity-js/webdriverio';
18
- *
19
- * class Form {
20
- * static submitButton = Target.the('submit button')
21
- * .located(by.id('submit'));
22
- * }
23
- *
24
- * @example <caption>Scrolling to element</caption>
25
- * import { actorCalled } from '@serenity-js/core';
26
- * import { Ensure } from '@serenity-js/assertions';
27
- * import { BrowseTheWeb, Scroll, isVisible } from '@serenity-js/webdriverio';
28
- *
29
- * actorCalled('Sara')
30
- * .whoCan(BrowseTheWeb.using(browser))
31
- * .attemptsTo(
32
- * Scroll.to(Form.submitButton),
33
- * Ensure.that(Form.submitButton, isVisible()),
34
- * );
35
- *
36
- * @see {@link BrowseTheWeb}
37
- * @see {@link Target}
38
- * @see {@link isVisible}
39
- * @see {@link @serenity-js/assertions~Ensure}
40
- *
41
- * @extends {@serenity-js/core/lib/screenplay~Interaction}
42
- */
43
- export declare class Scroll extends WebElementInteraction {
44
- private readonly target;
45
- /**
46
- * @desc
47
- * Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
48
- *
49
- * @param {Answerable<Element<'async'>>} target
50
- * The element to be scrolled to
51
- *
52
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
53
- */
54
- static to(target: Answerable<Element<'async'>>): Interaction;
55
- /**
56
- * @param {Answerable<Element<'async'>>} target
57
- * The element to be scrolled to
58
- */
59
- constructor(target: Answerable<Element<'async'>>);
60
- /**
61
- * @desc
62
- * Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
63
- * perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
64
- *
65
- * @param {UsesAbilities & AnswersQuestions} actor
66
- * An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
67
- *
68
- * @returns {PromiseLike<void>}
69
- *
70
- * @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
71
- * @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
72
- * @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
73
- */
74
- performAs(actor: UsesAbilities & AnswersQuestions): Promise<void>;
75
- }
@@ -1,86 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Scroll = void 0;
4
- const io_1 = require("@serenity-js/core/lib/io");
5
- const WebElementInteraction_1 = require("./WebElementInteraction");
6
- /**
7
- * @desc
8
- * Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
9
- * scroll until a given Web element comes into view.
10
- *
11
- * @example <caption>Example widget</caption>
12
- * <!--
13
- * an element somewhere at the bottom of the page,
14
- * outside of the visible area
15
- * -->
16
- * <input type="submit" id="submit" />
17
- *
18
- * @example <caption>Lean Page Object describing the widget</caption>
19
- * import { by, Target } from '@serenity-js/webdriverio';
20
- *
21
- * class Form {
22
- * static submitButton = Target.the('submit button')
23
- * .located(by.id('submit'));
24
- * }
25
- *
26
- * @example <caption>Scrolling to element</caption>
27
- * import { actorCalled } from '@serenity-js/core';
28
- * import { Ensure } from '@serenity-js/assertions';
29
- * import { BrowseTheWeb, Scroll, isVisible } from '@serenity-js/webdriverio';
30
- *
31
- * actorCalled('Sara')
32
- * .whoCan(BrowseTheWeb.using(browser))
33
- * .attemptsTo(
34
- * Scroll.to(Form.submitButton),
35
- * Ensure.that(Form.submitButton, isVisible()),
36
- * );
37
- *
38
- * @see {@link BrowseTheWeb}
39
- * @see {@link Target}
40
- * @see {@link isVisible}
41
- * @see {@link @serenity-js/assertions~Ensure}
42
- *
43
- * @extends {@serenity-js/core/lib/screenplay~Interaction}
44
- */
45
- class Scroll extends WebElementInteraction_1.WebElementInteraction {
46
- /**
47
- * @param {Answerable<Element<'async'>>} target
48
- * The element to be scrolled to
49
- */
50
- constructor(target) {
51
- super((0, io_1.formatted) `#actor scrolls to ${target}`);
52
- this.target = target;
53
- }
54
- /**
55
- * @desc
56
- * Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
57
- *
58
- * @param {Answerable<Element<'async'>>} target
59
- * The element to be scrolled to
60
- *
61
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
62
- */
63
- static to(target) {
64
- return new Scroll(target);
65
- }
66
- /**
67
- * @desc
68
- * Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
69
- * perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
70
- *
71
- * @param {UsesAbilities & AnswersQuestions} actor
72
- * An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
73
- *
74
- * @returns {PromiseLike<void>}
75
- *
76
- * @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
77
- * @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
78
- * @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
79
- */
80
- async performAs(actor) {
81
- const element = await this.resolve(actor, this.target);
82
- return element.scrollIntoView();
83
- }
84
- }
85
- exports.Scroll = Scroll;
86
- //# sourceMappingURL=Scroll.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Scroll.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Scroll.ts"],"names":[],"mappings":";;;AACA,iDAAqD;AAGrD,mEAAgE;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAa,MAAO,SAAQ,6CAAqB;IAe7C;;;OAGG;IACH,YAA6B,MAAoC;QAC7D,KAAK,CAAC,IAAA,cAAS,EAAC,qBAAsB,MAAO,EAAE,CAAC,CAAC;QADxB,WAAM,GAAN,MAAM,CAA8B;IAEjE,CAAC;IAnBD;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,CAAC,MAAoC;QAC1C,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9B,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,cAAc,EAAE,CAAC;IACpC,CAAC;CACJ;AAzCD,wBAyCC"}
@@ -1,143 +0,0 @@
1
- import { Answerable, Duration, Expectation, Interaction } from '@serenity-js/core';
2
- import { WaitBuilder } from './WaitBuilder';
3
- /**
4
- * @desc
5
- * Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
6
- * wait before proceeding either for a set {@link @serenity-js/core/lib/model~Duration}
7
- * or until a given {@link @serenity-js/core/lib/screenplay/questions~Expectation} is met.
8
- *
9
- * Under the hood, `Wait` uses WebdriverIO ["explicit waiting"](https://webdriver.io/docs/autowait/)
10
- * mechanism.
11
- *
12
- * @example <caption>Example widget</caption>
13
- * <!--
14
- * After about 1 second, the text will change from 'Loading...' to 'Ready!'
15
- * -->
16
- * <h1 id="status">Loading...</h1>
17
- * <script>
18
- * (function () {
19
- * setTimeout(function () {
20
- * document.getElementById('status').textContent = 'Ready!'
21
- * }, 1000);
22
- * })();
23
- * </script>
24
- *
25
- * @example <caption>Lean Page Object describing the widget</caption>
26
- * import { by, Target } from '@serenity-js/webdriverio';
27
- *
28
- * class App {
29
- * static status = Target.the('status widget')
30
- * .located(by.id('status'));
31
- * }
32
- *
33
- * @example <caption>Waiting for a set amount of time</caption>
34
- * import { actorCalled, Duration } from '@serenity-js/core';
35
- * import { BrowseTheWeb, Wait } from '@serenity-js/webdriverio';
36
- * import { Ensure, equals } from '@serenity-js/assertions';
37
- *
38
- * actorCalled('Wendy')
39
- * .whoCan(BrowseTheWeb.using(browser))
40
- * .attemptsTo(
41
- * Wait.for(Duration.ofSeconds(1.5)),
42
- * Ensure.that(App.status, equals('Ready!')),
43
- * );
44
- *
45
- * // Please note that while the above implementation works,
46
- * // this approach is inefficient because at best
47
- * // the actor might wait too long and at worst the test
48
- * // might become "flaky" if any external interference
49
- * // (like network glitches, animations taking a bit too long etc.)
50
- * // makes the actor wait not long enough.
51
- *
52
- * @example <caption>Waiting until a condition is met</caption>
53
- * import { actorCalled } from '@serenity-js/core';
54
- * import { BrowseTheWeb, Wait, Text } from '@serenity-js/webdriverio';
55
- * import { equals } from '@serenity-js/assertions';
56
- *
57
- * actorCalled('Wendy')
58
- * .whoCan(BrowseTheWeb.using(browser))
59
- * .attemptsTo(
60
- * Wait.until(Text.of(App.status), equals('Ready!')),
61
- * // app is ready, proceed with the scenario
62
- * );
63
- *
64
- * // Wait.until makes the Actor keep asking a Question,
65
- * // in this case Text.of(App.status), until the answer meets
66
- * // the expectation, or a timeout expires (default: 5s).
67
- * //
68
- * // Please note that both Ensure and Wait can be used with
69
- * // the same expectations, like `equals`.
70
- *
71
- * @example <caption>Changing the default timeout</caption>
72
- * import { actorCalled, Duration } from '@serenity-js/core';
73
- * import { BrowseTheWeb, Wait, Text } from '@serenity-js/webdriverio';
74
- * import { equals } from '@serenity-js/assertions';
75
- *
76
- * actorCalled('Wendy')
77
- * .whoCan(BrowseTheWeb.using(browser))
78
- * .attemptsTo(
79
- * Wait.upTo(Duration.ofSeconds(3))
80
- * .until(Text.of(App.status), equals('Ready!')),
81
- * // app is ready, proceed with the scenario
82
- * );
83
- *
84
- * @see {@link BrowseTheWeb}
85
- * @see {@link Target}
86
- * @see {@link Text}
87
- * @see {@link @serenity-js/assertions~Ensure}
88
- * @see {@link @serenity-js/assertions/lib/expectations~equals}
89
- * @see {@link @serenity-js/core/lib/model~Duration}
90
- *
91
- * @see {@link @serenity-js/core/lib/screenplay~Interaction}
92
- */
93
- export declare class Wait {
94
- /**
95
- * @desc
96
- * Default timeout of 5 seconds used with {@link Wait.until}.
97
- *
98
- * @type {@serenity-js/core~Duration}
99
- */
100
- static readonly Default_Timeout: Duration;
101
- /**
102
- * @desc
103
- * Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
104
- * configured to wait for a set duration.
105
- *
106
- * @param {Answerable<Duration>} duration
107
- * A set duration the {@link @serenity-js/core/lib/screenplay/actor~Actor} should wait for
108
- * before proceeding
109
- *
110
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
111
- */
112
- static for(duration: Answerable<Duration>): Interaction;
113
- /**
114
- * @desc
115
- * Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
116
- * configured to wait until the answer to the question (`actual`) meets the `expectation`,
117
- * or a custom timeout expires.
118
- *
119
- * @param {Duration} duration
120
- * Custom timeout to override {@link Wait.Default_Timeout}
121
- *
122
- * @returns {WaitBuilder}
123
- */
124
- static upTo(duration: Duration): WaitBuilder;
125
- /**
126
- * @desc
127
- * Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
128
- * configured to wait until the answer to the question (`actual`) meets the `expectation`,
129
- * or a {@link Wait.Default_Timeout} expires.
130
- *
131
- * @param {Answerable<Actual>} actual
132
- * A {@link @serenity-js/core/lib/screenplay~Question}
133
- * that the {@link @serenity-js/core/lib/screenplay/actor~Actor}
134
- * will keep asking until the answer meets
135
- * the {@link @serenity-js/core/lib/screenplay/questions~Expectation} provided
136
- *
137
- * @param {@serenity-js/core/lib/screenplay/questions~<any,Actual>} expectation
138
- * An {@link @serenity-js/core/lib/screenplay/questions~Expectation} to be met before proceeding
139
- *
140
- * @returns {@serenity-js/core/lib/screenplay~Interaction}
141
- */
142
- static until<Actual>(actual: Answerable<Actual>, expectation: Expectation<any, Actual>): Interaction;
143
- }