@serenity-js/web 3.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/LICENSE.md +201 -0
  3. package/NOTICE.md +1 -0
  4. package/README.md +21 -0
  5. package/lib/errors/CookieMissingError.d.ts +4 -0
  6. package/lib/errors/CookieMissingError.js +11 -0
  7. package/lib/errors/CookieMissingError.js.map +1 -0
  8. package/lib/errors/index.d.ts +1 -0
  9. package/lib/errors/index.js +14 -0
  10. package/lib/errors/index.js.map +1 -0
  11. package/lib/expectations/ElementExpectation.d.ts +11 -0
  12. package/lib/expectations/ElementExpectation.js +27 -0
  13. package/lib/expectations/ElementExpectation.js.map +1 -0
  14. package/lib/expectations/index.d.ts +6 -0
  15. package/lib/expectations/index.js +19 -0
  16. package/lib/expectations/index.js.map +1 -0
  17. package/lib/expectations/isActive.d.ts +15 -0
  18. package/lib/expectations/isActive.js +22 -0
  19. package/lib/expectations/isActive.js.map +1 -0
  20. package/lib/expectations/isClickable.d.ts +20 -0
  21. package/lib/expectations/isClickable.js +30 -0
  22. package/lib/expectations/isClickable.js.map +1 -0
  23. package/lib/expectations/isEnabled.d.ts +14 -0
  24. package/lib/expectations/isEnabled.js +20 -0
  25. package/lib/expectations/isEnabled.js.map +1 -0
  26. package/lib/expectations/isPresent.d.ts +15 -0
  27. package/lib/expectations/isPresent.js +22 -0
  28. package/lib/expectations/isPresent.js.map +1 -0
  29. package/lib/expectations/isSelected.d.ts +14 -0
  30. package/lib/expectations/isSelected.js +23 -0
  31. package/lib/expectations/isSelected.js.map +1 -0
  32. package/lib/expectations/isVisible.d.ts +14 -0
  33. package/lib/expectations/isVisible.js +26 -0
  34. package/lib/expectations/isVisible.js.map +1 -0
  35. package/lib/index.d.ts +5 -0
  36. package/lib/index.js +18 -0
  37. package/lib/index.js.map +1 -0
  38. package/lib/input/Key.d.ts +73 -0
  39. package/lib/input/Key.js +84 -0
  40. package/lib/input/Key.js.map +1 -0
  41. package/lib/input/index.d.ts +1 -0
  42. package/lib/input/index.js +14 -0
  43. package/lib/input/index.js.map +1 -0
  44. package/lib/screenplay/abilities/BrowseTheWeb.d.ts +58 -0
  45. package/lib/screenplay/abilities/BrowseTheWeb.js +19 -0
  46. package/lib/screenplay/abilities/BrowseTheWeb.js.map +1 -0
  47. package/lib/screenplay/abilities/BrowserCapabilities.d.ts +5 -0
  48. package/lib/screenplay/abilities/BrowserCapabilities.js +3 -0
  49. package/lib/screenplay/abilities/BrowserCapabilities.js.map +1 -0
  50. package/lib/screenplay/abilities/index.d.ts +2 -0
  51. package/lib/screenplay/abilities/index.js +15 -0
  52. package/lib/screenplay/abilities/index.js.map +1 -0
  53. package/lib/screenplay/index.d.ts +4 -0
  54. package/lib/screenplay/index.js +17 -0
  55. package/lib/screenplay/index.js.map +1 -0
  56. package/lib/screenplay/interactions/Clear.d.ts +79 -0
  57. package/lib/screenplay/interactions/Clear.js +97 -0
  58. package/lib/screenplay/interactions/Clear.js.map +1 -0
  59. package/lib/screenplay/interactions/Click.d.ts +73 -0
  60. package/lib/screenplay/interactions/Click.js +85 -0
  61. package/lib/screenplay/interactions/Click.js.map +1 -0
  62. package/lib/screenplay/interactions/DoubleClick.d.ts +90 -0
  63. package/lib/screenplay/interactions/DoubleClick.js +101 -0
  64. package/lib/screenplay/interactions/DoubleClick.js.map +1 -0
  65. package/lib/screenplay/interactions/Enter.d.ts +73 -0
  66. package/lib/screenplay/interactions/Enter.js +86 -0
  67. package/lib/screenplay/interactions/Enter.js.map +1 -0
  68. package/lib/screenplay/interactions/EnterBuilder.d.ts +25 -0
  69. package/lib/screenplay/interactions/EnterBuilder.js +3 -0
  70. package/lib/screenplay/interactions/EnterBuilder.js.map +1 -0
  71. package/lib/screenplay/interactions/ExecuteScript.d.ts +206 -0
  72. package/lib/screenplay/interactions/ExecuteScript.js +312 -0
  73. package/lib/screenplay/interactions/ExecuteScript.js.map +1 -0
  74. package/lib/screenplay/interactions/Hover.d.ts +78 -0
  75. package/lib/screenplay/interactions/Hover.js +89 -0
  76. package/lib/screenplay/interactions/Hover.js.map +1 -0
  77. package/lib/screenplay/interactions/Navigate.d.ts +142 -0
  78. package/lib/screenplay/interactions/Navigate.js +198 -0
  79. package/lib/screenplay/interactions/Navigate.js.map +1 -0
  80. package/lib/screenplay/interactions/PageElementInteraction.d.ts +39 -0
  81. package/lib/screenplay/interactions/PageElementInteraction.js +54 -0
  82. package/lib/screenplay/interactions/PageElementInteraction.js.map +1 -0
  83. package/lib/screenplay/interactions/Press.d.ts +84 -0
  84. package/lib/screenplay/interactions/Press.js +171 -0
  85. package/lib/screenplay/interactions/Press.js.map +1 -0
  86. package/lib/screenplay/interactions/PressBuilder.d.ts +26 -0
  87. package/lib/screenplay/interactions/PressBuilder.js +3 -0
  88. package/lib/screenplay/interactions/PressBuilder.js.map +1 -0
  89. package/lib/screenplay/interactions/RightClick.d.ts +89 -0
  90. package/lib/screenplay/interactions/RightClick.js +100 -0
  91. package/lib/screenplay/interactions/RightClick.js.map +1 -0
  92. package/lib/screenplay/interactions/Scroll.d.ts +83 -0
  93. package/lib/screenplay/interactions/Scroll.js +97 -0
  94. package/lib/screenplay/interactions/Scroll.js.map +1 -0
  95. package/lib/screenplay/interactions/Select.d.ts +212 -0
  96. package/lib/screenplay/interactions/Select.js +291 -0
  97. package/lib/screenplay/interactions/Select.js.map +1 -0
  98. package/lib/screenplay/interactions/SelectBuilder.d.ts +33 -0
  99. package/lib/screenplay/interactions/SelectBuilder.js +3 -0
  100. package/lib/screenplay/interactions/SelectBuilder.js.map +1 -0
  101. package/lib/screenplay/interactions/Switch.d.ts +150 -0
  102. package/lib/screenplay/interactions/Switch.js +209 -0
  103. package/lib/screenplay/interactions/Switch.js.map +1 -0
  104. package/lib/screenplay/interactions/TakeScreenshot.d.ts +67 -0
  105. package/lib/screenplay/interactions/TakeScreenshot.js +86 -0
  106. package/lib/screenplay/interactions/TakeScreenshot.js.map +1 -0
  107. package/lib/screenplay/interactions/Wait.d.ts +143 -0
  108. package/lib/screenplay/interactions/Wait.js +242 -0
  109. package/lib/screenplay/interactions/Wait.js.map +1 -0
  110. package/lib/screenplay/interactions/WaitBuilder.d.ts +32 -0
  111. package/lib/screenplay/interactions/WaitBuilder.js +3 -0
  112. package/lib/screenplay/interactions/WaitBuilder.js.map +1 -0
  113. package/lib/screenplay/interactions/index.d.ts +16 -0
  114. package/lib/screenplay/interactions/index.js +29 -0
  115. package/lib/screenplay/interactions/index.js.map +1 -0
  116. package/lib/screenplay/models/Cookie.d.ts +117 -0
  117. package/lib/screenplay/models/Cookie.js +176 -0
  118. package/lib/screenplay/models/Cookie.js.map +1 -0
  119. package/lib/screenplay/models/CookieData.d.ts +89 -0
  120. package/lib/screenplay/models/CookieData.js +3 -0
  121. package/lib/screenplay/models/CookieData.js.map +1 -0
  122. package/lib/screenplay/models/ModalDialog.d.ts +9 -0
  123. package/lib/screenplay/models/ModalDialog.js +14 -0
  124. package/lib/screenplay/models/ModalDialog.js.map +1 -0
  125. package/lib/screenplay/models/Page.d.ts +83 -0
  126. package/lib/screenplay/models/Page.js +52 -0
  127. package/lib/screenplay/models/Page.js.map +1 -0
  128. package/lib/screenplay/models/PageElement.d.ts +30 -0
  129. package/lib/screenplay/models/PageElement.js +62 -0
  130. package/lib/screenplay/models/PageElement.js.map +1 -0
  131. package/lib/screenplay/models/PageElements.d.ts +20 -0
  132. package/lib/screenplay/models/PageElements.js +49 -0
  133. package/lib/screenplay/models/PageElements.js.map +1 -0
  134. package/lib/screenplay/models/index.d.ts +6 -0
  135. package/lib/screenplay/models/index.js +19 -0
  136. package/lib/screenplay/models/index.js.map +1 -0
  137. package/lib/screenplay/questions/Attribute.d.ts +83 -0
  138. package/lib/screenplay/questions/Attribute.js +103 -0
  139. package/lib/screenplay/questions/Attribute.js.map +1 -0
  140. package/lib/screenplay/questions/CssClasses.d.ts +93 -0
  141. package/lib/screenplay/questions/CssClasses.js +113 -0
  142. package/lib/screenplay/questions/CssClasses.js.map +1 -0
  143. package/lib/screenplay/questions/ElementQuestion.d.ts +34 -0
  144. package/lib/screenplay/questions/ElementQuestion.js +53 -0
  145. package/lib/screenplay/questions/ElementQuestion.js.map +1 -0
  146. package/lib/screenplay/questions/LastScriptExecution.d.ts +14 -0
  147. package/lib/screenplay/questions/LastScriptExecution.js +22 -0
  148. package/lib/screenplay/questions/LastScriptExecution.js.map +1 -0
  149. package/lib/screenplay/questions/Selected.d.ts +185 -0
  150. package/lib/screenplay/questions/Selected.js +210 -0
  151. package/lib/screenplay/questions/Selected.js.map +1 -0
  152. package/lib/screenplay/questions/Text.d.ts +99 -0
  153. package/lib/screenplay/questions/Text.js +131 -0
  154. package/lib/screenplay/questions/Text.js.map +1 -0
  155. package/lib/screenplay/questions/Value.d.ts +64 -0
  156. package/lib/screenplay/questions/Value.js +78 -0
  157. package/lib/screenplay/questions/Value.js.map +1 -0
  158. package/lib/screenplay/questions/index.d.ts +6 -0
  159. package/lib/screenplay/questions/index.js +19 -0
  160. package/lib/screenplay/questions/index.js.map +1 -0
  161. package/lib/stage/crew/index.d.ts +1 -0
  162. package/lib/stage/crew/index.js +14 -0
  163. package/lib/stage/crew/index.js.map +1 -0
  164. package/lib/stage/crew/photographer/Photographer.d.ts +83 -0
  165. package/lib/stage/crew/photographer/Photographer.js +102 -0
  166. package/lib/stage/crew/photographer/Photographer.js.map +1 -0
  167. package/lib/stage/crew/photographer/index.d.ts +2 -0
  168. package/lib/stage/crew/photographer/index.js +15 -0
  169. package/lib/stage/crew/photographer/index.js.map +1 -0
  170. package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.d.ts +28 -0
  171. package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js +81 -0
  172. package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js.map +1 -0
  173. package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.d.ts +18 -0
  174. package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js +30 -0
  175. package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js.map +1 -0
  176. package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.d.ts +17 -0
  177. package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js +28 -0
  178. package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js.map +1 -0
  179. package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.d.ts +19 -0
  180. package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js +28 -0
  181. package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js.map +1 -0
  182. package/lib/stage/crew/photographer/strategies/index.d.ts +4 -0
  183. package/lib/stage/crew/photographer/strategies/index.js +17 -0
  184. package/lib/stage/crew/photographer/strategies/index.js.map +1 -0
  185. package/lib/stage/index.d.ts +1 -0
  186. package/lib/stage/index.js +14 -0
  187. package/lib/stage/index.js.map +1 -0
  188. package/package.json +85 -0
  189. package/src/errors/CookieMissingError.ts +7 -0
  190. package/src/errors/index.ts +1 -0
  191. package/src/expectations/ElementExpectation.ts +32 -0
  192. package/src/expectations/index.ts +6 -0
  193. package/src/expectations/isActive.ts +22 -0
  194. package/src/expectations/isClickable.ts +32 -0
  195. package/src/expectations/isEnabled.ts +19 -0
  196. package/src/expectations/isPresent.ts +21 -0
  197. package/src/expectations/isSelected.ts +24 -0
  198. package/src/expectations/isVisible.ts +28 -0
  199. package/src/index.ts +5 -0
  200. package/src/input/Key.ts +83 -0
  201. package/src/input/index.ts +1 -0
  202. package/src/screenplay/abilities/BrowseTheWeb.ts +89 -0
  203. package/src/screenplay/abilities/BrowserCapabilities.ts +5 -0
  204. package/src/screenplay/abilities/index.ts +2 -0
  205. package/src/screenplay/index.ts +4 -0
  206. package/src/screenplay/interactions/Clear.ts +102 -0
  207. package/src/screenplay/interactions/Click.ts +86 -0
  208. package/src/screenplay/interactions/DoubleClick.ts +102 -0
  209. package/src/screenplay/interactions/Enter.ts +92 -0
  210. package/src/screenplay/interactions/EnterBuilder.ts +28 -0
  211. package/src/screenplay/interactions/ExecuteScript.ts +345 -0
  212. package/src/screenplay/interactions/Hover.ts +90 -0
  213. package/src/screenplay/interactions/Navigate.ts +209 -0
  214. package/src/screenplay/interactions/PageElementInteraction.ts +59 -0
  215. package/src/screenplay/interactions/Press.ts +194 -0
  216. package/src/screenplay/interactions/PressBuilder.ts +29 -0
  217. package/src/screenplay/interactions/RightClick.ts +100 -0
  218. package/src/screenplay/interactions/Scroll.ts +99 -0
  219. package/src/screenplay/interactions/Select.ts +317 -0
  220. package/src/screenplay/interactions/SelectBuilder.ts +36 -0
  221. package/src/screenplay/interactions/Switch.ts +225 -0
  222. package/src/screenplay/interactions/TakeScreenshot.ts +89 -0
  223. package/src/screenplay/interactions/Wait.ts +264 -0
  224. package/src/screenplay/interactions/WaitBuilder.ts +34 -0
  225. package/src/screenplay/interactions/index.ts +16 -0
  226. package/src/screenplay/models/Cookie.ts +219 -0
  227. package/src/screenplay/models/CookieData.ts +97 -0
  228. package/src/screenplay/models/ModalDialog.ts +19 -0
  229. package/src/screenplay/models/Page.ts +147 -0
  230. package/src/screenplay/models/PageElement.ts +95 -0
  231. package/src/screenplay/models/PageElements.ts +70 -0
  232. package/src/screenplay/models/index.ts +6 -0
  233. package/src/screenplay/questions/Attribute.ts +112 -0
  234. package/src/screenplay/questions/CssClasses.ts +118 -0
  235. package/src/screenplay/questions/ElementQuestion.ts +60 -0
  236. package/src/screenplay/questions/LastScriptExecution.ts +21 -0
  237. package/src/screenplay/questions/Selected.ts +212 -0
  238. package/src/screenplay/questions/Text.ts +153 -0
  239. package/src/screenplay/questions/Value.ts +82 -0
  240. package/src/screenplay/questions/index.ts +6 -0
  241. package/src/stage/crew/index.ts +1 -0
  242. package/src/stage/crew/photographer/Photographer.ts +108 -0
  243. package/src/stage/crew/photographer/index.ts +2 -0
  244. package/src/stage/crew/photographer/strategies/PhotoTakingStrategy.ts +116 -0
  245. package/src/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.ts +28 -0
  246. package/src/stage/crew/photographer/strategies/TakePhotosOfFailures.ts +26 -0
  247. package/src/stage/crew/photographer/strategies/TakePhotosOfInteractions.ts +26 -0
  248. package/src/stage/crew/photographer/strategies/index.ts +4 -0
  249. package/src/stage/index.ts +1 -0
  250. package/tsconfig.eslint.json +10 -0
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Attribute = void 0;
4
+ const core_1 = require("@serenity-js/core");
5
+ const models_1 = require("../models");
6
+ const ElementQuestion_1 = require("./ElementQuestion");
7
+ /**
8
+ * @desc
9
+ * Returns the value of the given HTML attribute of a given {@link WebElement},
10
+ * represented by Answerable<{@link @wdio/types~Element}>
11
+ *
12
+ * @example <caption>Example widget</caption>
13
+ * <ul id="shopping-list" data-items-left="2">
14
+ * <li data-state="bought">Coffee<li>
15
+ * <li data-state="buy">Honey<li>
16
+ * <li data-state="buy">Chocolate<li>
17
+ * </ul>
18
+ *
19
+ * @example <caption>Retrieve a HTML attribute of a given WebElement</caption>
20
+ * import { actorCalled } from '@serenity-js/core';
21
+ * import { Ensure, equals } from '@serenity-js/assertions';
22
+ * import { Attribute, by, BrowseTheWeb, Target } from '@serenity-js/webdriverio';
23
+ *
24
+ * const shoppingList = () =>
25
+ * Target.the('shopping list').located(by.id('shopping-list'))
26
+ *
27
+ * actorCalled('Lisa')
28
+ * .whoCan(BrowseTheWeb.using(browser))
29
+ * .attemptsTo(
30
+ * Ensure.that(Attribute.called('data-items-left').of(shoppingList()), equals('2')),
31
+ * )
32
+ *
33
+ * @example <caption>Find WebElements with a given attribute</caption>
34
+ * import { actorCalled } from '@serenity-js/core';
35
+ * import { Ensure, includes } from '@serenity-js/assertions';
36
+ * import { Attribute, BrowseTheWeb, by, Target } from '@serenity-js/webdriverio';
37
+ *
38
+ * class ShoppingList {
39
+ * static items = () =>
40
+ * Target.all('items')
41
+ * .located(by.css('#shopping-list li'))
42
+ *
43
+ * static outstandingItems = () =>
44
+ * ShoppingList.items
45
+ * .where(Attribute.called('data-state'), includes('buy'))
46
+ * }
47
+ *
48
+ * actorCalled('Lisa')
49
+ * .whoCan(BrowseTheWeb.using(browser))
50
+ * .attemptsTo(
51
+ * Ensure.that(
52
+ * Text.ofAll(ShoppingList.outstandingItems()),
53
+ * equals([ 'Honey', 'Chocolate' ])
54
+ * ),
55
+ * )
56
+ *
57
+ * @extends {ElementQuestion}
58
+ * @implements {@serenity-js/core/lib/screenplay/questions~MetaQuestion}
59
+ */
60
+ class Attribute extends ElementQuestion_1.ElementQuestion {
61
+ /**
62
+ * @param {Answerable<string>} name
63
+ * @param {@serenity-js/core/lib/screenplay~Answerable<Element>} [element]
64
+ */
65
+ constructor(name, element) {
66
+ super(`"${name}" attribute of ${element}`);
67
+ this.name = name;
68
+ this.element = element;
69
+ }
70
+ /**
71
+ * @param {Answerable<string>} name
72
+ * @returns {Attribute}
73
+ */
74
+ static called(name) {
75
+ return new Attribute(name);
76
+ }
77
+ /**
78
+ * @desc
79
+ * Resolves to the value of a HTML attribute of the `target` element,
80
+ * located in the context of a `parent` element.
81
+ *
82
+ * @param {Answerable<PageElement>} parent
83
+ * @returns {Question<Promise<string[]>>}
84
+ *
85
+ * @see {@link Target.all}
86
+ * @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
87
+ */
88
+ of(parent) {
89
+ return new Attribute(this.name, this.element
90
+ ? models_1.PageElement.of(this.element, parent)
91
+ : parent);
92
+ }
93
+ async answeredBy(actor) {
94
+ if (!this.element) {
95
+ throw new core_1.LogicError(`Target not specified`); // todo: better error message?
96
+ }
97
+ const element = await actor.answer(this.element);
98
+ const name = await actor.answer(this.name);
99
+ return element.attribute(name);
100
+ }
101
+ }
102
+ exports.Attribute = Attribute;
103
+ //# sourceMappingURL=Attribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Attribute.js","sourceRoot":"","sources":["../../../src/screenplay/questions/Attribute.ts"],"names":[],"mappings":";;;AAAA,4CAAoH;AAEpH,sCAAwC;AACxC,uDAAoD;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,MAAa,SACT,SAAQ,iCAAgC;IAWxC;;;OAGG;IACH,YACqB,IAAwB,EACxB,OAAiC;QAElD,KAAK,CAAC,IAAK,IAAK,kBAAmB,OAAQ,EAAE,CAAC,CAAC;QAH9B,SAAI,GAAJ,IAAI,CAAoB;QACxB,YAAO,GAAP,OAAO,CAA0B;IAGtD,CAAC;IAjBD;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,IAAwB;QAClC,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAaD;;;;;;;;;;OAUG;IACH,EAAE,CAAC,MAA+B;QAC9B,OAAO,IAAI,SAAS,CAChB,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO;YACR,CAAC,CAAC,oBAAW,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;YACtC,CAAC,CAAC,MAAM,CACf,CAAC;IACN,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,KAAuC;QACpD,IAAI,CAAE,IAAI,CAAC,OAAO,EAAE;YAChB,MAAM,IAAI,iBAAU,CAAC,sBAAsB,CAAC,CAAC,CAAG,8BAA8B;SACjF;QAED,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjD,MAAM,IAAI,GAAM,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9C,OAAO,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;CACJ;AArDD,8BAqDC"}
@@ -0,0 +1,93 @@
1
+ import { Answerable, AnswersQuestions, MetaQuestion, Question, UsesAbilities } from '@serenity-js/core';
2
+ import { PageElement } from '../models';
3
+ import { ElementQuestion } from './ElementQuestion';
4
+ /**
5
+ * @desc
6
+ * Resolves to an array of [CSS classes](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#attr-class)
7
+ * of a given {@link WebElement}, represented by Answerable<{@link @wdio/types~Element}>.
8
+ *
9
+ * @example <caption>Example widget</caption>
10
+ * <ul id="shopping-list" class="active favourite">
11
+ * <li class="bought">Coffee<li>
12
+ * <li class="buy">Honey<li>
13
+ * <li class="buy">Chocolate<li>
14
+ * </ul>
15
+ *
16
+ * @example <caption>Retrieve CSS classes of a given WebElement</caption>
17
+ * import { actorCalled } from '@serenity-js/core';
18
+ * import { Ensure, equals } from '@serenity-js/assertions';
19
+ * import { BrowseTheWeb, by, CssClasses, Target } from '@serenity-js/webdriverio';
20
+ *
21
+ * const shoppingList = () =>
22
+ * Target.the('shopping list').located(by.id('shopping-list'))
23
+ *
24
+ * actorCalled('Lisa')
25
+ * .whoCan(BrowseTheWeb.using(browser))
26
+ * .attemptsTo(
27
+ * Ensure.that(CssClasses.of(shoppingList()), equals([ 'active', 'favourite' ])),
28
+ * )
29
+ *
30
+ * @example <caption>Find WebElements with a given class</caption>
31
+ * import { actorCalled } from '@serenity-js/core';
32
+ * import { Ensure, contain } from '@serenity-js/assertions';
33
+ * import { BrowseTheWeb, by, CssClasses, Target } from '@serenity-js/webdriverio';
34
+ *
35
+ * class ShoppingList {
36
+ * static items = () =>
37
+ * Target.all('items')
38
+ * .located(by.css('#shopping-list li'))
39
+ *
40
+ * static outstandingItems = () =>
41
+ * ShoppingList.items
42
+ * .where(CssClasses, contain('buy'))
43
+ * }
44
+ *
45
+ * actorCalled('Lisa')
46
+ * .whoCan(BrowseTheWeb.using(browser))
47
+ * .attemptsTo(
48
+ * Ensure.that(
49
+ * Text.ofAll(ShoppingList.outstandingItems()),
50
+ * equals([ 'Honey', 'Chocolate' ])
51
+ * ),
52
+ * )
53
+ *
54
+ * @extends {ElementQuestion}
55
+ * @implements {@serenity-js/core/lib/screenplay/questions~MetaQuestion}
56
+ */
57
+ export declare class CssClasses extends ElementQuestion<Promise<string[]>> implements MetaQuestion<Answerable<PageElement>, Promise<string[]>> {
58
+ private readonly target;
59
+ /**
60
+ * @param {Question<PageElement> | PageElement} target
61
+ * @returns {CssClasses}
62
+ */
63
+ static of(target: Answerable<PageElement>): CssClasses;
64
+ /**
65
+ * @param {Question<PageElement> | PageElement} target
66
+ */
67
+ constructor(target: Answerable<PageElement>);
68
+ /**
69
+ * @desc
70
+ * Resolves to an array of CSS classes of the `target` element,
71
+ * located in the context of a `parent` element.
72
+ *
73
+ * @param {@serenity-js/core/lib/screenplay~Answerable<Element>} parent
74
+ * @returns {Question<Promise<string[]>>}
75
+ *
76
+ * @see {@link Target.all}
77
+ * @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
78
+ */
79
+ of(parent: Answerable<PageElement>): Question<Promise<string[]>>;
80
+ /**
81
+ * @desc
82
+ * Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
83
+ * answer this {@link @serenity-js/core/lib/screenplay~Question}.
84
+ *
85
+ * @param {AnswersQuestions & UsesAbilities} actor
86
+ * @returns {Promise<void>}
87
+ *
88
+ * @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
89
+ * @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
90
+ * @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
91
+ */
92
+ answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<string[]>;
93
+ }
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CssClasses = void 0;
4
+ const io_1 = require("@serenity-js/core/lib/io");
5
+ const models_1 = require("../models");
6
+ const ElementQuestion_1 = require("./ElementQuestion");
7
+ /**
8
+ * @desc
9
+ * Resolves to an array of [CSS classes](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#attr-class)
10
+ * of a given {@link WebElement}, represented by Answerable<{@link @wdio/types~Element}>.
11
+ *
12
+ * @example <caption>Example widget</caption>
13
+ * <ul id="shopping-list" class="active favourite">
14
+ * <li class="bought">Coffee<li>
15
+ * <li class="buy">Honey<li>
16
+ * <li class="buy">Chocolate<li>
17
+ * </ul>
18
+ *
19
+ * @example <caption>Retrieve CSS classes of a given WebElement</caption>
20
+ * import { actorCalled } from '@serenity-js/core';
21
+ * import { Ensure, equals } from '@serenity-js/assertions';
22
+ * import { BrowseTheWeb, by, CssClasses, Target } from '@serenity-js/webdriverio';
23
+ *
24
+ * const shoppingList = () =>
25
+ * Target.the('shopping list').located(by.id('shopping-list'))
26
+ *
27
+ * actorCalled('Lisa')
28
+ * .whoCan(BrowseTheWeb.using(browser))
29
+ * .attemptsTo(
30
+ * Ensure.that(CssClasses.of(shoppingList()), equals([ 'active', 'favourite' ])),
31
+ * )
32
+ *
33
+ * @example <caption>Find WebElements with a given class</caption>
34
+ * import { actorCalled } from '@serenity-js/core';
35
+ * import { Ensure, contain } from '@serenity-js/assertions';
36
+ * import { BrowseTheWeb, by, CssClasses, Target } from '@serenity-js/webdriverio';
37
+ *
38
+ * class ShoppingList {
39
+ * static items = () =>
40
+ * Target.all('items')
41
+ * .located(by.css('#shopping-list li'))
42
+ *
43
+ * static outstandingItems = () =>
44
+ * ShoppingList.items
45
+ * .where(CssClasses, contain('buy'))
46
+ * }
47
+ *
48
+ * actorCalled('Lisa')
49
+ * .whoCan(BrowseTheWeb.using(browser))
50
+ * .attemptsTo(
51
+ * Ensure.that(
52
+ * Text.ofAll(ShoppingList.outstandingItems()),
53
+ * equals([ 'Honey', 'Chocolate' ])
54
+ * ),
55
+ * )
56
+ *
57
+ * @extends {ElementQuestion}
58
+ * @implements {@serenity-js/core/lib/screenplay/questions~MetaQuestion}
59
+ */
60
+ class CssClasses extends ElementQuestion_1.ElementQuestion {
61
+ /**
62
+ * @param {Question<PageElement> | PageElement} target
63
+ */
64
+ constructor(target) {
65
+ super((0, io_1.formatted) `CSS classes of ${target}`);
66
+ this.target = target;
67
+ }
68
+ /**
69
+ * @param {Question<PageElement> | PageElement} target
70
+ * @returns {CssClasses}
71
+ */
72
+ static of(target) {
73
+ return new CssClasses(target);
74
+ }
75
+ /**
76
+ * @desc
77
+ * Resolves to an array of CSS classes of the `target` element,
78
+ * located in the context of a `parent` element.
79
+ *
80
+ * @param {@serenity-js/core/lib/screenplay~Answerable<Element>} parent
81
+ * @returns {Question<Promise<string[]>>}
82
+ *
83
+ * @see {@link Target.all}
84
+ * @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
85
+ */
86
+ of(parent) {
87
+ return new CssClasses(models_1.PageElement.of(this.target, parent));
88
+ }
89
+ /**
90
+ * @desc
91
+ * Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
92
+ * answer this {@link @serenity-js/core/lib/screenplay~Question}.
93
+ *
94
+ * @param {AnswersQuestions & UsesAbilities} actor
95
+ * @returns {Promise<void>}
96
+ *
97
+ * @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
98
+ * @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
99
+ * @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
100
+ */
101
+ async answeredBy(actor) {
102
+ const element = await this.resolve(actor, this.target);
103
+ return element.attribute('class')
104
+ .then(attribute => attribute !== null && attribute !== void 0 ? attribute : '')
105
+ .then(attribute => attribute
106
+ .replace(/\s+/, ' ')
107
+ .trim()
108
+ .split(' ')
109
+ .filter(cssClass => !!cssClass));
110
+ }
111
+ }
112
+ exports.CssClasses = CssClasses;
113
+ //# sourceMappingURL=CssClasses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CssClasses.js","sourceRoot":"","sources":["../../../src/screenplay/questions/CssClasses.ts"],"names":[],"mappings":";;;AACA,iDAAqD;AAErD,sCAAwC;AACxC,uDAAoD;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,MAAa,UACT,SAAQ,iCAAkC;IAW1C;;OAEG;IACH,YAA6B,MAA+B;QACxD,KAAK,CAAC,IAAA,cAAS,EAAC,kBAAmB,MAAM,EAAE,CAAC,CAAC;QADpB,WAAM,GAAN,MAAM,CAAyB;IAE5D,CAAC;IAbD;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,MAA+B;QACrC,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IASD;;;;;;;;;;OAUG;IACH,EAAE,CAAC,MAA+B;QAC9B,OAAO,IAAI,UAAU,CAAC,oBAAW,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,UAAU,CAAC,KAAuC;QACpD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAEvD,OAAO,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC;aAC5B,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC;aAClC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS;aACvB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;aACnB,IAAI,EAAE;aACN,KAAK,CAAC,GAAG,CAAC;aACV,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAE,QAAQ,CAAC,CACnC,CAAC;IACV,CAAC;CACJ;AA1DD,gCA0DC"}
@@ -0,0 +1,34 @@
1
+ import { Answerable, AnswersQuestions, Question } from '@serenity-js/core';
2
+ import { PageElement, PageElements } from '../models';
3
+ /**
4
+ * @desc
5
+ * A base class for questions about {@link PageElement}s.
6
+ *
7
+ * @extends {@serenity-js/core/lib/screenplay~Question}
8
+ */
9
+ export declare abstract class ElementQuestion<T> extends Question<T> {
10
+ protected subject: string;
11
+ constructor(subject: string);
12
+ /**
13
+ * @desc
14
+ * Changes the description of this question's subject.
15
+ *
16
+ * @param {string} subject
17
+ * @returns {Question<T>}
18
+ */
19
+ describedAs(subject: string): this;
20
+ toString(): string;
21
+ /**
22
+ * @desc
23
+ * Returns the resolved {@link PageElement}, or throws a {@link @serenity-js/core/lib/errors~LogicError}
24
+ * if the element is `undefined`.
25
+ *
26
+ * @param {@serenity-js/core/lib/screenplay/actor~AnswersQuestions} actor
27
+ * @param {@serenity-js/core/lib/screenplay~Answerable<Element|ElementList>} element
28
+ *
29
+ * @returns {Promise<PageElement|PageElements>}
30
+ *
31
+ * @protected
32
+ */
33
+ protected resolve<T = PageElement | PageElements>(actor: AnswersQuestions, element: Answerable<T>): Promise<T>;
34
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ElementQuestion = void 0;
4
+ const core_1 = require("@serenity-js/core");
5
+ const io_1 = require("@serenity-js/core/lib/io");
6
+ /**
7
+ * @desc
8
+ * A base class for questions about {@link PageElement}s.
9
+ *
10
+ * @extends {@serenity-js/core/lib/screenplay~Question}
11
+ */
12
+ // todo: remove
13
+ class ElementQuestion extends core_1.Question {
14
+ constructor(subject) {
15
+ super();
16
+ this.subject = subject;
17
+ }
18
+ /**
19
+ * @desc
20
+ * Changes the description of this question's subject.
21
+ *
22
+ * @param {string} subject
23
+ * @returns {Question<T>}
24
+ */
25
+ describedAs(subject) {
26
+ this.subject = subject;
27
+ return this;
28
+ }
29
+ toString() {
30
+ return this.subject;
31
+ }
32
+ /**
33
+ * @desc
34
+ * Returns the resolved {@link PageElement}, or throws a {@link @serenity-js/core/lib/errors~LogicError}
35
+ * if the element is `undefined`.
36
+ *
37
+ * @param {@serenity-js/core/lib/screenplay/actor~AnswersQuestions} actor
38
+ * @param {@serenity-js/core/lib/screenplay~Answerable<Element|ElementList>} element
39
+ *
40
+ * @returns {Promise<PageElement|PageElements>}
41
+ *
42
+ * @protected
43
+ */
44
+ async resolve(actor, element) {
45
+ const resolved = await actor.answer(element);
46
+ if (!resolved) {
47
+ throw new core_1.LogicError((0, io_1.formatted) `Couldn't find ${element}`);
48
+ }
49
+ return resolved;
50
+ }
51
+ }
52
+ exports.ElementQuestion = ElementQuestion;
53
+ //# sourceMappingURL=ElementQuestion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ElementQuestion.js","sourceRoot":"","sources":["../../../src/screenplay/questions/ElementQuestion.ts"],"names":[],"mappings":";;;AAAA,4CAAuF;AACvF,iDAAqD;AAIrD;;;;;GAKG;AACH,eAAe;AACf,MAAsB,eAClB,SAAQ,eAAW;IAEnB,YAAsB,OAAe;QACjC,KAAK,EAAE,CAAC;QADU,YAAO,GAAP,OAAO,CAAQ;IAErC,CAAC;IAED;;;;;;OAMG;IACH,WAAW,CAAC,OAAe;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;;;;;;;;OAWG;IACO,KAAK,CAAC,OAAO,CACnB,KAAuB,EACvB,OAAsB;QAEtB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAE7C,IAAI,CAAE,QAAQ,EAAE;YACZ,MAAM,IAAI,iBAAU,CAAC,IAAA,cAAS,EAAC,iBAAkB,OAAQ,EAAE,CAAC,CAAC;SAChE;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AA/CD,0CA+CC"}
@@ -0,0 +1,14 @@
1
+ import { Question } from '@serenity-js/core';
2
+ /**
3
+ * @desc
4
+ * Returns the result of last script executed via {@link ExecuteScript}
5
+ */
6
+ export declare class LastScriptExecution {
7
+ /**
8
+ * @desc
9
+ * Enables asserting on the result of a function executed via {@link ExecuteScript}.
10
+ *
11
+ * @returns {Question<R>}
12
+ */
13
+ static result<R>(): Question<R>;
14
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LastScriptExecution = void 0;
4
+ const core_1 = require("@serenity-js/core");
5
+ const abilities_1 = require("../abilities");
6
+ /**
7
+ * @desc
8
+ * Returns the result of last script executed via {@link ExecuteScript}
9
+ */
10
+ class LastScriptExecution {
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() {
18
+ return core_1.Question.about(`last script execution result`, actor => abilities_1.BrowseTheWeb.as(actor).lastScriptExecutionResult());
19
+ }
20
+ }
21
+ exports.LastScriptExecution = LastScriptExecution;
22
+ //# sourceMappingURL=LastScriptExecution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LastScriptExecution.js","sourceRoot":"","sources":["../../../src/screenplay/questions/LastScriptExecution.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAE7C,4CAA4C;AAE5C;;;GAGG;AACH,MAAa,mBAAmB;IAE5B;;;;;OAKG;IACH,MAAM,CAAC,MAAM;QACT,OAAO,eAAQ,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,EAAE,CAC1D,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,yBAAyB,EAAE,CAAC,CAAC;IAC5D,CAAC;CACJ;AAZD,kDAYC"}
@@ -0,0 +1,185 @@
1
+ import { Answerable, Question } from '@serenity-js/core';
2
+ import { PageElement } from '../models';
3
+ /**
4
+ * @desc
5
+ * Represents options and values selected in a
6
+ * [HTML `<select>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select).
7
+ *
8
+ * @see {@link Select}
9
+ */
10
+ export declare class Selected {
11
+ /**
12
+ * @desc
13
+ * Represents the value of a single option selected in a
14
+ * [HTML `<select>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select).
15
+ *
16
+ * @example <caption>Example widget</caption>
17
+ * <select data-test='countries'>
18
+ * <option value='UK'>United Kingdom</option>
19
+ * <option value='PL'>Poland</option>
20
+ * <option value='US'>United States</option>
21
+ * </select>
22
+ *
23
+ * @example <caption>Lean Page Object</caption>
24
+ * import { Target } from '@serenity-js/protractor';
25
+ * import { browser, by } from 'protractor';
26
+ *
27
+ * class Countries {
28
+ * static dropdown = Target.the('countries dropdown')
29
+ * .located(by.css('[data-test="countries"]'));
30
+ * }
31
+ *
32
+ * @example <caption>Retrieving the selected value</caption>
33
+ * import { actorCalled } from '@serenity-js/core';
34
+ * import { Accept, BrowseTheWeb, Select, Selected } from '@serenity-js/protractor';
35
+ * import { Ensure, equals } from '@serenity-js/assertions';
36
+ * import { protractor } from 'protractor';
37
+ *
38
+ * actorCalled('Nick')
39
+ * .whoCan(BrowseTheWeb.using(protractor.browser))
40
+ * .attemptsTo(
41
+ * Select.value('UK').from(Countries.dropdown),
42
+ * Ensure.that(Selected.valueOf(Countries.dropdown), equals('UK')),
43
+ * );
44
+ *
45
+ * @param {Answerable<PageElement>} pageElement
46
+ * A {@link PageElement} identifying the `<select>` element of interest
47
+ *
48
+ * @returns {Question<Promise<string>>}
49
+ *
50
+ * @see {@link Select.value}
51
+ */
52
+ static valueOf(pageElement: Answerable<PageElement>): Question<Promise<string>>;
53
+ /**
54
+ * @desc
55
+ * Represents values of options selected in a
56
+ * [HTML `<select multiple>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-multiple)
57
+ *
58
+ * @example <caption>Example widget</caption>
59
+ * <select multiple data-test='countries'>
60
+ * <option value='UK'>United Kingdom</option>
61
+ * <option value='PL'>Poland</option>
62
+ * <option value='US'>United States</option>
63
+ * </select>
64
+ *
65
+ * @example <caption>Lean Page Object</caption>
66
+ * import { Target } from '@serenity-js/protractor';
67
+ * import { browser, by } from 'protractor';
68
+ *
69
+ * class Countries {
70
+ * static dropdown = Target.the('countries dropdown')
71
+ * .located(by.css('[data-test="countries"]'));
72
+ * }
73
+ *
74
+ * @example <caption>Retrieving the selected value</caption>
75
+ * import { actorCalled } from '@serenity-js/core';
76
+ * import { Accept, BrowseTheWeb, Select, Selected } from '@serenity-js/protractor';
77
+ * import { Ensure, equals } from '@serenity-js/assertions';
78
+ * import { protractor } from 'protractor';
79
+ *
80
+ * actorCalled('Nick')
81
+ * .whoCan(BrowseTheWeb.using(protractor.browser))
82
+ * .attemptsTo(
83
+ * Select.values('UK').from(Countries.dropdown),
84
+ * Ensure.that(Selected.valuesOf(Countries.dropdown), equals([ 'UK' ])),
85
+ * );
86
+ *
87
+ * @param {Answerable<PageElement>} pageElement
88
+ * A {@link Target} identifying the `<select>` element of interest
89
+ *
90
+ * @returns {Question<Promise<string[]>>}
91
+ *
92
+ * @see {@link Select.values}
93
+ */
94
+ static valuesOf(pageElement: Answerable<PageElement>): Question<Promise<string[]>>;
95
+ /**
96
+ * @desc
97
+ * Represents a single option selected in a
98
+ * [HTML `<select>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-multiple)
99
+ *
100
+ * @example <caption>Example widget</caption>
101
+ * <select data-test='countries'>
102
+ * <option value='UK'>United Kingdom</option>
103
+ * <option value='PL'>Poland</option>
104
+ * <option value='US'>United States</option>
105
+ * </select>
106
+ *
107
+ * @example <caption>Lean Page Object</caption>
108
+ * import { Target } from '@serenity-js/protractor';
109
+ * import { browser, by } from 'protractor';
110
+ *
111
+ * class Countries {
112
+ * static dropdown = Target.the('countries dropdown')
113
+ * .located(by.css('[data-test="countries"]'));
114
+ * }
115
+ *
116
+ * @example <caption>Retrieving the selected value</caption>
117
+ * import { actorCalled } from '@serenity-js/core';
118
+ * import { Accept, BrowseTheWeb, Select, Selected } from '@serenity-js/protractor';
119
+ * import { Ensure, equals } from '@serenity-js/assertions';
120
+ * import { protractor } from 'protractor';
121
+ *
122
+ * actorCalled('Nick')
123
+ * .whoCan(BrowseTheWeb.using(protractor.browser))
124
+ * .attemptsTo(
125
+ * Select.option('Poland').from(Countries.dropdown),
126
+ * Ensure.that(
127
+ * Selected.optionIn(Countries.dropdown),
128
+ * equals('Poland')
129
+ * ),
130
+ * );
131
+ *
132
+ * @param {Answerable<PageElement>} pageElement
133
+ * A {@link Target} identifying the `<select>` element of interest
134
+ *
135
+ * @returns {Question<Promise<string>>}
136
+ *
137
+ * @see {@link Select.option}
138
+ */
139
+ static optionIn(pageElement: Answerable<PageElement>): Question<Promise<string>>;
140
+ /**
141
+ * @desc
142
+ * Represents options selected in a
143
+ * [HTML `<select multiple>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-multiple)
144
+ *
145
+ * @example <caption>Example widget</caption>
146
+ * <select multiple data-test='countries'>
147
+ * <option value='UK'>United Kingdom</option>
148
+ * <option value='PL'>Poland</option>
149
+ * <option value='US'>United States</option>
150
+ * </select>
151
+ *
152
+ * @example <caption>Lean Page Object</caption>
153
+ * import { Target } from '@serenity-js/protractor';
154
+ * import { browser, by } from 'protractor';
155
+ *
156
+ * class Countries {
157
+ * static dropdown = Target.the('countries dropdown')
158
+ * .located(by.css('[data-test="countries"]'));
159
+ * }
160
+ *
161
+ * @example <caption>Retrieving the selected value</caption>
162
+ * import { actorCalled } from '@serenity-js/core';
163
+ * import { Accept, BrowseTheWeb, Select, Selected } from '@serenity-js/protractor';
164
+ * import { Ensure, equals } from '@serenity-js/assertions';
165
+ * import { protractor } from 'protractor';
166
+ *
167
+ * actorCalled('Nick')
168
+ * .whoCan(BrowseTheWeb.using(protractor.browser))
169
+ * .attemptsTo(
170
+ * Select.options('Poland', 'United States').from(Countries.dropdown),
171
+ * Ensure.that(
172
+ * Selected.optionsIn(Countries.dropdown),
173
+ * equals([ 'Poland', 'United States' ])
174
+ * ),
175
+ * );
176
+ *
177
+ * @param {Answerable<PageElement>} pageElement
178
+ * A {@link Target} identifying the `<select>` element of interest
179
+ *
180
+ * @returns {Question<Promise<string[]>>}
181
+ *
182
+ * @see {@link Select.options}
183
+ */
184
+ static optionsIn(pageElement: Answerable<PageElement>): Question<Promise<string[]>>;
185
+ }