@serenity-js/web 3.0.0-rc.3 → 3.0.0-rc.7

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 (108) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/lib/expectations/ElementExpectation.d.ts +78 -6
  3. package/lib/expectations/ElementExpectation.js +89 -14
  4. package/lib/expectations/ElementExpectation.js.map +1 -1
  5. package/lib/expectations/index.d.ts +1 -1
  6. package/lib/expectations/index.js +1 -1
  7. package/lib/expectations/index.js.map +1 -1
  8. package/lib/expectations/isActive.d.ts +1 -1
  9. package/lib/expectations/isClickable.d.ts +1 -1
  10. package/lib/expectations/isClickable.js.map +1 -1
  11. package/lib/expectations/isEnabled.d.ts +1 -1
  12. package/lib/expectations/isSelected.d.ts +1 -1
  13. package/lib/expectations/isSelected.js +1 -2
  14. package/lib/expectations/isSelected.js.map +1 -1
  15. package/lib/expectations/isVisible.d.ts +1 -1
  16. package/lib/screenplay/abilities/BrowseTheWeb.d.ts +6 -6
  17. package/lib/screenplay/abilities/BrowseTheWeb.js +12 -0
  18. package/lib/screenplay/abilities/BrowseTheWeb.js.map +1 -1
  19. package/lib/screenplay/interactions/Press.js +0 -1
  20. package/lib/screenplay/interactions/Press.js.map +1 -1
  21. package/lib/screenplay/interactions/Wait.d.ts +1 -1
  22. package/lib/screenplay/interactions/Wait.js +4 -8
  23. package/lib/screenplay/interactions/Wait.js.map +1 -1
  24. package/lib/screenplay/interactions/WaitBuilder.d.ts +1 -1
  25. package/lib/screenplay/models/Cookie.d.ts +3 -3
  26. package/lib/screenplay/models/Cookie.js.map +1 -1
  27. package/lib/screenplay/models/Locator.d.ts +14 -0
  28. package/lib/screenplay/models/Locator.js +19 -0
  29. package/lib/screenplay/models/Locator.js.map +1 -0
  30. package/lib/screenplay/models/ModalDialog.d.ts +3 -3
  31. package/lib/screenplay/models/ModalDialog.js.map +1 -1
  32. package/lib/screenplay/models/Page.d.ts +6 -6
  33. package/lib/screenplay/models/Page.js +3 -8
  34. package/lib/screenplay/models/Page.js.map +1 -1
  35. package/lib/screenplay/models/PageElement.d.ts +8 -10
  36. package/lib/screenplay/models/PageElement.js +9 -16
  37. package/lib/screenplay/models/PageElement.js.map +1 -1
  38. package/lib/screenplay/models/PageElements.d.ts +7 -9
  39. package/lib/screenplay/models/PageElements.js +31 -30
  40. package/lib/screenplay/models/PageElements.js.map +1 -1
  41. package/lib/screenplay/models/index.d.ts +1 -2
  42. package/lib/screenplay/models/index.js +1 -2
  43. package/lib/screenplay/models/index.js.map +1 -1
  44. package/lib/screenplay/models/selectors/By.js +5 -6
  45. package/lib/screenplay/models/selectors/By.js.map +1 -1
  46. package/lib/screenplay/models/selectors/ByCss.d.ts +3 -1
  47. package/lib/screenplay/models/selectors/ByCss.js +4 -0
  48. package/lib/screenplay/models/selectors/ByCss.js.map +1 -1
  49. package/lib/screenplay/models/selectors/ByCssContainingText.d.ts +3 -2
  50. package/lib/screenplay/models/selectors/ByCssContainingText.js +3 -2
  51. package/lib/screenplay/models/selectors/ByCssContainingText.js.map +1 -1
  52. package/lib/screenplay/models/selectors/ById.d.ts +3 -1
  53. package/lib/screenplay/models/selectors/ById.js +4 -0
  54. package/lib/screenplay/models/selectors/ById.js.map +1 -1
  55. package/lib/screenplay/models/selectors/ByTagName.d.ts +3 -1
  56. package/lib/screenplay/models/selectors/ByTagName.js +4 -0
  57. package/lib/screenplay/models/selectors/ByTagName.js.map +1 -1
  58. package/lib/screenplay/models/selectors/ByXPath.d.ts +3 -1
  59. package/lib/screenplay/models/selectors/ByXPath.js +4 -0
  60. package/lib/screenplay/models/selectors/ByXPath.js.map +1 -1
  61. package/lib/screenplay/models/selectors/Selector.d.ts +1 -3
  62. package/lib/screenplay/models/selectors/Selector.js +1 -5
  63. package/lib/screenplay/models/selectors/Selector.js.map +1 -1
  64. package/lib/screenplay/questions/LastScriptExecution.d.ts +2 -2
  65. package/lib/screenplay/questions/LastScriptExecution.js.map +1 -1
  66. package/lib/screenplay/questions/Text.d.ts +6 -8
  67. package/lib/screenplay/questions/Text.js +17 -16
  68. package/lib/screenplay/questions/Text.js.map +1 -1
  69. package/package.json +5 -5
  70. package/src/expectations/ElementExpectation.ts +95 -19
  71. package/src/expectations/index.ts +1 -1
  72. package/src/expectations/isActive.ts +1 -1
  73. package/src/expectations/isClickable.ts +2 -2
  74. package/src/expectations/isEnabled.ts +1 -1
  75. package/src/expectations/isSelected.ts +3 -4
  76. package/src/expectations/isVisible.ts +1 -1
  77. package/src/screenplay/abilities/BrowseTheWeb.ts +23 -8
  78. package/src/screenplay/interactions/Press.ts +0 -1
  79. package/src/screenplay/interactions/Wait.ts +10 -14
  80. package/src/screenplay/interactions/WaitBuilder.ts +1 -1
  81. package/src/screenplay/models/Cookie.ts +3 -3
  82. package/src/screenplay/models/Locator.ts +25 -0
  83. package/src/screenplay/models/ModalDialog.ts +4 -4
  84. package/src/screenplay/models/Page.ts +12 -15
  85. package/src/screenplay/models/PageElement.ts +13 -24
  86. package/src/screenplay/models/PageElements.ts +33 -38
  87. package/src/screenplay/models/index.ts +1 -2
  88. package/src/screenplay/models/selectors/By.ts +1 -3
  89. package/src/screenplay/models/selectors/ByCss.ts +4 -1
  90. package/src/screenplay/models/selectors/ByCssContainingText.ts +3 -3
  91. package/src/screenplay/models/selectors/ById.ts +4 -1
  92. package/src/screenplay/models/selectors/ByTagName.ts +4 -1
  93. package/src/screenplay/models/selectors/ByXPath.ts +4 -1
  94. package/src/screenplay/models/selectors/Selector.ts +2 -7
  95. package/src/screenplay/questions/LastScriptExecution.ts +2 -2
  96. package/src/screenplay/questions/Text.ts +28 -20
  97. package/lib/expectations/isPresent.d.ts +0 -15
  98. package/lib/expectations/isPresent.js +0 -22
  99. package/lib/expectations/isPresent.js.map +0 -1
  100. package/lib/screenplay/models/NativeElementLocator.d.ts +0 -5
  101. package/lib/screenplay/models/NativeElementLocator.js +0 -3
  102. package/lib/screenplay/models/NativeElementLocator.js.map +0 -1
  103. package/lib/screenplay/models/PassThroughNativeElementLocator.d.ts +0 -9
  104. package/lib/screenplay/models/PassThroughNativeElementLocator.js +0 -17
  105. package/lib/screenplay/models/PassThroughNativeElementLocator.js.map +0 -1
  106. package/src/expectations/isPresent.ts +0 -21
  107. package/src/screenplay/models/NativeElementLocator.ts +0 -6
  108. package/src/screenplay/models/PassThroughNativeElementLocator.ts +0 -18
package/CHANGELOG.md CHANGED
@@ -3,6 +3,146 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.0.0-rc.7](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.6...v3.0.0-rc.7) (2022-01-28)
7
+
8
+
9
+ ### Features
10
+
11
+ * **assertions:** isPresent works with any Optional ([cea75dc](https://github.com/serenity-js/serenity-js/commit/cea75dc1c728e45e06a87aaf9c1573a237334285)), closes [#1103](https://github.com/serenity-js/serenity-js/issues/1103)
12
+ * **core:** `f` and `d` question description formatters ([c9f3fad](https://github.com/serenity-js/serenity-js/commit/c9f3fadd86ec0196f2cdbf76d9628bbef0a3fcba))
13
+ * **core:** replaced `Adapter` with `QuestionAdapter` and introduced `Optional` ([8d84ad3](https://github.com/serenity-js/serenity-js/commit/8d84ad3863e3c726533d0f21934fb1e2fa8b3022)), closes [#1103](https://github.com/serenity-js/serenity-js/issues/1103)
14
+ * **core:** support for Optional chaining, expectation isPresent, refactored Expectations ([1841ee5](https://github.com/serenity-js/serenity-js/commit/1841ee5fc48cfa403ddc53358f75764d9a010c21)), closes [#1099](https://github.com/serenity-js/serenity-js/issues/1099) [#1099](https://github.com/serenity-js/serenity-js/issues/1099) [#1103](https://github.com/serenity-js/serenity-js/issues/1103)
15
+
16
+
17
+
18
+
19
+
20
+ # [3.0.0-rc.6](https://github.com/serenity-js/serenity-js/compare/v2.32.7...v3.0.0-rc.6) (2022-01-10)
21
+
22
+
23
+
24
+ # [3.0.0-rc.5](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.4...v3.0.0-rc.5) (2022-01-07)
25
+
26
+
27
+ ### Features
28
+
29
+ * **web:** support for advanced PageElement locator patterns ([c1ff8b7](https://github.com/serenity-js/serenity-js/commit/c1ff8b7539ebc1da8f79ea2b6d17bb01c42f443d)), closes [#1084](https://github.com/serenity-js/serenity-js/issues/1084)
30
+
31
+
32
+
33
+ # [3.0.0-rc.4](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.3...v3.0.0-rc.4) (2021-12-30)
34
+
35
+
36
+ ### Features
37
+
38
+ * **web:** ElementExpectation makes it easier to define custom PageElement-related Expectations ([92ebf7d](https://github.com/serenity-js/serenity-js/commit/92ebf7db720d0fe88ddbe17b9958fa993b1fd02e))
39
+ * **web:** Text.ofAll accepts mapped PageElements ([5314246](https://github.com/serenity-js/serenity-js/commit/5314246305fa3f62446d5ec718f36354152be68d))
40
+
41
+
42
+
43
+ # [3.0.0-rc.3](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.2...v3.0.0-rc.3) (2021-12-29)
44
+
45
+
46
+ ### Bug Fixes
47
+
48
+ * **core:** refactored Mappable so that it's easier to implement filters ([176e0cd](https://github.com/serenity-js/serenity-js/commit/176e0cd0303d63271477b2b7a8e7b0572dda99a0)), closes [#1074](https://github.com/serenity-js/serenity-js/issues/1074)
49
+ * **deps:** updated tiny-types to 1.17.0 ([3187051](https://github.com/serenity-js/serenity-js/commit/3187051594158b4b450c82e851e417fd2ed21652))
50
+ * **web:** corrected synchronisation in Web questions and interactions ([c3a0ad1](https://github.com/serenity-js/serenity-js/commit/c3a0ad16de311e71d7e82e4f463baa0ca6b18863))
51
+ * **web:** Photographer skips taking a screenshot if the Window is closed (DevTools protocol) ([b682577](https://github.com/serenity-js/serenity-js/commit/b682577ad649046fc1a4cd61a7315e11d60dcf32))
52
+ * **web:** refactored Selector and NativeElementLocator classes to simplify the implementation ([f0c8f11](https://github.com/serenity-js/serenity-js/commit/f0c8f113433958877d36f13d0bc7f355ea68d280))
53
+ * **web:** simplified the selectors ([b167e42](https://github.com/serenity-js/serenity-js/commit/b167e422eb66556845c31d5847b9fd33b707c764)), closes [#1074](https://github.com/serenity-js/serenity-js/issues/1074)
54
+
55
+
56
+ ### Features
57
+
58
+ * **core:** new implementation of List.where filters ([45b3c80](https://github.com/serenity-js/serenity-js/commit/45b3c8080ca467ac6362e5217e7899ca36a04cdc)), closes [#1074](https://github.com/serenity-js/serenity-js/issues/1074)
59
+ * **web:** isVisible checks if the element is in viewport and not hidden behind other elements ([429040f](https://github.com/serenity-js/serenity-js/commit/429040fb32b04cd4bc7524100635203fd8128eb6))
60
+ * **web:** new PageElement retrieval model based on Selectors ([48bd94f](https://github.com/serenity-js/serenity-js/commit/48bd94f3c29707b66dcf81a7522f7529b6f9fcfb))
61
+ * **web:** re-introduced PageElements.where DSL and universal By selectors ([39fe0a1](https://github.com/serenity-js/serenity-js/commit/39fe0a10edf7f652e93911159e4a4689c36d6876)), closes [#1081](https://github.com/serenity-js/serenity-js/issues/1081)
62
+
63
+
64
+
65
+ # [3.0.0-rc.2](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.1...v3.0.0-rc.2) (2021-12-09)
66
+
67
+
68
+
69
+ # [3.0.0-rc.1](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.0...v3.0.0-rc.1) (2021-12-09)
70
+
71
+
72
+
73
+ # [3.0.0-rc.0](https://github.com/serenity-js/serenity-js/compare/v2.32.5...v3.0.0-rc.0) (2021-12-08)
74
+
75
+
76
+ ### Bug Fixes
77
+
78
+ * **core:** 3.0 RC ([469d54e](https://github.com/serenity-js/serenity-js/commit/469d54e4f81ef430566b93852e3174826f8ef672)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
79
+ * **core:** renamed "Model" type to "Adapter" to better reflect its purpose ([b4ea7a1](https://github.com/serenity-js/serenity-js/commit/b4ea7a100fac2c896990bf15cbc906de641196b8)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
80
+ * **web:** added missing export ([c5ffc0a](https://github.com/serenity-js/serenity-js/commit/c5ffc0a83905c99ea0020577503170c427fdb9f2)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
81
+ * **webdriverio:** separated UIElement.hoverOver from UIElement.scrollIntoView ([cf4ca2c](https://github.com/serenity-js/serenity-js/commit/cf4ca2c531e0f90f9a27917e322359c13bfbc6e6))
82
+ * **web:** ensure all Web interactions extend the same base class ([b358c0b](https://github.com/serenity-js/serenity-js/commit/b358c0b67c1de11af63e1e2142d3613692769cd6))
83
+ * **web:** fixed the interaction to Select ([10b7b74](https://github.com/serenity-js/serenity-js/commit/10b7b7446743b5866a1b458577ea7d2e11bf5a8f))
84
+ * **web:** optimised PhotoTakingStrategy ([085b7f7](https://github.com/serenity-js/serenity-js/commit/085b7f716033b22207af47edac58c896f46af62d))
85
+ * **web:** removed incorrect export ([ebf80c0](https://github.com/serenity-js/serenity-js/commit/ebf80c019af4db2a847e4b98599bce02b8acef23))
86
+ * **web:** removed incorrect import ([90cb025](https://github.com/serenity-js/serenity-js/commit/90cb0251a00a7bff098376110dcec2f9f2c5d5c0))
87
+ * **web:** removed window-specific APIs from BrowseTheWeb that got replaced by Page ([918f447](https://github.com/serenity-js/serenity-js/commit/918f447c1d8f326fbf5730f1aa61108045556212)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
88
+ * **web:** renamed Element and associated classes to PageElement to avoid name conflicts ([1e4204b](https://github.com/serenity-js/serenity-js/commit/1e4204b5507469e6574c87a6d84454e39e8a813e))
89
+ * **web:** renamed PageElementList to PageElements to improve readability ([a9903a7](https://github.com/serenity-js/serenity-js/commit/a9903a7389b00106ef94d2bdb9f86a7fd04be541)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
90
+ * **web:** standardised getters across PageElement implementations ([336472b](https://github.com/serenity-js/serenity-js/commit/336472b1a6882412f6a88483e51266909a1d51d0))
91
+ * **web:** wordsmithing of interface names ([5a1e76a](https://github.com/serenity-js/serenity-js/commit/5a1e76a9c162370e17238fcccc9f08e109d543c3))
92
+
93
+
94
+ ### Features
95
+
96
+ * **core:** question.about produces "props" that proxy the methods of the underlying model ([f771872](https://github.com/serenity-js/serenity-js/commit/f771872c56b487e404002c3800fc8f3baaed804f))
97
+ * **protractor:** compatibility with @serenity-js/web ([9df4db2](https://github.com/serenity-js/serenity-js/commit/9df4db27a6e0ae62bf0d0e679a170d4865041043)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
98
+ * **web:** a common way to run the tests for all the web adapters ([c7e584a](https://github.com/serenity-js/serenity-js/commit/c7e584a9bf288ebc7781affdb720097527e8ed3a))
99
+ * **web:** added Page.viewportSize and Page.setViewportSize methods ([4cabbe2](https://github.com/serenity-js/serenity-js/commit/4cabbe21a7fbac3457c6a6ea3d4442a62c3f1f3c))
100
+ * **web:** all Screenplay APIs migrated from @serenity-js/webdriverio to @serenity-js/web ([7b6b95d](https://github.com/serenity-js/serenity-js/commit/7b6b95dc255446c29ae213ba2a1d142d426d16c8))
101
+ * **webdriverio:** support for native WebdriverIO services ([8d5ad22](https://github.com/serenity-js/serenity-js/commit/8d5ad22594cdb2ebddedc58a30259ca8430e360c))
102
+ * **web:** interaction to set a Cookie ([c056439](https://github.com/serenity-js/serenity-js/commit/c056439746a8f57c3edd937b8862f2babb70e94e)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
103
+ * **web:** introduced UIElementQuestion to help ensure no NPEs in UI-related questions ([fe29121](https://github.com/serenity-js/serenity-js/commit/fe29121118d630e9fbd73dca85496e20948e26e0))
104
+ * **web:** migrated Photographer from @serenity-js/protractor to @serenity-js/web ([4506dac](https://github.com/serenity-js/serenity-js/commit/4506dacebdf955c32c4eff17bf9982c8e45e2925)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
105
+ * **web:** ModalDialog available for both Protractor and WebdriverIO adapters ([ef3c566](https://github.com/serenity-js/serenity-js/commit/ef3c566aed12b52aa22c54058992d369172b8597)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
106
+ * **web:** new module @serenity-js/web to provide Web-related Screenplay Pattern APIs ([bead861](https://github.com/serenity-js/serenity-js/commit/bead8612af1a5c99b775e680a3904f44d0281cf9))
107
+ * **web:** page provides an abstraction around browser window ([2e70a3b](https://github.com/serenity-js/serenity-js/commit/2e70a3b6af2e8cc49255820e8a1aaffcc71b76a8))
108
+ * **web:** Page.url() and Page.title() replace Website.url() and Website.title() ([49fe009](https://github.com/serenity-js/serenity-js/commit/49fe0094422ab53ec67d4ba303f80c33e382eebd)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
109
+ * **web:** removed Target in favour of PageElement ([69496c4](https://github.com/serenity-js/serenity-js/commit/69496c47c4a1ec7b92e7ab6c83da1559e926f28e)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
110
+ * **web:** support for switching browsing context ([a73a635](https://github.com/serenity-js/serenity-js/commit/a73a635f93183d67229acde78e74526564008869)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
111
+ * **web:** support for working with cookies ([39cde6d](https://github.com/serenity-js/serenity-js/commit/39cde6de7a36d27a8b1c596493efbec94900af6b)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
112
+
113
+
114
+ ### BREAKING CHANGES
115
+
116
+ * **core:** Introduced @serenity-js/web - a shared library for Serenity/JS Web integration
117
+ modules such as @serenity-js/protractor and @serenity-js/webdriverio. Dropped support for Node 12.
118
+
119
+
120
+
121
+
122
+
123
+ # [3.0.0-rc.5](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.4...v3.0.0-rc.5) (2022-01-07)
124
+
125
+
126
+ ### Features
127
+
128
+ * **web:** support for advanced PageElement locator patterns ([c1ff8b7](https://github.com/serenity-js/serenity-js/commit/c1ff8b7539ebc1da8f79ea2b6d17bb01c42f443d)), closes [#1084](https://github.com/serenity-js/serenity-js/issues/1084)
129
+
130
+
131
+
132
+
133
+
134
+ # [3.0.0-rc.4](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.3...v3.0.0-rc.4) (2021-12-30)
135
+
136
+
137
+ ### Features
138
+
139
+ * **web:** ElementExpectation makes it easier to define custom PageElement-related Expectations ([92ebf7d](https://github.com/serenity-js/serenity-js/commit/92ebf7db720d0fe88ddbe17b9958fa993b1fd02e))
140
+ * **web:** Text.ofAll accepts mapped PageElements ([5314246](https://github.com/serenity-js/serenity-js/commit/5314246305fa3f62446d5ec718f36354152be68d))
141
+
142
+
143
+
144
+
145
+
6
146
  # [3.0.0-rc.3](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.2...v3.0.0-rc.3) (2021-12-29)
7
147
 
8
148
 
@@ -1,11 +1,83 @@
1
- import { AnswersQuestions, Expectation, ExpectationOutcome } from '@serenity-js/core';
1
+ import { Expectation } from '@serenity-js/core';
2
2
  import { PageElement } from '../screenplay';
3
3
  /**
4
- * @access private
4
+ * @desc
5
+ * A convenience method to create a custom {@link PageElement}-related {@link @serenity-js/core/lib/screenplay/questions~Expectation}
6
+ *
7
+ * @example <caption>Defining an expectation</caption>
8
+ * import { Expectation } from '@serenity-js/core';
9
+ * import { ElementExpectation, PageElement } from '@serenity-js/web';
10
+ *
11
+ * export function isPresent(): Expectation<boolean, PageElement> {
12
+ * return ElementExpectation.forElementTo('become present', actual => actual.isPresent());
13
+ * }
14
+ *
15
+ * @example <caption>Using an expectation in an assertion</caption>
16
+ * import { Ensure } from '@serenity-js/assertions';
17
+ * import { actorCalled } from '@serenity-js/core';
18
+ * import { By, PageElement } from '@serenity-js/web';
19
+ *
20
+ * const submitButton = () =>
21
+ * PageElement.located(By.css('.submit')).describedAs('submit button');
22
+ *
23
+ * actorCalled('Izzy').attemptsTo(
24
+ * Ensure.that(submitButton(), isPresent())
25
+ * );
26
+ *
27
+ * @example <caption>Using an expectation in a synchronisation statement</caption>
28
+ * import { actorCalled, Duration } from '@serenity-js/core';
29
+ * import { By, PageElement, Wait } from '@serenity-js/web';
30
+ *
31
+ * const submitButton = () =>
32
+ * PageElement.located(By.css('.submit')).describedAs('submit button');
33
+ *
34
+ * actorCalled('Izzy').attemptsTo(
35
+ * Wait.upTo(Duration.ofSeconds(2)).until(submitButton(), isPresent())
36
+ * );
37
+ *
38
+ * @public
39
+ * @extends {@serenity-js/core/lib/screenplay/questions~Expectation}
5
40
  */
6
- export declare class ElementExpectation extends Expectation<any, PageElement> {
41
+ export declare class ElementExpectation extends Expectation<PageElement> {
7
42
  private readonly fn;
8
- static forElementTo(message: string, fn: (actual: PageElement) => Promise<boolean>): Expectation<any, PageElement>;
9
- constructor(subject: string, fn: (actual: PageElement) => Promise<boolean>);
10
- answeredBy(actor: AnswersQuestions): (actual: PageElement) => Promise<ExpectationOutcome<boolean, PageElement>>;
43
+ /**
44
+ * @desc
45
+ * Creates an {@link @serenity-js/core/lib/screenplay/questions~Expectation}
46
+ *
47
+ * @example <caption>Defining an expectation</caption>
48
+ * import { Expectation } from '@serenity-js/core';
49
+ * import { ElementExpectation, PageElement } from '@serenity-js/web';
50
+ *
51
+ * export function isPresent(): Expectation<boolean, PageElement> {
52
+ * return ElementExpectation.forElementTo('become present', actual => actual.isPresent());
53
+ * }
54
+ *
55
+ * @param {string} description
56
+ * A description of the expectation.
57
+ * Please note that Serenity/JS will use it to describe your expectation in sentences like these:
58
+ * - `actor ensures that <something> does <description>`
59
+ * - `actor ensures that <something> does not <description>`
60
+ * - `actor waits until <something> does <description>`
61
+ * - `actor waits until <something> does not <description>`
62
+ *
63
+ * To work with the above templates, the description should be similar to
64
+ * - `become present`,
65
+ * - `become active`,
66
+ * - `equal X`,
67
+ * - `has value greater than Y`.
68
+ *
69
+ * Descriptions like "is present", "is active", "equals X", "is greater than Y" WILL NOT work well.
70
+ *
71
+ * @param {function(actual: PageElement): Promise<boolean>} fn
72
+ * An asynchronous callback function that receives a {@link PageElement} and returns a {@link Promise}
73
+ * that should resolve to `true` when the expectation is met, and `false` otherwise.
74
+ *
75
+ * @returns {ElementExpectation<any, PageElement>}
76
+ */
77
+ static forElementTo(description: string, fn: (actual: PageElement) => Promise<boolean>): Expectation<PageElement>;
78
+ /**
79
+ * @param {string} description
80
+ * @param {function(actual: PageElement): Promise<boolean>} fn
81
+ */
82
+ constructor(description: string, fn: (actual: PageElement) => Promise<boolean>);
11
83
  }
@@ -3,24 +3,99 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ElementExpectation = void 0;
4
4
  const core_1 = require("@serenity-js/core");
5
5
  /**
6
- * @access private
6
+ * @desc
7
+ * A convenience method to create a custom {@link PageElement}-related {@link @serenity-js/core/lib/screenplay/questions~Expectation}
8
+ *
9
+ * @example <caption>Defining an expectation</caption>
10
+ * import { Expectation } from '@serenity-js/core';
11
+ * import { ElementExpectation, PageElement } from '@serenity-js/web';
12
+ *
13
+ * export function isPresent(): Expectation<boolean, PageElement> {
14
+ * return ElementExpectation.forElementTo('become present', actual => actual.isPresent());
15
+ * }
16
+ *
17
+ * @example <caption>Using an expectation in an assertion</caption>
18
+ * import { Ensure } from '@serenity-js/assertions';
19
+ * import { actorCalled } from '@serenity-js/core';
20
+ * import { By, PageElement } from '@serenity-js/web';
21
+ *
22
+ * const submitButton = () =>
23
+ * PageElement.located(By.css('.submit')).describedAs('submit button');
24
+ *
25
+ * actorCalled('Izzy').attemptsTo(
26
+ * Ensure.that(submitButton(), isPresent())
27
+ * );
28
+ *
29
+ * @example <caption>Using an expectation in a synchronisation statement</caption>
30
+ * import { actorCalled, Duration } from '@serenity-js/core';
31
+ * import { By, PageElement, Wait } from '@serenity-js/web';
32
+ *
33
+ * const submitButton = () =>
34
+ * PageElement.located(By.css('.submit')).describedAs('submit button');
35
+ *
36
+ * actorCalled('Izzy').attemptsTo(
37
+ * Wait.upTo(Duration.ofSeconds(2)).until(submitButton(), isPresent())
38
+ * );
39
+ *
40
+ * @public
41
+ * @extends {@serenity-js/core/lib/screenplay/questions~Expectation}
7
42
  */
8
43
  class ElementExpectation extends core_1.Expectation {
9
- constructor(subject, fn) {
10
- super(subject);
44
+ /**
45
+ * @param {string} description
46
+ * @param {function(actual: PageElement): Promise<boolean>} fn
47
+ */
48
+ constructor(description, fn) {
49
+ super(description, async (actor, actual) => {
50
+ const pageElement = await actor.answer(actual);
51
+ try {
52
+ const result = await fn(pageElement);
53
+ return result
54
+ ? new core_1.ExpectationMet(this.toString(), undefined, pageElement)
55
+ : new core_1.ExpectationNotMet(this.toString(), undefined, pageElement);
56
+ }
57
+ catch (error) {
58
+ return new core_1.ExpectationNotMet(`${description} (${error.message})`, undefined, pageElement);
59
+ }
60
+ });
11
61
  this.fn = fn;
12
62
  }
13
- static forElementTo(message, fn) {
14
- return new ElementExpectation(message, fn);
15
- }
16
- answeredBy(actor) {
17
- return (actual) => this.fn(actual)
18
- .then(expectationMet => expectationMet
19
- ? new core_1.ExpectationMet(this.toString(), undefined, actual)
20
- : new core_1.ExpectationNotMet(this.toString(), undefined, actual))
21
- .catch(error => {
22
- return new core_1.ExpectationNotMet(`${this.toString()} (${error.message})`, undefined, actual);
23
- });
63
+ /**
64
+ * @desc
65
+ * Creates an {@link @serenity-js/core/lib/screenplay/questions~Expectation}
66
+ *
67
+ * @example <caption>Defining an expectation</caption>
68
+ * import { Expectation } from '@serenity-js/core';
69
+ * import { ElementExpectation, PageElement } from '@serenity-js/web';
70
+ *
71
+ * export function isPresent(): Expectation<boolean, PageElement> {
72
+ * return ElementExpectation.forElementTo('become present', actual => actual.isPresent());
73
+ * }
74
+ *
75
+ * @param {string} description
76
+ * A description of the expectation.
77
+ * Please note that Serenity/JS will use it to describe your expectation in sentences like these:
78
+ * - `actor ensures that <something> does <description>`
79
+ * - `actor ensures that <something> does not <description>`
80
+ * - `actor waits until <something> does <description>`
81
+ * - `actor waits until <something> does not <description>`
82
+ *
83
+ * To work with the above templates, the description should be similar to
84
+ * - `become present`,
85
+ * - `become active`,
86
+ * - `equal X`,
87
+ * - `has value greater than Y`.
88
+ *
89
+ * Descriptions like "is present", "is active", "equals X", "is greater than Y" WILL NOT work well.
90
+ *
91
+ * @param {function(actual: PageElement): Promise<boolean>} fn
92
+ * An asynchronous callback function that receives a {@link PageElement} and returns a {@link Promise}
93
+ * that should resolve to `true` when the expectation is met, and `false` otherwise.
94
+ *
95
+ * @returns {ElementExpectation<any, PageElement>}
96
+ */
97
+ static forElementTo(description, fn) {
98
+ return new ElementExpectation(description, fn);
24
99
  }
25
100
  }
26
101
  exports.ElementExpectation = ElementExpectation;
@@ -1 +1 @@
1
- {"version":3,"file":"ElementExpectation.js","sourceRoot":"","sources":["../../src/expectations/ElementExpectation.ts"],"names":[],"mappings":";;;AAAA,4CAAyH;AAIzH;;GAEG;AACH,MAAa,kBAAmB,SAAQ,kBAA6B;IAKjE,YACI,OAAe,EACE,EAA6C;QAE9D,KAAK,CAAC,OAAO,CAAC,CAAC;QAFE,OAAE,GAAF,EAAE,CAA2C;IAGlE,CAAC;IATD,MAAM,CAAC,YAAY,CAAC,OAAe,EAAE,EAA6C;QAC9E,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC/C,CAAC;IASD,UAAU,CAAC,KAAuB;QAC9B,OAAO,CAAC,MAAmB,EAAE,EAAE,CAC3B,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC;aACV,IAAI,CAAC,cAAc,CAAC,EAAE,CACnB,cAAc;YACV,CAAC,CAAC,IAAI,qBAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC;YACxD,CAAC,CAAC,IAAI,wBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,CAClE;aACA,KAAK,CAAC,KAAK,CAAC,EAAE;YACX,OAAO,IAAI,wBAAiB,CAAC,GAAI,IAAI,CAAC,QAAQ,EAAG,KAAM,KAAK,CAAC,OAAQ,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QACjG,CAAC,CAAC,CAAC;IACf,CAAC;CACJ;AAxBD,gDAwBC"}
1
+ {"version":3,"file":"ElementExpectation.js","sourceRoot":"","sources":["../../src/expectations/ElementExpectation.ts"],"names":[],"mappings":";;;AAAA,4CAAiH;AAIjH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAa,kBAAmB,SAAQ,kBAAwB;IAwC5D;;;OAGG;IACH,YACI,WAAmB,EACF,EAA6C;QAE9D,KAAK,CACD,WAAW,EACX,KAAK,EAAE,KAAuB,EAAE,MAA+B,EAAE,EAAE;YAC/D,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAE/C,IAAI;gBACA,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,WAAW,CAAC,CAAC;gBAErC,OAAO,MAAM;oBACT,CAAC,CAAC,IAAI,qBAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,WAAW,CAAC;oBAC7D,CAAC,CAAC,IAAI,wBAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;aACxE;YAAC,OAAM,KAAK,EAAE;gBACX,OAAO,IAAI,wBAAiB,CAAC,GAAI,WAAY,KAAM,KAAK,CAAC,OAAQ,GAAG,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;aACjG;QACL,CAAC,CACJ,CAAC;QAjBe,OAAE,GAAF,EAAE,CAA2C;IAkBlE,CAAC;IA9DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,MAAM,CAAC,YAAY,CAAC,WAAmB,EAAE,EAA6C;QAClF,OAAO,IAAI,kBAAkB,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACnD,CAAC;CA2BJ;AAjED,gDAiEC"}
@@ -1,6 +1,6 @@
1
+ export * from './ElementExpectation';
1
2
  export * from './isActive';
2
3
  export * from './isClickable';
3
4
  export * from './isEnabled';
4
- export * from './isPresent';
5
5
  export * from './isSelected';
6
6
  export * from './isVisible';
@@ -10,10 +10,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./ElementExpectation"), exports);
13
14
  __exportStar(require("./isActive"), exports);
14
15
  __exportStar(require("./isClickable"), exports);
15
16
  __exportStar(require("./isEnabled"), exports);
16
- __exportStar(require("./isPresent"), exports);
17
17
  __exportStar(require("./isSelected"), exports);
18
18
  __exportStar(require("./isVisible"), exports);
19
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/expectations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA2B;AAC3B,gDAA8B;AAC9B,8CAA4B;AAC5B,8CAA4B;AAC5B,+CAA6B;AAC7B,8CAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/expectations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAqC;AACrC,6CAA2B;AAC3B,gDAA8B;AAC9B,8CAA4B;AAC5B,+CAA6B;AAC7B,8CAA4B"}
@@ -12,4 +12,4 @@ import { PageElement } from '../screenplay';
12
12
  * @see {@link @serenity-js/core/lib/screenplay/questions~Check}
13
13
  * @see {@link Wait}
14
14
  */
15
- export declare function isActive(): Expectation<boolean, PageElement>;
15
+ export declare function isActive(): Expectation<PageElement>;
@@ -17,4 +17,4 @@ import { PageElement } from '../screenplay';
17
17
  * @see {@link @serenity-js/core/lib/screenplay/questions~Check}
18
18
  * @see {@link Wait}
19
19
  */
20
- export declare function isClickable(): Expectation<boolean, PageElement>;
20
+ export declare function isClickable(): Expectation<PageElement>;
@@ -1 +1 @@
1
- {"version":3,"file":"isClickable.js","sourceRoot":"","sources":["../../src/expectations/isClickable.ts"],"names":[],"mappings":";;;AAAA,wDAA8C;AAC9C,4CAAgD;AAGhD,6DAA0D;AAC1D,2CAAwC;AACxC,2CAAwC;AAExC;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,WAAW;IACvB,OAAO,kBAAW,CAAC,EAAE,CAAc,kBAAkB,CAAC,CAAC,YAAY,CAAC,IAAA,gBAAG,EACnE,IAAA,qBAAS,GAAE,EACX,IAAA,qBAAS,GAAE,EACX,uCAAkB,CAAC,YAAY,CAAC,kBAAkB,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CACtF,CAAC,CAAC;AACP,CAAC;AAND,kCAMC"}
1
+ {"version":3,"file":"isClickable.js","sourceRoot":"","sources":["../../src/expectations/isClickable.ts"],"names":[],"mappings":";;;AAAA,wDAA8C;AAC9C,4CAAgD;AAGhD,6DAA0D;AAC1D,2CAAwC;AACxC,2CAAwC;AAExC;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,WAAW;IACvB,OAAO,kBAAW,CAAC,EAAE,CAAuB,kBAAkB,CAAC,CAAC,YAAY,CAAC,IAAA,gBAAG,EAC5E,IAAA,qBAAS,GAAE,EACX,IAAA,qBAAS,GAAE,EACX,uCAAkB,CAAC,YAAY,CAAC,kBAAkB,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CACtF,CAAC,CAAC;AACP,CAAC;AAND,kCAMC"}
@@ -11,4 +11,4 @@ import { PageElement } from '../screenplay';
11
11
  * @see {@link @serenity-js/core/lib/screenplay/questions~Check}
12
12
  * @see {@link Wait}
13
13
  */
14
- export declare function isEnabled(): Expectation<boolean, PageElement>;
14
+ export declare function isEnabled(): Expectation<PageElement>;
@@ -11,4 +11,4 @@ import { PageElement } from '../screenplay';
11
11
  * @see {@link @serenity-js/core/lib/screenplay/questions~Check}
12
12
  * @see {@link Wait}
13
13
  */
14
- export declare function isSelected(): Expectation<boolean, PageElement>;
14
+ export declare function isSelected(): Expectation<PageElement>;
@@ -4,7 +4,6 @@ exports.isSelected = void 0;
4
4
  const assertions_1 = require("@serenity-js/assertions");
5
5
  const core_1 = require("@serenity-js/core");
6
6
  const ElementExpectation_1 = require("./ElementExpectation");
7
- const isPresent_1 = require("./isPresent");
8
7
  /**
9
8
  * @desc
10
9
  * Expectation that an `<option>` or `<input>` element of type checkbox or radio is currently selected.
@@ -17,7 +16,7 @@ const isPresent_1 = require("./isPresent");
17
16
  * @see {@link Wait}
18
17
  */
19
18
  function isSelected() {
20
- return core_1.Expectation.to('become selected').soThatActual((0, assertions_1.and)((0, isPresent_1.isPresent)(), ElementExpectation_1.ElementExpectation.forElementTo('become selected', actual => actual.isSelected())));
19
+ return core_1.Expectation.to('become selected').soThatActual((0, assertions_1.and)((0, assertions_1.isPresent)(), ElementExpectation_1.ElementExpectation.forElementTo('become selected', actual => actual.isSelected())));
21
20
  }
22
21
  exports.isSelected = isSelected;
23
22
  //# sourceMappingURL=isSelected.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isSelected.js","sourceRoot":"","sources":["../../src/expectations/isSelected.ts"],"names":[],"mappings":";;;AAAA,wDAA8C;AAC9C,4CAAgD;AAGhD,6DAA0D;AAC1D,2CAAwC;AAExC;;;;;;;;;;GAUG;AACH,SAAgB,UAAU;IACtB,OAAO,kBAAW,CAAC,EAAE,CAAc,iBAAiB,CAAC,CAAC,YAAY,CAAC,IAAA,gBAAG,EAClE,IAAA,qBAAS,GAAE,EACX,uCAAkB,CAAC,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CACpF,CAAC,CAAC;AACP,CAAC;AALD,gCAKC"}
1
+ {"version":3,"file":"isSelected.js","sourceRoot":"","sources":["../../src/expectations/isSelected.ts"],"names":[],"mappings":";;;AAAA,wDAAyD;AACzD,4CAAgD;AAGhD,6DAA0D;AAE1D;;;;;;;;;;GAUG;AACH,SAAgB,UAAU;IACtB,OAAO,kBAAW,CAAC,EAAE,CAAuB,iBAAiB,CAAC,CAAC,YAAY,CAAC,IAAA,gBAAG,EAC3E,IAAA,sBAAS,GAAE,EACX,uCAAkB,CAAC,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CACpF,CAAC,CAAC;AACP,CAAC;AALD,gCAKC"}
@@ -11,4 +11,4 @@ import { PageElement } from '../screenplay';
11
11
  * @see {@link @serenity-js/core/lib/screenplay/questions~Check}
12
12
  * @see {@link Wait}
13
13
  */
14
- export declare function isVisible(): Expectation<boolean, PageElement>;
14
+ export declare function isVisible(): Expectation<PageElement>;
@@ -1,8 +1,9 @@
1
1
  import { Ability, Duration, UsesAbilities } from '@serenity-js/core';
2
2
  import { Key } from '../../input';
3
- import { Cookie, CookieData, ModalDialog, NativeElementLocator, Page, PageElement, Selector } from '../models';
3
+ import { Cookie, CookieData, Locator, ModalDialog, Page, PageElement, Selector } from '../models';
4
4
  import { BrowserCapabilities } from './BrowserCapabilities';
5
- export declare abstract class BrowseTheWeb<Native_Element_Type = any> implements Ability {
5
+ export declare abstract class BrowseTheWeb<Native_Element_Type = any, Native_Root_Element_Type = unknown> implements Ability {
6
+ protected locators: Map<new (...args: unknown[]) => Selector, (selector: Selector) => Locator<Native_Element_Type, Native_Root_Element_Type>>;
6
7
  /**
7
8
  * @desc
8
9
  * Used to access the Actor's ability to {@link BrowseTheWeb}
@@ -12,16 +13,15 @@ export declare abstract class BrowseTheWeb<Native_Element_Type = any> implements
12
13
  * @param {@serenity-js/core/lib/screenplay/actor~UsesAbilities} actor
13
14
  * @return {BrowseTheWeb}
14
15
  */
15
- static as(actor: UsesAbilities): BrowseTheWeb;
16
+ static as<NET = any, NRET = unknown>(actor: UsesAbilities): BrowseTheWeb<NET, NRET>;
17
+ constructor(locators: Map<new (...args: unknown[]) => Selector, (selector: Selector) => Locator<Native_Element_Type, Native_Root_Element_Type>>);
16
18
  abstract navigateTo(destination: string): Promise<void>;
17
19
  abstract navigateBack(): Promise<void>;
18
20
  abstract navigateForward(): Promise<void>;
19
21
  abstract reloadPage(): Promise<void>;
20
22
  abstract waitFor(duration: Duration): Promise<void>;
21
23
  abstract waitUntil(condition: () => boolean | Promise<boolean>, timeout: Duration): Promise<void>;
22
- abstract locate<T>(selector: Selector<T>, locator?: NativeElementLocator<Native_Element_Type>): PageElement<Native_Element_Type>;
23
- abstract locateAll<T>(selector: Selector<T>, locator?: NativeElementLocator<Native_Element_Type>): Promise<Array<PageElement<Native_Element_Type>>>;
24
- abstract nativeElementLocator(): NativeElementLocator<Native_Element_Type>;
24
+ locate(selector: Selector): Locator<Native_Element_Type, Native_Root_Element_Type>;
25
25
  abstract browserCapabilities(): Promise<BrowserCapabilities>;
26
26
  abstract sendKeys(keys: Array<Key | string>): Promise<void>;
27
27
  abstract executeScript<Result, InnerArguments extends any[]>(script: string | ((...parameters: InnerArguments) => Result), ...args: InnerArguments): Promise<Result>;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BrowseTheWeb = void 0;
4
+ const core_1 = require("@serenity-js/core");
4
5
  class BrowseTheWeb {
6
+ constructor(locators) {
7
+ this.locators = locators;
8
+ }
5
9
  /**
6
10
  * @desc
7
11
  * Used to access the Actor's ability to {@link BrowseTheWeb}
@@ -14,6 +18,14 @@ class BrowseTheWeb {
14
18
  static as(actor) {
15
19
  return actor.abilityTo(BrowseTheWeb);
16
20
  }
21
+ locate(selector) {
22
+ for (const [type, locatorFactory] of this.locators) {
23
+ if (selector instanceof type) {
24
+ return locatorFactory(selector);
25
+ }
26
+ }
27
+ throw new core_1.LogicError((0, core_1.f) `${selector} is not supported by ${this.constructor.name}`);
28
+ }
17
29
  }
18
30
  exports.BrowseTheWeb = BrowseTheWeb;
19
31
  //# sourceMappingURL=BrowseTheWeb.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BrowseTheWeb.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/BrowseTheWeb.ts"],"names":[],"mappings":";;;AAMA,MAAsB,YAAY;IAC9B;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,CAAC,KAAoB;QAC1B,OAAO,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACzC,CAAC;CA+DJ;AA3ED,oCA2EC"}
1
+ {"version":3,"file":"BrowseTheWeb.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/BrowseTheWeb.ts"],"names":[],"mappings":";;;AAAA,4CAAoF;AAMpF,MAAsB,YAAY;IAc9B,YACc,QAIT;QAJS,aAAQ,GAAR,QAAQ,CAIjB;IAEL,CAAC;IApBD;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,CAA4B,KAAoB;QACrD,OAAO,KAAK,CAAC,SAAS,CAAC,YAAY,CAA4B,CAAC;IACpE,CAAC;IAuBD,MAAM,CAAC,QAAkB;QACrB,KAAK,MAAM,CAAE,IAAI,EAAE,cAAc,CAAE,IAAI,IAAI,CAAC,QAAQ,EAAE;YAClD,IAAI,QAAQ,YAAY,IAAI,EAAE;gBAC1B,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC;aACnC;SACJ;QAED,MAAM,IAAI,iBAAU,CAAC,IAAA,QAAC,EAAC,GAAI,QAAS,wBAAyB,IAAI,CAAC,WAAW,CAAC,IAAK,EAAE,CAAC,CAAC;IAC3F,CAAC;CA+CJ;AA1FD,oCA0FC"}
@@ -112,7 +112,6 @@ class PressKeyInField extends PageElementInteraction_1.PageElementInteraction {
112
112
  const field = await this.resolve(actor, this.field);
113
113
  const keys = await actor.answer(this.keys);
114
114
  // fix for protractor
115
- // todo: should this wait on focus to occur?
116
115
  await abilities_1.BrowseTheWeb.as(actor).executeScript(
117
116
  /* istanbul ignore next */
118
117
  function focus(element) {
@@ -1 +1 @@
1
- {"version":3,"file":"Press.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Press.ts"],"names":[],"mappings":";;;AAAA,4CAAiH;AACjH,iDAA+D;AAE/D,uCAAkC;AAClC,4CAA4C;AAE5C,qEAAkE;AAGlE;;;;;;;;;;;;;;;;;;;;;;;;;;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AC,GAAI,GAAG,CAAC,WAAY,GAAG,GAAG,CAAC,SAAS,GAAI,GAAI,EAAE;gBACpD,SAAS;aACZ,CAAA;QACL,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,WAAW,CAAC;QAErD,OAAO,GAAI,MAAO,IAAK,WAAY,EAAE,CAAC;IAC1C,CAAC;CACJ"}
@@ -139,5 +139,5 @@ export declare class Wait {
139
139
  *
140
140
  * @returns {@serenity-js/core/lib/screenplay~Interaction}
141
141
  */
142
- static until<Actual>(actual: Answerable<Actual>, expectation: Expectation<any, Actual>): Interaction;
142
+ static until<Actual>(actual: Answerable<Actual>, expectation: Expectation<Actual>): Interaction;
143
143
  }
@@ -211,16 +211,12 @@ class WaitUntil extends core_1.Interaction {
211
211
  * @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
212
212
  */
213
213
  performAs(actor) {
214
- const actual = this.actual, expectation = this.expectation.answeredBy(actor);
214
+ const actual = this.actual, expectation = this.expectation;
215
215
  let expectationOutcome;
216
216
  return abilities_1.BrowseTheWeb.as(actor)
217
- .waitUntil(function () {
218
- return actor.answer(actual)
219
- .then(act => expectation(act))
220
- .then(outcome => {
221
- expectationOutcome = outcome;
222
- return outcome instanceof core_1.ExpectationMet;
223
- });
217
+ .waitUntil(async function () {
218
+ expectationOutcome = await actor.answer(expectation.isMetFor(actual));
219
+ return expectationOutcome instanceof core_1.ExpectationMet;
224
220
  }, this.timeout)
225
221
  .catch(error => {
226
222
  if (expectationOutcome) {
@@ -1 +1 @@
1
- {"version":3,"file":"Wait.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Wait.ts"],"names":[],"mappings":";;;AAAA,4CAAwK;AACxK,iDAAqD;AAErD,4CAA4C;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AACH,M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,OAAQ,UAAW,IAAI,CAAC,MAAO,SAAU,IAAI,CAAC,WAAY,EAAE,CAAC;IAC7G,CAAC;CACJ"}
@@ -28,5 +28,5 @@ export interface WaitBuilder {
28
28
  *
29
29
  * @see {@link Target}
30
30
  */
31
- until: <Actual>(actual: Answerable<Actual>, expectation: Expectation<any, Actual>) => Interaction;
31
+ until: <Actual>(actual: Answerable<Actual>, expectation: Expectation<Actual>) => Interaction;
32
32
  }
@@ -1,6 +1,6 @@
1
- import { Adapter, Answerable, Interaction, Question, Timestamp } from '@serenity-js/core';
1
+ import { Answerable, Interaction, Optional, QuestionAdapter, Timestamp } from '@serenity-js/core';
2
2
  import { CookieData } from './CookieData';
3
- export declare abstract class Cookie {
3
+ export declare abstract class Cookie implements Optional {
4
4
  protected readonly cookieName: string;
5
5
  /**
6
6
  * @desc
@@ -9,7 +9,7 @@ export declare abstract class Cookie {
9
9
  * @param {Answerable<string>} name
10
10
  * @returns {Question<Promise<Cookie>> & Adapter<Cookie>}
11
11
  */
12
- static called(name: Answerable<string>): Question<Promise<Cookie>> & Adapter<Cookie>;
12
+ static called(name: Answerable<string>): QuestionAdapter<Cookie>;
13
13
  /**
14
14
  * @desc
15
15
  * Sets a cookie for the current page.