@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.
- package/CHANGELOG.md +50 -0
- package/LICENSE.md +201 -0
- package/NOTICE.md +1 -0
- package/README.md +21 -0
- package/lib/errors/CookieMissingError.d.ts +4 -0
- package/lib/errors/CookieMissingError.js +11 -0
- package/lib/errors/CookieMissingError.js.map +1 -0
- package/lib/errors/index.d.ts +1 -0
- package/lib/errors/index.js +14 -0
- package/lib/errors/index.js.map +1 -0
- package/lib/expectations/ElementExpectation.d.ts +11 -0
- package/lib/expectations/ElementExpectation.js +27 -0
- package/lib/expectations/ElementExpectation.js.map +1 -0
- package/lib/expectations/index.d.ts +6 -0
- package/lib/expectations/index.js +19 -0
- package/lib/expectations/index.js.map +1 -0
- package/lib/expectations/isActive.d.ts +15 -0
- package/lib/expectations/isActive.js +22 -0
- package/lib/expectations/isActive.js.map +1 -0
- package/lib/expectations/isClickable.d.ts +20 -0
- package/lib/expectations/isClickable.js +30 -0
- package/lib/expectations/isClickable.js.map +1 -0
- package/lib/expectations/isEnabled.d.ts +14 -0
- package/lib/expectations/isEnabled.js +20 -0
- package/lib/expectations/isEnabled.js.map +1 -0
- package/lib/expectations/isPresent.d.ts +15 -0
- package/lib/expectations/isPresent.js +22 -0
- package/lib/expectations/isPresent.js.map +1 -0
- package/lib/expectations/isSelected.d.ts +14 -0
- package/lib/expectations/isSelected.js +23 -0
- package/lib/expectations/isSelected.js.map +1 -0
- package/lib/expectations/isVisible.d.ts +14 -0
- package/lib/expectations/isVisible.js +26 -0
- package/lib/expectations/isVisible.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/lib/input/Key.d.ts +73 -0
- package/lib/input/Key.js +84 -0
- package/lib/input/Key.js.map +1 -0
- package/lib/input/index.d.ts +1 -0
- package/lib/input/index.js +14 -0
- package/lib/input/index.js.map +1 -0
- package/lib/screenplay/abilities/BrowseTheWeb.d.ts +58 -0
- package/lib/screenplay/abilities/BrowseTheWeb.js +19 -0
- package/lib/screenplay/abilities/BrowseTheWeb.js.map +1 -0
- package/lib/screenplay/abilities/BrowserCapabilities.d.ts +5 -0
- package/lib/screenplay/abilities/BrowserCapabilities.js +3 -0
- package/lib/screenplay/abilities/BrowserCapabilities.js.map +1 -0
- package/lib/screenplay/abilities/index.d.ts +2 -0
- package/lib/screenplay/abilities/index.js +15 -0
- package/lib/screenplay/abilities/index.js.map +1 -0
- package/lib/screenplay/index.d.ts +4 -0
- package/lib/screenplay/index.js +17 -0
- package/lib/screenplay/index.js.map +1 -0
- package/lib/screenplay/interactions/Clear.d.ts +79 -0
- package/lib/screenplay/interactions/Clear.js +97 -0
- package/lib/screenplay/interactions/Clear.js.map +1 -0
- package/lib/screenplay/interactions/Click.d.ts +73 -0
- package/lib/screenplay/interactions/Click.js +85 -0
- package/lib/screenplay/interactions/Click.js.map +1 -0
- package/lib/screenplay/interactions/DoubleClick.d.ts +90 -0
- package/lib/screenplay/interactions/DoubleClick.js +101 -0
- package/lib/screenplay/interactions/DoubleClick.js.map +1 -0
- package/lib/screenplay/interactions/Enter.d.ts +73 -0
- package/lib/screenplay/interactions/Enter.js +86 -0
- package/lib/screenplay/interactions/Enter.js.map +1 -0
- package/lib/screenplay/interactions/EnterBuilder.d.ts +25 -0
- package/lib/screenplay/interactions/EnterBuilder.js +3 -0
- package/lib/screenplay/interactions/EnterBuilder.js.map +1 -0
- package/lib/screenplay/interactions/ExecuteScript.d.ts +206 -0
- package/lib/screenplay/interactions/ExecuteScript.js +312 -0
- package/lib/screenplay/interactions/ExecuteScript.js.map +1 -0
- package/lib/screenplay/interactions/Hover.d.ts +78 -0
- package/lib/screenplay/interactions/Hover.js +89 -0
- package/lib/screenplay/interactions/Hover.js.map +1 -0
- package/lib/screenplay/interactions/Navigate.d.ts +142 -0
- package/lib/screenplay/interactions/Navigate.js +198 -0
- package/lib/screenplay/interactions/Navigate.js.map +1 -0
- package/lib/screenplay/interactions/PageElementInteraction.d.ts +39 -0
- package/lib/screenplay/interactions/PageElementInteraction.js +54 -0
- package/lib/screenplay/interactions/PageElementInteraction.js.map +1 -0
- package/lib/screenplay/interactions/Press.d.ts +84 -0
- package/lib/screenplay/interactions/Press.js +171 -0
- package/lib/screenplay/interactions/Press.js.map +1 -0
- package/lib/screenplay/interactions/PressBuilder.d.ts +26 -0
- package/lib/screenplay/interactions/PressBuilder.js +3 -0
- package/lib/screenplay/interactions/PressBuilder.js.map +1 -0
- package/lib/screenplay/interactions/RightClick.d.ts +89 -0
- package/lib/screenplay/interactions/RightClick.js +100 -0
- package/lib/screenplay/interactions/RightClick.js.map +1 -0
- package/lib/screenplay/interactions/Scroll.d.ts +83 -0
- package/lib/screenplay/interactions/Scroll.js +97 -0
- package/lib/screenplay/interactions/Scroll.js.map +1 -0
- package/lib/screenplay/interactions/Select.d.ts +212 -0
- package/lib/screenplay/interactions/Select.js +291 -0
- package/lib/screenplay/interactions/Select.js.map +1 -0
- package/lib/screenplay/interactions/SelectBuilder.d.ts +33 -0
- package/lib/screenplay/interactions/SelectBuilder.js +3 -0
- package/lib/screenplay/interactions/SelectBuilder.js.map +1 -0
- package/lib/screenplay/interactions/Switch.d.ts +150 -0
- package/lib/screenplay/interactions/Switch.js +209 -0
- package/lib/screenplay/interactions/Switch.js.map +1 -0
- package/lib/screenplay/interactions/TakeScreenshot.d.ts +67 -0
- package/lib/screenplay/interactions/TakeScreenshot.js +86 -0
- package/lib/screenplay/interactions/TakeScreenshot.js.map +1 -0
- package/lib/screenplay/interactions/Wait.d.ts +143 -0
- package/lib/screenplay/interactions/Wait.js +242 -0
- package/lib/screenplay/interactions/Wait.js.map +1 -0
- package/lib/screenplay/interactions/WaitBuilder.d.ts +32 -0
- package/lib/screenplay/interactions/WaitBuilder.js +3 -0
- package/lib/screenplay/interactions/WaitBuilder.js.map +1 -0
- package/lib/screenplay/interactions/index.d.ts +16 -0
- package/lib/screenplay/interactions/index.js +29 -0
- package/lib/screenplay/interactions/index.js.map +1 -0
- package/lib/screenplay/models/Cookie.d.ts +117 -0
- package/lib/screenplay/models/Cookie.js +176 -0
- package/lib/screenplay/models/Cookie.js.map +1 -0
- package/lib/screenplay/models/CookieData.d.ts +89 -0
- package/lib/screenplay/models/CookieData.js +3 -0
- package/lib/screenplay/models/CookieData.js.map +1 -0
- package/lib/screenplay/models/ModalDialog.d.ts +9 -0
- package/lib/screenplay/models/ModalDialog.js +14 -0
- package/lib/screenplay/models/ModalDialog.js.map +1 -0
- package/lib/screenplay/models/Page.d.ts +83 -0
- package/lib/screenplay/models/Page.js +52 -0
- package/lib/screenplay/models/Page.js.map +1 -0
- package/lib/screenplay/models/PageElement.d.ts +30 -0
- package/lib/screenplay/models/PageElement.js +62 -0
- package/lib/screenplay/models/PageElement.js.map +1 -0
- package/lib/screenplay/models/PageElements.d.ts +20 -0
- package/lib/screenplay/models/PageElements.js +49 -0
- package/lib/screenplay/models/PageElements.js.map +1 -0
- package/lib/screenplay/models/index.d.ts +6 -0
- package/lib/screenplay/models/index.js +19 -0
- package/lib/screenplay/models/index.js.map +1 -0
- package/lib/screenplay/questions/Attribute.d.ts +83 -0
- package/lib/screenplay/questions/Attribute.js +103 -0
- package/lib/screenplay/questions/Attribute.js.map +1 -0
- package/lib/screenplay/questions/CssClasses.d.ts +93 -0
- package/lib/screenplay/questions/CssClasses.js +113 -0
- package/lib/screenplay/questions/CssClasses.js.map +1 -0
- package/lib/screenplay/questions/ElementQuestion.d.ts +34 -0
- package/lib/screenplay/questions/ElementQuestion.js +53 -0
- package/lib/screenplay/questions/ElementQuestion.js.map +1 -0
- package/lib/screenplay/questions/LastScriptExecution.d.ts +14 -0
- package/lib/screenplay/questions/LastScriptExecution.js +22 -0
- package/lib/screenplay/questions/LastScriptExecution.js.map +1 -0
- package/lib/screenplay/questions/Selected.d.ts +185 -0
- package/lib/screenplay/questions/Selected.js +210 -0
- package/lib/screenplay/questions/Selected.js.map +1 -0
- package/lib/screenplay/questions/Text.d.ts +99 -0
- package/lib/screenplay/questions/Text.js +131 -0
- package/lib/screenplay/questions/Text.js.map +1 -0
- package/lib/screenplay/questions/Value.d.ts +64 -0
- package/lib/screenplay/questions/Value.js +78 -0
- package/lib/screenplay/questions/Value.js.map +1 -0
- package/lib/screenplay/questions/index.d.ts +6 -0
- package/lib/screenplay/questions/index.js +19 -0
- package/lib/screenplay/questions/index.js.map +1 -0
- package/lib/stage/crew/index.d.ts +1 -0
- package/lib/stage/crew/index.js +14 -0
- package/lib/stage/crew/index.js.map +1 -0
- package/lib/stage/crew/photographer/Photographer.d.ts +83 -0
- package/lib/stage/crew/photographer/Photographer.js +102 -0
- package/lib/stage/crew/photographer/Photographer.js.map +1 -0
- package/lib/stage/crew/photographer/index.d.ts +2 -0
- package/lib/stage/crew/photographer/index.js +15 -0
- package/lib/stage/crew/photographer/index.js.map +1 -0
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.d.ts +28 -0
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js +81 -0
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js.map +1 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.d.ts +18 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js +30 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js.map +1 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.d.ts +17 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js +28 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js.map +1 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.d.ts +19 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js +28 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js.map +1 -0
- package/lib/stage/crew/photographer/strategies/index.d.ts +4 -0
- package/lib/stage/crew/photographer/strategies/index.js +17 -0
- package/lib/stage/crew/photographer/strategies/index.js.map +1 -0
- package/lib/stage/index.d.ts +1 -0
- package/lib/stage/index.js +14 -0
- package/lib/stage/index.js.map +1 -0
- package/package.json +85 -0
- package/src/errors/CookieMissingError.ts +7 -0
- package/src/errors/index.ts +1 -0
- package/src/expectations/ElementExpectation.ts +32 -0
- package/src/expectations/index.ts +6 -0
- package/src/expectations/isActive.ts +22 -0
- package/src/expectations/isClickable.ts +32 -0
- package/src/expectations/isEnabled.ts +19 -0
- package/src/expectations/isPresent.ts +21 -0
- package/src/expectations/isSelected.ts +24 -0
- package/src/expectations/isVisible.ts +28 -0
- package/src/index.ts +5 -0
- package/src/input/Key.ts +83 -0
- package/src/input/index.ts +1 -0
- package/src/screenplay/abilities/BrowseTheWeb.ts +89 -0
- package/src/screenplay/abilities/BrowserCapabilities.ts +5 -0
- package/src/screenplay/abilities/index.ts +2 -0
- package/src/screenplay/index.ts +4 -0
- package/src/screenplay/interactions/Clear.ts +102 -0
- package/src/screenplay/interactions/Click.ts +86 -0
- package/src/screenplay/interactions/DoubleClick.ts +102 -0
- package/src/screenplay/interactions/Enter.ts +92 -0
- package/src/screenplay/interactions/EnterBuilder.ts +28 -0
- package/src/screenplay/interactions/ExecuteScript.ts +345 -0
- package/src/screenplay/interactions/Hover.ts +90 -0
- package/src/screenplay/interactions/Navigate.ts +209 -0
- package/src/screenplay/interactions/PageElementInteraction.ts +59 -0
- package/src/screenplay/interactions/Press.ts +194 -0
- package/src/screenplay/interactions/PressBuilder.ts +29 -0
- package/src/screenplay/interactions/RightClick.ts +100 -0
- package/src/screenplay/interactions/Scroll.ts +99 -0
- package/src/screenplay/interactions/Select.ts +317 -0
- package/src/screenplay/interactions/SelectBuilder.ts +36 -0
- package/src/screenplay/interactions/Switch.ts +225 -0
- package/src/screenplay/interactions/TakeScreenshot.ts +89 -0
- package/src/screenplay/interactions/Wait.ts +264 -0
- package/src/screenplay/interactions/WaitBuilder.ts +34 -0
- package/src/screenplay/interactions/index.ts +16 -0
- package/src/screenplay/models/Cookie.ts +219 -0
- package/src/screenplay/models/CookieData.ts +97 -0
- package/src/screenplay/models/ModalDialog.ts +19 -0
- package/src/screenplay/models/Page.ts +147 -0
- package/src/screenplay/models/PageElement.ts +95 -0
- package/src/screenplay/models/PageElements.ts +70 -0
- package/src/screenplay/models/index.ts +6 -0
- package/src/screenplay/questions/Attribute.ts +112 -0
- package/src/screenplay/questions/CssClasses.ts +118 -0
- package/src/screenplay/questions/ElementQuestion.ts +60 -0
- package/src/screenplay/questions/LastScriptExecution.ts +21 -0
- package/src/screenplay/questions/Selected.ts +212 -0
- package/src/screenplay/questions/Text.ts +153 -0
- package/src/screenplay/questions/Value.ts +82 -0
- package/src/screenplay/questions/index.ts +6 -0
- package/src/stage/crew/index.ts +1 -0
- package/src/stage/crew/photographer/Photographer.ts +108 -0
- package/src/stage/crew/photographer/index.ts +2 -0
- package/src/stage/crew/photographer/strategies/PhotoTakingStrategy.ts +116 -0
- package/src/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.ts +28 -0
- package/src/stage/crew/photographer/strategies/TakePhotosOfFailures.ts +26 -0
- package/src/stage/crew/photographer/strategies/TakePhotosOfInteractions.ts +26 -0
- package/src/stage/crew/photographer/strategies/index.ts +4 -0
- package/src/stage/index.ts +1 -0
- package/tsconfig.eslint.json +10 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { Answerable } from '@serenity-js/core';
|
|
2
|
+
import { SelectBuilder } from './SelectBuilder';
|
|
3
|
+
/**
|
|
4
|
+
* @desc
|
|
5
|
+
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
6
|
+
* select an option from a [HTML `<select>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select),
|
|
7
|
+
* either by its display name, or by value.
|
|
8
|
+
*
|
|
9
|
+
* @see {@link Selected}
|
|
10
|
+
*/
|
|
11
|
+
export declare class Select {
|
|
12
|
+
/**
|
|
13
|
+
* @desc
|
|
14
|
+
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
15
|
+
* with a [`value`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option#attr-value)
|
|
16
|
+
* of a single [`<option>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
17
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor} to select.
|
|
18
|
+
*
|
|
19
|
+
* @example <caption>Example widget</caption>
|
|
20
|
+
* <select data-test='countries'>
|
|
21
|
+
* <option value='UK'>United Kingdom</option>
|
|
22
|
+
* <option value='PL'>Poland</option>
|
|
23
|
+
* <option value='US'>United States</option>
|
|
24
|
+
* </select>
|
|
25
|
+
*
|
|
26
|
+
* @example <caption>Lean Page Object describing the widget</caption>
|
|
27
|
+
* import { Target } from '@serenity-js/protractor';
|
|
28
|
+
* import { browser, by } from 'protractor';
|
|
29
|
+
*
|
|
30
|
+
* class Countries {
|
|
31
|
+
* static dropdown = Target.the('countries dropdown')
|
|
32
|
+
* .located(by.css('[data-test="countries"]'));
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* @example <caption>Retrieving the selected value</caption>
|
|
36
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
37
|
+
* import { BrowseTheWeb, Select, Selected } from '@serenity-js/protractor';
|
|
38
|
+
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
39
|
+
* import { protractor } from 'protractor';
|
|
40
|
+
*
|
|
41
|
+
* actorCalled('Nick')
|
|
42
|
+
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
43
|
+
* .attemptsTo(
|
|
44
|
+
* Select.value('UK').from(Countries.dropdown),
|
|
45
|
+
* Ensure.that(Selected.valueOf(Countries.dropdown), equals('UK')),
|
|
46
|
+
* );
|
|
47
|
+
*
|
|
48
|
+
* @param {Answerable<string>} value
|
|
49
|
+
* A value of the [`option` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
50
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor} to select
|
|
51
|
+
*
|
|
52
|
+
* @returns {SelectBuilder}
|
|
53
|
+
*
|
|
54
|
+
* @see {@link Selected.valueOf}
|
|
55
|
+
* @see {@link BrowseTheWeb}
|
|
56
|
+
* @see {@link Target}
|
|
57
|
+
* @see {@link @serenity-js/assertions~Ensure}
|
|
58
|
+
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
59
|
+
*/
|
|
60
|
+
static value(value: Answerable<string>): SelectBuilder;
|
|
61
|
+
/**
|
|
62
|
+
* @desc
|
|
63
|
+
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
64
|
+
* with [`value`s](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option#attr-value)
|
|
65
|
+
* of multiple [`<option>` elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
66
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor} to select.
|
|
67
|
+
*
|
|
68
|
+
* @example <caption>Example widget</caption>
|
|
69
|
+
* <select multiple data-test='countries'>
|
|
70
|
+
* <option value='UK'>United Kingdom</option>
|
|
71
|
+
* <option value='PL'>Poland</option>
|
|
72
|
+
* <option value='US'>United States</option>
|
|
73
|
+
* </select>
|
|
74
|
+
*
|
|
75
|
+
* @example <caption>Lean Page Object describing the widget</caption>
|
|
76
|
+
* import { Target } from '@serenity-js/protractor';
|
|
77
|
+
* import { browser, by } from 'protractor';
|
|
78
|
+
*
|
|
79
|
+
* class Countries {
|
|
80
|
+
* static dropdown = Target.the('countries dropdown')
|
|
81
|
+
* .located(by.css('[data-test="countries"]'));
|
|
82
|
+
* }
|
|
83
|
+
*
|
|
84
|
+
* @example <caption>Retrieving the selected value</caption>
|
|
85
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
86
|
+
* import { BrowseTheWeb, Select, Selected } from '@serenity-js/protractor';
|
|
87
|
+
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
88
|
+
* import { protractor } from 'protractor';
|
|
89
|
+
*
|
|
90
|
+
* actorCalled('Nick')
|
|
91
|
+
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
92
|
+
* .attemptsTo(
|
|
93
|
+
* Select.values('UK').from(Countries.dropdown),
|
|
94
|
+
* Ensure.that(Selected.valuesOf(Countries.dropdown), equals([ 'UK' ])),
|
|
95
|
+
* );
|
|
96
|
+
*
|
|
97
|
+
* @param {Array<Answerable<string[] | string>>} values
|
|
98
|
+
* Values of the [`option` elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
99
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor} to select
|
|
100
|
+
*
|
|
101
|
+
* @returns {SelectBuilder}
|
|
102
|
+
*
|
|
103
|
+
* @see {@link Selected.valuesOf}
|
|
104
|
+
* @see {@link BrowseTheWeb}
|
|
105
|
+
* @see {@link Target}
|
|
106
|
+
* @see {@link @serenity-js/assertions~Ensure}
|
|
107
|
+
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
108
|
+
*/
|
|
109
|
+
static values(...values: Array<Answerable<string[] | string>>): SelectBuilder;
|
|
110
|
+
/**
|
|
111
|
+
* @desc
|
|
112
|
+
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
113
|
+
* with a single [`option`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
114
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor} to select.
|
|
115
|
+
*
|
|
116
|
+
* @example <caption>Example widget</caption>
|
|
117
|
+
* <select data-test='countries'>
|
|
118
|
+
* <option value='UK'>United Kingdom</option>
|
|
119
|
+
* <option value='PL'>Poland</option>
|
|
120
|
+
* <option value='US'>United States</option>
|
|
121
|
+
* </select>
|
|
122
|
+
*
|
|
123
|
+
* @example <caption>Lean Page Object describing the widget</caption>
|
|
124
|
+
* import { Target } from '@serenity-js/protractor';
|
|
125
|
+
* import { browser, by } from 'protractor';
|
|
126
|
+
*
|
|
127
|
+
* class Countries {
|
|
128
|
+
* static dropdown = Target.the('countries dropdown')
|
|
129
|
+
* .located(by.css('[data-test="countries"]'));
|
|
130
|
+
* }
|
|
131
|
+
*
|
|
132
|
+
* @example <caption>Retrieving the selected value</caption>
|
|
133
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
134
|
+
* import { BrowseTheWeb, Select, Selected } from '@serenity-js/protractor';
|
|
135
|
+
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
136
|
+
* import { protractor } from 'protractor';
|
|
137
|
+
*
|
|
138
|
+
* actorCalled('Nick')
|
|
139
|
+
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
140
|
+
* .attemptsTo(
|
|
141
|
+
* Select.option('Poland').from(Countries.dropdown),
|
|
142
|
+
* Ensure.that(
|
|
143
|
+
* Selected.optionIn(Countries.dropdown),
|
|
144
|
+
* equals('Poland')
|
|
145
|
+
* ),
|
|
146
|
+
* );
|
|
147
|
+
*
|
|
148
|
+
* @param {Answerable<string>} value
|
|
149
|
+
* Text of the [`option` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
150
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor} to select
|
|
151
|
+
*
|
|
152
|
+
* @returns {SelectBuilder}
|
|
153
|
+
*
|
|
154
|
+
* @see {@link Selected.optionIn}
|
|
155
|
+
* @see {@link BrowseTheWeb}
|
|
156
|
+
* @see {@link Target}
|
|
157
|
+
* @see {@link @serenity-js/assertions~Ensure}
|
|
158
|
+
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
159
|
+
*/
|
|
160
|
+
static option(value: Answerable<string>): SelectBuilder;
|
|
161
|
+
/**
|
|
162
|
+
* @desc
|
|
163
|
+
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
164
|
+
* with [`option`s](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
165
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor} to select.
|
|
166
|
+
*
|
|
167
|
+
* @example <caption>Example widget</caption>
|
|
168
|
+
* <select multiple data-test='countries'>
|
|
169
|
+
* <option value='UK'>United Kingdom</option>
|
|
170
|
+
* <option value='PL'>Poland</option>
|
|
171
|
+
* <option value='US'>United States</option>
|
|
172
|
+
* </select>
|
|
173
|
+
*
|
|
174
|
+
* @example <caption>Lean Page Object describing the widget</caption>
|
|
175
|
+
* import { Target } from '@serenity-js/protractor';
|
|
176
|
+
* import { browser, by } from 'protractor';
|
|
177
|
+
*
|
|
178
|
+
* class Countries {
|
|
179
|
+
* static dropdown = Target.the('countries dropdown')
|
|
180
|
+
* .located(by.css('[data-test="countries"]'));
|
|
181
|
+
* }
|
|
182
|
+
*
|
|
183
|
+
* @example <caption>Retrieving the selected value</caption>
|
|
184
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
185
|
+
* import { BrowseTheWeb, Select, Selected } from '@serenity-js/protractor';
|
|
186
|
+
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
187
|
+
* import { protractor } from 'protractor';
|
|
188
|
+
*
|
|
189
|
+
* actorCalled('Nick')
|
|
190
|
+
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
191
|
+
* .attemptsTo(
|
|
192
|
+
* Select.options('Poland', 'United States').from(Countries.dropdown),
|
|
193
|
+
* Ensure.that(
|
|
194
|
+
* Selected.optionsIn(Countries.dropdown),
|
|
195
|
+
* equals([ 'Poland', 'United States' ])
|
|
196
|
+
* ),
|
|
197
|
+
* );
|
|
198
|
+
*
|
|
199
|
+
* @param {Array<Answerable<string[] | string>>} values
|
|
200
|
+
* Text of the [`option` elements ](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
201
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor} to select
|
|
202
|
+
*
|
|
203
|
+
* @returns {SelectBuilder}
|
|
204
|
+
*
|
|
205
|
+
* @see {@link Selected.optionsIn}
|
|
206
|
+
* @see {@link BrowseTheWeb}
|
|
207
|
+
* @see {@link Target}
|
|
208
|
+
* @see {@link @serenity-js/assertions~Ensure}
|
|
209
|
+
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
210
|
+
*/
|
|
211
|
+
static options(...values: Array<Answerable<string[] | string>>): SelectBuilder;
|
|
212
|
+
}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Select = void 0;
|
|
4
|
+
const core_1 = require("@serenity-js/core");
|
|
5
|
+
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
|
+
const inspected_1 = require("@serenity-js/core/lib/io/inspected");
|
|
7
|
+
const screenplay_1 = require("@serenity-js/core/lib/screenplay");
|
|
8
|
+
const models_1 = require("../models");
|
|
9
|
+
/**
|
|
10
|
+
* @desc
|
|
11
|
+
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
12
|
+
* select an option from a [HTML `<select>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select),
|
|
13
|
+
* either by its display name, or by value.
|
|
14
|
+
*
|
|
15
|
+
* @see {@link Selected}
|
|
16
|
+
*/
|
|
17
|
+
class Select {
|
|
18
|
+
/**
|
|
19
|
+
* @desc
|
|
20
|
+
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
21
|
+
* with a [`value`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option#attr-value)
|
|
22
|
+
* of a single [`<option>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
23
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor} to select.
|
|
24
|
+
*
|
|
25
|
+
* @example <caption>Example widget</caption>
|
|
26
|
+
* <select data-test='countries'>
|
|
27
|
+
* <option value='UK'>United Kingdom</option>
|
|
28
|
+
* <option value='PL'>Poland</option>
|
|
29
|
+
* <option value='US'>United States</option>
|
|
30
|
+
* </select>
|
|
31
|
+
*
|
|
32
|
+
* @example <caption>Lean Page Object describing the widget</caption>
|
|
33
|
+
* import { Target } from '@serenity-js/protractor';
|
|
34
|
+
* import { browser, by } from 'protractor';
|
|
35
|
+
*
|
|
36
|
+
* class Countries {
|
|
37
|
+
* static dropdown = Target.the('countries dropdown')
|
|
38
|
+
* .located(by.css('[data-test="countries"]'));
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* @example <caption>Retrieving the selected value</caption>
|
|
42
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
43
|
+
* import { BrowseTheWeb, Select, Selected } from '@serenity-js/protractor';
|
|
44
|
+
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
45
|
+
* import { protractor } from 'protractor';
|
|
46
|
+
*
|
|
47
|
+
* actorCalled('Nick')
|
|
48
|
+
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
49
|
+
* .attemptsTo(
|
|
50
|
+
* Select.value('UK').from(Countries.dropdown),
|
|
51
|
+
* Ensure.that(Selected.valueOf(Countries.dropdown), equals('UK')),
|
|
52
|
+
* );
|
|
53
|
+
*
|
|
54
|
+
* @param {Answerable<string>} value
|
|
55
|
+
* A value of the [`option` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
56
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor} to select
|
|
57
|
+
*
|
|
58
|
+
* @returns {SelectBuilder}
|
|
59
|
+
*
|
|
60
|
+
* @see {@link Selected.valueOf}
|
|
61
|
+
* @see {@link BrowseTheWeb}
|
|
62
|
+
* @see {@link Target}
|
|
63
|
+
* @see {@link @serenity-js/assertions~Ensure}
|
|
64
|
+
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
65
|
+
*/
|
|
66
|
+
static value(value) {
|
|
67
|
+
return {
|
|
68
|
+
from: (pageElement) => screenplay_1.Interaction.where((0, io_1.formatted) `#actor selects value ${value} from ${pageElement}`, async (actor) => {
|
|
69
|
+
return models_1.PageElement.locatedByCss((0, core_1.q) `option[value=${value}]`)
|
|
70
|
+
.of(pageElement)
|
|
71
|
+
.click()
|
|
72
|
+
.performAs(actor);
|
|
73
|
+
}),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @desc
|
|
78
|
+
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
79
|
+
* with [`value`s](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option#attr-value)
|
|
80
|
+
* of multiple [`<option>` elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
81
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor} to select.
|
|
82
|
+
*
|
|
83
|
+
* @example <caption>Example widget</caption>
|
|
84
|
+
* <select multiple data-test='countries'>
|
|
85
|
+
* <option value='UK'>United Kingdom</option>
|
|
86
|
+
* <option value='PL'>Poland</option>
|
|
87
|
+
* <option value='US'>United States</option>
|
|
88
|
+
* </select>
|
|
89
|
+
*
|
|
90
|
+
* @example <caption>Lean Page Object describing the widget</caption>
|
|
91
|
+
* import { Target } from '@serenity-js/protractor';
|
|
92
|
+
* import { browser, by } from 'protractor';
|
|
93
|
+
*
|
|
94
|
+
* class Countries {
|
|
95
|
+
* static dropdown = Target.the('countries dropdown')
|
|
96
|
+
* .located(by.css('[data-test="countries"]'));
|
|
97
|
+
* }
|
|
98
|
+
*
|
|
99
|
+
* @example <caption>Retrieving the selected value</caption>
|
|
100
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
101
|
+
* import { BrowseTheWeb, Select, Selected } from '@serenity-js/protractor';
|
|
102
|
+
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
103
|
+
* import { protractor } from 'protractor';
|
|
104
|
+
*
|
|
105
|
+
* actorCalled('Nick')
|
|
106
|
+
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
107
|
+
* .attemptsTo(
|
|
108
|
+
* Select.values('UK').from(Countries.dropdown),
|
|
109
|
+
* Ensure.that(Selected.valuesOf(Countries.dropdown), equals([ 'UK' ])),
|
|
110
|
+
* );
|
|
111
|
+
*
|
|
112
|
+
* @param {Array<Answerable<string[] | string>>} values
|
|
113
|
+
* Values of the [`option` elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
114
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor} to select
|
|
115
|
+
*
|
|
116
|
+
* @returns {SelectBuilder}
|
|
117
|
+
*
|
|
118
|
+
* @see {@link Selected.valuesOf}
|
|
119
|
+
* @see {@link BrowseTheWeb}
|
|
120
|
+
* @see {@link Target}
|
|
121
|
+
* @see {@link @serenity-js/assertions~Ensure}
|
|
122
|
+
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
123
|
+
*/
|
|
124
|
+
static values(...values) {
|
|
125
|
+
return {
|
|
126
|
+
from: (pageElement) => screenplay_1.Interaction.where(`#actor selects values ${(0, io_1.commaSeparated)(values.flat(), item => (0, inspected_1.inspected)(item, { inline: true }))} from ${(0, inspected_1.inspected)(pageElement, { inline: true })}`, async (actor) => {
|
|
127
|
+
const desiredValues = (await Promise.all(values.map(value => actor.answer(value)))).flat(); // eslint-disable-line unicorn/no-await-expression-member
|
|
128
|
+
const options = await models_1.PageElements.locatedByCss(`option`).of(pageElement).answeredBy(actor);
|
|
129
|
+
const shouldSelect = await options.map(optionsToSelect(hasValueEqualOneOf(desiredValues)));
|
|
130
|
+
return options.forEach((option, index) => {
|
|
131
|
+
if (shouldSelect[index]) {
|
|
132
|
+
return option.click();
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* @desc
|
|
140
|
+
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
141
|
+
* with a single [`option`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
142
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor} to select.
|
|
143
|
+
*
|
|
144
|
+
* @example <caption>Example widget</caption>
|
|
145
|
+
* <select data-test='countries'>
|
|
146
|
+
* <option value='UK'>United Kingdom</option>
|
|
147
|
+
* <option value='PL'>Poland</option>
|
|
148
|
+
* <option value='US'>United States</option>
|
|
149
|
+
* </select>
|
|
150
|
+
*
|
|
151
|
+
* @example <caption>Lean Page Object describing the widget</caption>
|
|
152
|
+
* import { Target } from '@serenity-js/protractor';
|
|
153
|
+
* import { browser, by } from 'protractor';
|
|
154
|
+
*
|
|
155
|
+
* class Countries {
|
|
156
|
+
* static dropdown = Target.the('countries dropdown')
|
|
157
|
+
* .located(by.css('[data-test="countries"]'));
|
|
158
|
+
* }
|
|
159
|
+
*
|
|
160
|
+
* @example <caption>Retrieving the selected value</caption>
|
|
161
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
162
|
+
* import { BrowseTheWeb, Select, Selected } from '@serenity-js/protractor';
|
|
163
|
+
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
164
|
+
* import { protractor } from 'protractor';
|
|
165
|
+
*
|
|
166
|
+
* actorCalled('Nick')
|
|
167
|
+
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
168
|
+
* .attemptsTo(
|
|
169
|
+
* Select.option('Poland').from(Countries.dropdown),
|
|
170
|
+
* Ensure.that(
|
|
171
|
+
* Selected.optionIn(Countries.dropdown),
|
|
172
|
+
* equals('Poland')
|
|
173
|
+
* ),
|
|
174
|
+
* );
|
|
175
|
+
*
|
|
176
|
+
* @param {Answerable<string>} value
|
|
177
|
+
* Text of the [`option` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
178
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor} to select
|
|
179
|
+
*
|
|
180
|
+
* @returns {SelectBuilder}
|
|
181
|
+
*
|
|
182
|
+
* @see {@link Selected.optionIn}
|
|
183
|
+
* @see {@link BrowseTheWeb}
|
|
184
|
+
* @see {@link Target}
|
|
185
|
+
* @see {@link @serenity-js/assertions~Ensure}
|
|
186
|
+
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
187
|
+
*/
|
|
188
|
+
static option(value) {
|
|
189
|
+
return {
|
|
190
|
+
from: (pageElement) => screenplay_1.Interaction.where((0, io_1.formatted) `#actor selects ${value} from ${pageElement}`, async (actor) => {
|
|
191
|
+
return models_1.PageElement.locatedByCssContainingText('option', value)
|
|
192
|
+
.of(pageElement)
|
|
193
|
+
.click()
|
|
194
|
+
.performAs(actor);
|
|
195
|
+
}),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* @desc
|
|
200
|
+
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
201
|
+
* with [`option`s](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
202
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor} to select.
|
|
203
|
+
*
|
|
204
|
+
* @example <caption>Example widget</caption>
|
|
205
|
+
* <select multiple data-test='countries'>
|
|
206
|
+
* <option value='UK'>United Kingdom</option>
|
|
207
|
+
* <option value='PL'>Poland</option>
|
|
208
|
+
* <option value='US'>United States</option>
|
|
209
|
+
* </select>
|
|
210
|
+
*
|
|
211
|
+
* @example <caption>Lean Page Object describing the widget</caption>
|
|
212
|
+
* import { Target } from '@serenity-js/protractor';
|
|
213
|
+
* import { browser, by } from 'protractor';
|
|
214
|
+
*
|
|
215
|
+
* class Countries {
|
|
216
|
+
* static dropdown = Target.the('countries dropdown')
|
|
217
|
+
* .located(by.css('[data-test="countries"]'));
|
|
218
|
+
* }
|
|
219
|
+
*
|
|
220
|
+
* @example <caption>Retrieving the selected value</caption>
|
|
221
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
222
|
+
* import { BrowseTheWeb, Select, Selected } from '@serenity-js/protractor';
|
|
223
|
+
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
224
|
+
* import { protractor } from 'protractor';
|
|
225
|
+
*
|
|
226
|
+
* actorCalled('Nick')
|
|
227
|
+
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
228
|
+
* .attemptsTo(
|
|
229
|
+
* Select.options('Poland', 'United States').from(Countries.dropdown),
|
|
230
|
+
* Ensure.that(
|
|
231
|
+
* Selected.optionsIn(Countries.dropdown),
|
|
232
|
+
* equals([ 'Poland', 'United States' ])
|
|
233
|
+
* ),
|
|
234
|
+
* );
|
|
235
|
+
*
|
|
236
|
+
* @param {Array<Answerable<string[] | string>>} values
|
|
237
|
+
* Text of the [`option` elements ](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
238
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor} to select
|
|
239
|
+
*
|
|
240
|
+
* @returns {SelectBuilder}
|
|
241
|
+
*
|
|
242
|
+
* @see {@link Selected.optionsIn}
|
|
243
|
+
* @see {@link BrowseTheWeb}
|
|
244
|
+
* @see {@link Target}
|
|
245
|
+
* @see {@link @serenity-js/assertions~Ensure}
|
|
246
|
+
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
247
|
+
*/
|
|
248
|
+
static options(...values) {
|
|
249
|
+
return {
|
|
250
|
+
from: (pageElement) => screenplay_1.Interaction.where(`#actor selects ${(0, io_1.commaSeparated)(values.flat(), item => (0, inspected_1.inspected)(item, { inline: true }))} from ${(0, inspected_1.inspected)(pageElement, { inline: true })}`, async (actor) => {
|
|
251
|
+
const desiredOptions = (await Promise.all(values.map(value => actor.answer(value)))).flat(); // eslint-disable-line unicorn/no-await-expression-member
|
|
252
|
+
const options = await models_1.PageElements.locatedByCss(`option`).of(pageElement).answeredBy(actor);
|
|
253
|
+
const shouldSelect = await options.map(optionsToSelect(hasTextEqualOneOf(desiredOptions)));
|
|
254
|
+
return options.forEach((option, index) => {
|
|
255
|
+
if (shouldSelect[index]) {
|
|
256
|
+
return option.click();
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}),
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
exports.Select = Select;
|
|
264
|
+
/** @package */
|
|
265
|
+
function hasValueEqualOneOf(desiredValues) {
|
|
266
|
+
return async (option) => {
|
|
267
|
+
const value = await option.value();
|
|
268
|
+
return desiredValues.includes(value);
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
/** @package */
|
|
272
|
+
function hasTextEqualOneOf(desiredValues) {
|
|
273
|
+
return async (option) => {
|
|
274
|
+
const value = await option.text();
|
|
275
|
+
return desiredValues.includes(value);
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
/** @package */
|
|
279
|
+
function optionsToSelect(criterion) {
|
|
280
|
+
return (option) => isAlreadySelected(option)
|
|
281
|
+
.then(alreadySelected => criterion(option).then(criterionMet => xor(alreadySelected, criterionMet)));
|
|
282
|
+
}
|
|
283
|
+
/** @package */
|
|
284
|
+
function isAlreadySelected(option) {
|
|
285
|
+
return option.isSelected();
|
|
286
|
+
}
|
|
287
|
+
/** @package */
|
|
288
|
+
function xor(first, second) {
|
|
289
|
+
return first !== second;
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=Select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Select.ts"],"names":[],"mappings":";;;AAAA,4CAAkD;AAClD,iDAAqE;AACrE,kEAA+D;AAC/D,iEAA+D;AAE/D,sCAAsD;AAGtD;;;;;;;GAOG;AACH,MAAa,MAAM;IAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+CG;IACH,MAAM,CAAC,KAAK,CAAC,KAAyB;QAClC,OAAO;YACH,IAAI,EAAE,CAAC,WAAoC,EAAe,EAAE,CACxD,wBAAW,CAAC,KAAK,CAAC,IAAA,cAAS,EAAC,wBAAyB,KAAM,SAAU,WAAY,EAAE,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;gBAC/F,OAAO,oBAAW,CAAC,YAAY,CAAC,IAAA,QAAC,EAAA,gBAAiB,KAAM,GAAG,CAAC;qBACvD,EAAE,CAAC,WAAW,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;IAC1C,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC;AAC/B,CAAC;AAED,eAAe;AACf,SAAS,GAAG,CAAC,KAAc,EAAE,MAAe;IACxC,OAAO,KAAK,KAAK,MAAM,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Answerable } from '@serenity-js/core';
|
|
2
|
+
import { Interaction } from '@serenity-js/core/lib/screenplay';
|
|
3
|
+
import { PageElement } from '../models';
|
|
4
|
+
/**
|
|
5
|
+
* @desc
|
|
6
|
+
* Configures the {@link Target} representing
|
|
7
|
+
* a [HTML `<select>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select)
|
|
8
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
9
|
+
* to interact with.
|
|
10
|
+
*
|
|
11
|
+
* @interface
|
|
12
|
+
*/
|
|
13
|
+
export interface SelectBuilder {
|
|
14
|
+
/**
|
|
15
|
+
* @desc
|
|
16
|
+
* Configures the {@link Target} representing
|
|
17
|
+
* a [HTML `<select>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select)
|
|
18
|
+
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
19
|
+
* to interact with
|
|
20
|
+
*
|
|
21
|
+
* @param {Answerable<PageElement>} pageElement
|
|
22
|
+
*
|
|
23
|
+
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
24
|
+
*
|
|
25
|
+
* @see {@link Select}
|
|
26
|
+
* @see {@link Select.option}
|
|
27
|
+
* @see {@link Select.options}
|
|
28
|
+
* @see {@link Select.value}
|
|
29
|
+
* @see {@link Select.values}
|
|
30
|
+
* @see {@link Target}
|
|
31
|
+
*/
|
|
32
|
+
from: (pageElement: Answerable<PageElement>) => Interaction;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectBuilder.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/SelectBuilder.ts"],"names":[],"mappings":""}
|