@serenity-js/web 3.0.0-rc.8 → 3.0.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 +336 -73
- package/README.md +8 -12
- package/lib/errors/BrowserWindowClosedError.d.ts +15 -0
- package/lib/errors/BrowserWindowClosedError.d.ts.map +1 -0
- package/lib/errors/BrowserWindowClosedError.js +21 -0
- package/lib/errors/BrowserWindowClosedError.js.map +1 -0
- package/lib/errors/CookieMissingError.d.ts +11 -0
- package/lib/errors/CookieMissingError.d.ts.map +1 -0
- package/lib/errors/CookieMissingError.js +10 -0
- package/lib/errors/CookieMissingError.js.map +1 -1
- package/lib/errors/ModalDialogObstructsScreenshotError.d.ts +15 -0
- package/lib/errors/ModalDialogObstructsScreenshotError.d.ts.map +1 -0
- package/lib/errors/ModalDialogObstructsScreenshotError.js +21 -0
- package/lib/errors/ModalDialogObstructsScreenshotError.js.map +1 -0
- package/lib/errors/index.d.ts +3 -0
- package/lib/errors/index.d.ts.map +1 -0
- package/lib/errors/index.js +7 -1
- package/lib/errors/index.js.map +1 -1
- package/lib/expectations/index.d.ts +1 -1
- package/lib/expectations/index.d.ts.map +1 -0
- package/lib/expectations/index.js +5 -2
- package/lib/expectations/index.js.map +1 -1
- package/lib/expectations/isActive.d.ts +14 -8
- package/lib/expectations/isActive.d.ts.map +1 -0
- package/lib/expectations/isActive.js +17 -11
- package/lib/expectations/isActive.js.map +1 -1
- package/lib/expectations/isClickable.d.ts +14 -13
- package/lib/expectations/isClickable.d.ts.map +1 -0
- package/lib/expectations/isClickable.js +15 -17
- package/lib/expectations/isClickable.js.map +1 -1
- package/lib/expectations/isEnabled.d.ts +14 -7
- package/lib/expectations/isEnabled.d.ts.map +1 -0
- package/lib/expectations/isEnabled.js +17 -9
- package/lib/expectations/isEnabled.js.map +1 -1
- package/lib/expectations/isSelected.d.ts +14 -7
- package/lib/expectations/isSelected.d.ts.map +1 -0
- package/lib/expectations/isSelected.js +15 -9
- package/lib/expectations/isSelected.js.map +1 -1
- package/lib/expectations/isVisible.d.ts +14 -7
- package/lib/expectations/isVisible.d.ts.map +1 -0
- package/lib/expectations/isVisible.js +17 -9
- package/lib/expectations/isVisible.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -2
- package/lib/index.js.map +1 -1
- package/lib/screenplay/abilities/BrowseTheWeb.d.ts +88 -45
- package/lib/screenplay/abilities/BrowseTheWeb.d.ts.map +1 -0
- package/lib/screenplay/abilities/BrowseTheWeb.js +89 -19
- package/lib/screenplay/abilities/BrowseTheWeb.js.map +1 -1
- package/lib/screenplay/abilities/index.d.ts +1 -1
- package/lib/screenplay/abilities/index.d.ts.map +1 -0
- package/lib/screenplay/abilities/index.js +5 -2
- package/lib/screenplay/abilities/index.js.map +1 -1
- package/lib/screenplay/index.d.ts +1 -0
- package/lib/screenplay/index.d.ts.map +1 -0
- package/lib/screenplay/index.js +5 -1
- package/lib/screenplay/index.js.map +1 -1
- package/lib/screenplay/interactions/Clear.d.ts +50 -55
- package/lib/screenplay/interactions/Clear.d.ts.map +1 -0
- package/lib/screenplay/interactions/Clear.js +70 -63
- package/lib/screenplay/interactions/Clear.js.map +1 -1
- package/lib/screenplay/interactions/Click.d.ts +41 -50
- package/lib/screenplay/interactions/Click.d.ts.map +1 -0
- package/lib/screenplay/interactions/Click.js +45 -55
- package/lib/screenplay/interactions/Click.js.map +1 -1
- package/lib/screenplay/interactions/DoubleClick.d.ts +64 -67
- package/lib/screenplay/interactions/DoubleClick.d.ts.map +1 -0
- package/lib/screenplay/interactions/DoubleClick.js +68 -72
- package/lib/screenplay/interactions/DoubleClick.js.map +1 -1
- package/lib/screenplay/interactions/Enter.d.ts +42 -51
- package/lib/screenplay/interactions/Enter.d.ts.map +1 -0
- package/lib/screenplay/interactions/Enter.js +42 -52
- package/lib/screenplay/interactions/Enter.js.map +1 -1
- package/lib/screenplay/interactions/ExecuteScript.d.ts +144 -148
- package/lib/screenplay/interactions/ExecuteScript.d.ts.map +1 -0
- package/lib/screenplay/interactions/ExecuteScript.js +163 -185
- package/lib/screenplay/interactions/ExecuteScript.js.map +1 -1
- package/lib/screenplay/interactions/Hover.d.ts +40 -50
- package/lib/screenplay/interactions/Hover.d.ts.map +1 -0
- package/lib/screenplay/interactions/Hover.js +44 -55
- package/lib/screenplay/interactions/Hover.js.map +1 -1
- package/lib/screenplay/interactions/Navigate.d.ts +106 -113
- package/lib/screenplay/interactions/Navigate.d.ts.map +1 -0
- package/lib/screenplay/interactions/Navigate.js +124 -146
- package/lib/screenplay/interactions/Navigate.js.map +1 -1
- package/lib/screenplay/interactions/PageElementInteraction.d.ts +12 -28
- package/lib/screenplay/interactions/PageElementInteraction.d.ts.map +1 -0
- package/lib/screenplay/interactions/PageElementInteraction.js +12 -33
- package/lib/screenplay/interactions/PageElementInteraction.js.map +1 -1
- package/lib/screenplay/interactions/Press.d.ts +61 -55
- package/lib/screenplay/interactions/Press.d.ts.map +1 -0
- package/lib/screenplay/interactions/Press.js +83 -72
- package/lib/screenplay/interactions/Press.js.map +1 -1
- package/lib/screenplay/interactions/RightClick.d.ts +59 -65
- package/lib/screenplay/interactions/RightClick.d.ts.map +1 -0
- package/lib/screenplay/interactions/RightClick.js +63 -70
- package/lib/screenplay/interactions/RightClick.js.map +1 -1
- package/lib/screenplay/interactions/Scroll.d.ts +46 -64
- package/lib/screenplay/interactions/Scroll.d.ts.map +1 -0
- package/lib/screenplay/interactions/Scroll.js +49 -71
- package/lib/screenplay/interactions/Scroll.js.map +1 -1
- package/lib/screenplay/interactions/Select.d.ts +217 -193
- package/lib/screenplay/interactions/Select.d.ts.map +1 -0
- package/lib/screenplay/interactions/Select.js +218 -245
- package/lib/screenplay/interactions/Select.js.map +1 -1
- package/lib/screenplay/interactions/Switch.d.ts +105 -128
- package/lib/screenplay/interactions/Switch.d.ts.map +1 -0
- package/lib/screenplay/interactions/Switch.js +121 -172
- package/lib/screenplay/interactions/Switch.js.map +1 -1
- package/lib/screenplay/interactions/TakeScreenshot.d.ts +28 -50
- package/lib/screenplay/interactions/TakeScreenshot.d.ts.map +1 -0
- package/lib/screenplay/interactions/TakeScreenshot.js +32 -57
- package/lib/screenplay/interactions/TakeScreenshot.js.map +1 -1
- package/lib/screenplay/interactions/index.d.ts +2 -3
- package/lib/screenplay/interactions/index.d.ts.map +1 -0
- package/lib/screenplay/interactions/index.js +6 -4
- package/lib/screenplay/interactions/index.js.map +1 -1
- package/lib/screenplay/models/BrowserCapabilities.d.ts +24 -0
- package/lib/screenplay/models/BrowserCapabilities.d.ts.map +1 -0
- package/lib/screenplay/models/BrowserCapabilities.js.map +1 -0
- package/lib/screenplay/models/BrowsingSession.d.ts +69 -0
- package/lib/screenplay/models/BrowsingSession.d.ts.map +1 -0
- package/lib/screenplay/models/BrowsingSession.js +101 -0
- package/lib/screenplay/models/BrowsingSession.js.map +1 -0
- package/lib/screenplay/models/Cookie.d.ts +104 -64
- package/lib/screenplay/models/Cookie.d.ts.map +1 -0
- package/lib/screenplay/models/Cookie.js +110 -59
- package/lib/screenplay/models/Cookie.js.map +1 -1
- package/lib/screenplay/models/CookieData.d.ts +20 -58
- package/lib/screenplay/models/CookieData.d.ts.map +1 -0
- package/lib/{input → screenplay/models}/Key.d.ts +13 -9
- package/lib/screenplay/models/Key.d.ts.map +1 -0
- package/lib/{input → screenplay/models}/Key.js +16 -13
- package/lib/screenplay/models/Key.js.map +1 -0
- package/lib/screenplay/models/Locator.d.ts +29 -8
- package/lib/screenplay/models/Locator.d.ts.map +1 -0
- package/lib/screenplay/models/Locator.js +53 -7
- package/lib/screenplay/models/Locator.js.map +1 -1
- package/lib/screenplay/models/Page.d.ts +398 -36
- package/lib/screenplay/models/Page.d.ts.map +1 -0
- package/lib/screenplay/models/Page.js +209 -4
- package/lib/screenplay/models/Page.js.map +1 -1
- package/lib/screenplay/models/PageElement.d.ts +77 -5
- package/lib/screenplay/models/PageElement.d.ts.map +1 -0
- package/lib/screenplay/models/PageElement.js +29 -7
- package/lib/screenplay/models/PageElement.js.map +1 -1
- package/lib/screenplay/models/PageElements.d.ts +16 -3
- package/lib/screenplay/models/PageElements.d.ts.map +1 -0
- package/lib/screenplay/models/PageElements.js +21 -8
- package/lib/screenplay/models/PageElements.js.map +1 -1
- package/lib/screenplay/models/RootLocator.d.ts +25 -0
- package/lib/screenplay/models/RootLocator.d.ts.map +1 -0
- package/lib/screenplay/models/RootLocator.js +52 -0
- package/lib/screenplay/models/RootLocator.js.map +1 -0
- package/lib/screenplay/models/SelectOption.d.ts +25 -0
- package/lib/screenplay/models/SelectOption.d.ts.map +1 -0
- package/lib/screenplay/models/SelectOption.js +37 -0
- package/lib/screenplay/models/SelectOption.js.map +1 -0
- package/lib/screenplay/models/Switchable.d.ts +23 -0
- package/lib/screenplay/models/Switchable.d.ts.map +1 -0
- package/lib/screenplay/{interactions/WaitBuilder.js → models/Switchable.js} +1 -1
- package/lib/screenplay/models/Switchable.js.map +1 -0
- package/lib/screenplay/models/SwitchableOrigin.d.ts +18 -0
- package/lib/screenplay/models/SwitchableOrigin.d.ts.map +1 -0
- package/lib/screenplay/{interactions/EnterBuilder.js → models/SwitchableOrigin.js} +1 -1
- package/lib/screenplay/models/SwitchableOrigin.js.map +1 -0
- package/lib/screenplay/models/dialogs/AbsentModalDialog.d.ts +15 -0
- package/lib/screenplay/models/dialogs/AbsentModalDialog.d.ts.map +1 -0
- package/lib/screenplay/models/dialogs/AbsentModalDialog.js +24 -0
- package/lib/screenplay/models/dialogs/AbsentModalDialog.js.map +1 -0
- package/lib/screenplay/models/dialogs/AcceptedModalDialog.d.ts +17 -0
- package/lib/screenplay/models/dialogs/AcceptedModalDialog.d.ts.map +1 -0
- package/lib/screenplay/models/dialogs/AcceptedModalDialog.js +29 -0
- package/lib/screenplay/models/dialogs/AcceptedModalDialog.js.map +1 -0
- package/lib/screenplay/models/dialogs/DismissedModalDialog.d.ts +17 -0
- package/lib/screenplay/models/dialogs/DismissedModalDialog.d.ts.map +1 -0
- package/lib/screenplay/models/dialogs/DismissedModalDialog.js +29 -0
- package/lib/screenplay/models/dialogs/DismissedModalDialog.js.map +1 -0
- package/lib/screenplay/models/dialogs/ModalDialog.d.ts +168 -0
- package/lib/screenplay/models/dialogs/ModalDialog.d.ts.map +1 -0
- package/lib/screenplay/models/dialogs/ModalDialog.js +174 -0
- package/lib/screenplay/models/dialogs/ModalDialog.js.map +1 -0
- package/lib/screenplay/models/dialogs/ModalDialogHandler.d.ts +38 -0
- package/lib/screenplay/models/dialogs/ModalDialogHandler.d.ts.map +1 -0
- package/lib/screenplay/models/dialogs/ModalDialogHandler.js +30 -0
- package/lib/screenplay/models/dialogs/ModalDialogHandler.js.map +1 -0
- package/lib/screenplay/models/dialogs/index.d.ts +6 -0
- package/lib/screenplay/models/dialogs/index.d.ts.map +1 -0
- package/lib/screenplay/models/dialogs/index.js +22 -0
- package/lib/screenplay/models/dialogs/index.js.map +1 -0
- package/lib/screenplay/models/index.d.ts +9 -1
- package/lib/screenplay/models/index.d.ts.map +1 -0
- package/lib/screenplay/models/index.js +13 -2
- package/lib/screenplay/models/index.js.map +1 -1
- package/lib/screenplay/models/selectors/By.d.ts +38 -0
- package/lib/screenplay/models/selectors/By.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/By.js +43 -0
- package/lib/screenplay/models/selectors/By.js.map +1 -1
- package/lib/screenplay/models/selectors/ByCss.d.ts +8 -0
- package/lib/screenplay/models/selectors/ByCss.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/ByCss.js +7 -0
- package/lib/screenplay/models/selectors/ByCss.js.map +1 -1
- package/lib/screenplay/models/selectors/ByCssContainingText.d.ts +9 -0
- package/lib/screenplay/models/selectors/ByCssContainingText.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/ByCssContainingText.js +8 -0
- package/lib/screenplay/models/selectors/ByCssContainingText.js.map +1 -1
- package/lib/screenplay/models/selectors/ByDeepCss.d.ts +14 -0
- package/lib/screenplay/models/selectors/ByDeepCss.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/ByDeepCss.js +20 -0
- package/lib/screenplay/models/selectors/ByDeepCss.js.map +1 -0
- package/lib/screenplay/models/selectors/ById.d.ts +8 -0
- package/lib/screenplay/models/selectors/ById.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/ById.js +7 -0
- package/lib/screenplay/models/selectors/ById.js.map +1 -1
- package/lib/screenplay/models/selectors/ByTagName.d.ts +8 -0
- package/lib/screenplay/models/selectors/ByTagName.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/ByTagName.js +7 -0
- package/lib/screenplay/models/selectors/ByTagName.js.map +1 -1
- package/lib/screenplay/models/selectors/ByXPath.d.ts +8 -0
- package/lib/screenplay/models/selectors/ByXPath.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/ByXPath.js +7 -0
- package/lib/screenplay/models/selectors/ByXPath.js.map +1 -1
- package/lib/screenplay/models/selectors/Selector.d.ts +6 -0
- package/lib/screenplay/models/selectors/Selector.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/Selector.js +6 -1
- package/lib/screenplay/models/selectors/Selector.js.map +1 -1
- package/lib/screenplay/models/selectors/index.d.ts +2 -0
- package/lib/screenplay/models/selectors/index.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/index.js +6 -1
- package/lib/screenplay/models/selectors/index.js.map +1 -1
- package/lib/screenplay/questions/Attribute.d.ts +115 -67
- package/lib/screenplay/questions/Attribute.d.ts.map +1 -0
- package/lib/screenplay/questions/Attribute.js +128 -74
- package/lib/screenplay/questions/Attribute.js.map +1 -1
- package/lib/screenplay/questions/CssClasses.d.ts +124 -79
- package/lib/screenplay/questions/CssClasses.d.ts.map +1 -0
- package/lib/screenplay/questions/CssClasses.js +132 -83
- package/lib/screenplay/questions/CssClasses.js.map +1 -1
- package/lib/screenplay/questions/LastScriptExecution.d.ts +42 -6
- package/lib/screenplay/questions/LastScriptExecution.d.ts.map +1 -0
- package/lib/screenplay/questions/LastScriptExecution.js +45 -7
- package/lib/screenplay/questions/LastScriptExecution.js.map +1 -1
- package/lib/screenplay/questions/Selected.d.ts +202 -171
- package/lib/screenplay/questions/Selected.d.ts.map +1 -0
- package/lib/screenplay/questions/Selected.js +225 -186
- package/lib/screenplay/questions/Selected.js.map +1 -1
- package/lib/screenplay/questions/Text.d.ts +101 -82
- package/lib/screenplay/questions/Text.d.ts.map +1 -0
- package/lib/screenplay/questions/Text.js +143 -92
- package/lib/screenplay/questions/Text.js.map +1 -1
- package/lib/screenplay/questions/Value.d.ts +77 -44
- package/lib/screenplay/questions/Value.d.ts.map +1 -0
- package/lib/screenplay/questions/Value.js +84 -47
- package/lib/screenplay/questions/Value.js.map +1 -1
- package/lib/screenplay/questions/index.d.ts +1 -0
- package/lib/screenplay/questions/index.d.ts.map +1 -0
- package/lib/screenplay/questions/index.js +5 -1
- package/lib/screenplay/questions/index.js.map +1 -1
- package/lib/scripts/index.d.ts +2 -0
- package/lib/scripts/index.d.ts.map +1 -0
- package/lib/{input → scripts}/index.js +6 -2
- package/lib/scripts/index.js.map +1 -0
- package/lib/scripts/isVisible.d.ts +2 -0
- package/lib/scripts/isVisible.d.ts.map +1 -0
- package/lib/scripts/isVisible.js +96 -0
- package/lib/scripts/isVisible.js.map +1 -0
- package/lib/stage/crew/index.d.ts +1 -0
- package/lib/stage/crew/index.d.ts.map +1 -0
- package/lib/stage/crew/index.js +5 -1
- package/lib/stage/crew/index.js.map +1 -1
- package/lib/stage/crew/photographer/Photographer.d.ts +126 -39
- package/lib/stage/crew/photographer/Photographer.d.ts.map +1 -0
- package/lib/stage/crew/photographer/Photographer.js +161 -42
- package/lib/stage/crew/photographer/Photographer.js.map +1 -1
- package/lib/stage/crew/photographer/index.d.ts +1 -0
- package/lib/stage/crew/photographer/index.d.ts.map +1 -0
- package/lib/stage/crew/photographer/index.js +5 -1
- package/lib/stage/crew/photographer/index.js.map +1 -1
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.d.ts +13 -12
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.d.ts.map +1 -0
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js +22 -33
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js.map +1 -1
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.d.ts +8 -8
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.d.ts.map +1 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js +7 -8
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js.map +1 -1
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.d.ts +8 -7
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.d.ts.map +1 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js +7 -7
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.d.ts +8 -8
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.d.ts.map +1 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js +7 -8
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js.map +1 -1
- package/lib/stage/crew/photographer/strategies/index.d.ts +1 -0
- package/lib/stage/crew/photographer/strategies/index.d.ts.map +1 -0
- package/lib/stage/crew/photographer/strategies/index.js +5 -1
- package/lib/stage/crew/photographer/strategies/index.js.map +1 -1
- package/lib/stage/index.d.ts +1 -0
- package/lib/stage/index.d.ts.map +1 -0
- package/lib/stage/index.js +5 -1
- package/lib/stage/index.js.map +1 -1
- package/package.json +20 -43
- package/src/errors/BrowserWindowClosedError.ts +17 -0
- package/src/errors/CookieMissingError.ts +10 -0
- package/src/errors/ModalDialogObstructsScreenshotError.ts +17 -0
- package/src/errors/index.ts +2 -0
- package/src/expectations/index.ts +0 -1
- package/src/expectations/isActive.ts +23 -12
- package/src/expectations/isClickable.ts +22 -21
- package/src/expectations/isEnabled.ts +23 -9
- package/src/expectations/isSelected.ts +20 -10
- package/src/expectations/isVisible.ts +23 -9
- package/src/index.ts +0 -1
- package/src/screenplay/abilities/BrowseTheWeb.ts +95 -87
- package/src/screenplay/abilities/index.ts +0 -1
- package/src/screenplay/interactions/Clear.ts +75 -63
- package/src/screenplay/interactions/Click.ts +43 -54
- package/src/screenplay/interactions/DoubleClick.ts +66 -71
- package/src/screenplay/interactions/Enter.ts +41 -53
- package/src/screenplay/interactions/ExecuteScript.ts +207 -220
- package/src/screenplay/interactions/Hover.ts +42 -54
- package/src/screenplay/interactions/Navigate.ts +129 -156
- package/src/screenplay/interactions/PageElementInteraction.ts +14 -34
- package/src/screenplay/interactions/Press.ts +78 -69
- package/src/screenplay/interactions/RightClick.ts +61 -69
- package/src/screenplay/interactions/Scroll.ts +48 -71
- package/src/screenplay/interactions/Select.ts +229 -269
- package/src/screenplay/interactions/Switch.ts +123 -179
- package/src/screenplay/interactions/TakeScreenshot.ts +31 -57
- package/src/screenplay/interactions/index.ts +1 -3
- package/src/screenplay/models/BrowserCapabilities.ts +26 -0
- package/src/screenplay/models/BrowsingSession.ts +115 -0
- package/src/screenplay/models/Cookie.ts +115 -73
- package/src/screenplay/models/CookieData.ts +20 -58
- package/src/{input → screenplay/models}/Key.ts +12 -9
- package/src/screenplay/models/Locator.ts +43 -9
- package/src/screenplay/models/Page.ts +438 -37
- package/src/screenplay/models/PageElement.ts +92 -12
- package/src/screenplay/models/PageElements.ts +23 -9
- package/src/screenplay/models/RootLocator.ts +30 -0
- package/src/screenplay/models/SelectOption.ts +38 -0
- package/src/screenplay/models/Switchable.ts +24 -0
- package/src/screenplay/models/SwitchableOrigin.ts +18 -0
- package/src/screenplay/models/dialogs/AbsentModalDialog.ts +22 -0
- package/src/screenplay/models/dialogs/AcceptedModalDialog.ts +27 -0
- package/src/screenplay/models/dialogs/DismissedModalDialog.ts +27 -0
- package/src/screenplay/models/dialogs/ModalDialog.ts +200 -0
- package/src/screenplay/models/dialogs/ModalDialogHandler.ts +50 -0
- package/src/screenplay/models/dialogs/index.ts +5 -0
- package/src/screenplay/models/index.ts +8 -1
- package/src/screenplay/models/selectors/By.ts +45 -0
- package/src/screenplay/models/selectors/ByCss.ts +7 -0
- package/src/screenplay/models/selectors/ByCssContainingText.ts +8 -0
- package/src/screenplay/models/selectors/ByDeepCss.ts +15 -0
- package/src/screenplay/models/selectors/ById.ts +7 -0
- package/src/screenplay/models/selectors/ByTagName.ts +7 -0
- package/src/screenplay/models/selectors/ByXPath.ts +7 -0
- package/src/screenplay/models/selectors/Selector.ts +6 -1
- package/src/screenplay/models/selectors/index.ts +1 -0
- package/src/screenplay/questions/Attribute.ts +137 -76
- package/src/screenplay/questions/CssClasses.ts +135 -83
- package/src/screenplay/questions/LastScriptExecution.ts +45 -8
- package/src/screenplay/questions/Selected.ts +237 -191
- package/src/screenplay/questions/Text.ts +161 -96
- package/src/screenplay/questions/Value.ts +88 -48
- package/src/scripts/index.ts +1 -0
- package/src/scripts/isVisible.ts +113 -0
- package/src/stage/crew/photographer/Photographer.ts +142 -41
- package/src/stage/crew/photographer/strategies/PhotoTakingStrategy.ts +27 -42
- package/src/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.ts +7 -8
- package/src/stage/crew/photographer/strategies/TakePhotosOfFailures.ts +7 -7
- package/src/stage/crew/photographer/strategies/TakePhotosOfInteractions.ts +7 -8
- package/tsconfig.build.json +14 -0
- package/lib/expectations/ElementExpectation.d.ts +0 -83
- package/lib/expectations/ElementExpectation.js +0 -102
- package/lib/expectations/ElementExpectation.js.map +0 -1
- package/lib/input/Key.js.map +0 -1
- package/lib/input/index.d.ts +0 -1
- package/lib/input/index.js.map +0 -1
- package/lib/screenplay/abilities/BrowserCapabilities.d.ts +0 -5
- package/lib/screenplay/abilities/BrowserCapabilities.js.map +0 -1
- package/lib/screenplay/interactions/EnterBuilder.d.ts +0 -25
- package/lib/screenplay/interactions/EnterBuilder.js.map +0 -1
- package/lib/screenplay/interactions/PressBuilder.d.ts +0 -26
- package/lib/screenplay/interactions/PressBuilder.js +0 -3
- package/lib/screenplay/interactions/PressBuilder.js.map +0 -1
- package/lib/screenplay/interactions/SelectBuilder.d.ts +0 -33
- package/lib/screenplay/interactions/SelectBuilder.js +0 -3
- package/lib/screenplay/interactions/SelectBuilder.js.map +0 -1
- package/lib/screenplay/interactions/Wait.d.ts +0 -143
- package/lib/screenplay/interactions/Wait.js +0 -238
- package/lib/screenplay/interactions/Wait.js.map +0 -1
- package/lib/screenplay/interactions/WaitBuilder.d.ts +0 -32
- package/lib/screenplay/interactions/WaitBuilder.js.map +0 -1
- package/lib/screenplay/models/ModalDialog.d.ts +0 -9
- package/lib/screenplay/models/ModalDialog.js +0 -14
- package/lib/screenplay/models/ModalDialog.js.map +0 -1
- package/lib/screenplay/questions/ElementQuestion.d.ts +0 -33
- package/lib/screenplay/questions/ElementQuestion.js +0 -53
- package/lib/screenplay/questions/ElementQuestion.js.map +0 -1
- package/src/expectations/ElementExpectation.ts +0 -108
- package/src/input/index.ts +0 -1
- package/src/screenplay/abilities/BrowserCapabilities.ts +0 -5
- package/src/screenplay/interactions/EnterBuilder.ts +0 -28
- package/src/screenplay/interactions/PressBuilder.ts +0 -29
- package/src/screenplay/interactions/SelectBuilder.ts +0 -36
- package/src/screenplay/interactions/Wait.ts +0 -260
- package/src/screenplay/interactions/WaitBuilder.ts +0 -34
- package/src/screenplay/models/ModalDialog.ts +0 -19
- package/src/screenplay/questions/ElementQuestion.ts +0 -58
- package/tsconfig.eslint.json +0 -10
- /package/lib/screenplay/{abilities → models}/BrowserCapabilities.js +0 -0
|
@@ -1,97 +1,116 @@
|
|
|
1
1
|
import { Answerable, MetaQuestion, QuestionAdapter } from '@serenity-js/core';
|
|
2
2
|
import { PageElement, PageElements } from '../models';
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
4
|
+
* Uses the {@apilink Actor|actor's} {@apilink Ability|ability} to {@apilink BrowseTheWeb} to retrieve
|
|
5
|
+
* the visible (i.e. not hidden by CSS) [`innerText`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText) of:
|
|
6
|
+
* - a given {@apilink PageElement}
|
|
7
|
+
* - a group of {@apilink PageElements}
|
|
8
|
+
*
|
|
9
|
+
* The result includes the visible text of any sub-elements, without any leading or trailing whitespace.
|
|
10
|
+
*
|
|
11
|
+
* ## Example widget
|
|
12
|
+
*
|
|
13
|
+
* ```html
|
|
14
|
+
* <h1>Shopping list</h1>
|
|
15
|
+
* <ul id="shopping-list">
|
|
16
|
+
* <li>Coffee<li>
|
|
17
|
+
* <li class="bought">Honey<li>
|
|
18
|
+
* <li>Chocolate<li>
|
|
19
|
+
* </ul>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* ## Retrieve text of a single {@apilink PageElement}
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
26
|
+
* import { Ensure, equals } from '@serenity-js/assertions'
|
|
27
|
+
* import { By, PageElement, Text } from '@serenity-js/web'
|
|
28
|
+
*
|
|
29
|
+
* const header = () =>
|
|
30
|
+
* PageElement.located(By.css('h1'))
|
|
31
|
+
* .describedAs('header')
|
|
32
|
+
*
|
|
33
|
+
* await actorCalled('Lisa')
|
|
34
|
+
* .whoCan(BrowseTheWebWithWebdriverIO.using(browser))
|
|
35
|
+
* .attemptsTo(
|
|
36
|
+
* Ensure.that(Text.of(header()), equals('Shopping list')),
|
|
37
|
+
* )
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* ## Retrieve text of multiple {@apilink PageElements}
|
|
41
|
+
*
|
|
42
|
+
* ```ts
|
|
43
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
44
|
+
* import { Ensure, equals } from '@serenity-js/assertions'
|
|
45
|
+
* import { By, PageElement, Text } from '@serenity-js/web'
|
|
46
|
+
*
|
|
47
|
+
* const shoppingListItems = () =>
|
|
48
|
+
* PageElements.located(By.css('#shopping-list li'))
|
|
49
|
+
* .describedAs('shopping list items')
|
|
50
|
+
*
|
|
51
|
+
* await actorCalled('Lisa')
|
|
52
|
+
* .attemptsTo(
|
|
53
|
+
* Ensure.that(
|
|
54
|
+
* Text.ofAll(shoppingListItems()),
|
|
55
|
+
* equals([ 'Coffee', 'Honey', 'Chocolate' ])
|
|
56
|
+
* ),
|
|
57
|
+
* )
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* ## Using as filter in {@apilink PageElements|Page Element Query Language}
|
|
61
|
+
*
|
|
62
|
+
* ```ts
|
|
63
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
64
|
+
* import { contain, Ensure } from '@serenity-js/assertions'
|
|
65
|
+
* import { By, CssClasses, PageElement, Text } from '@serenity-js/web'
|
|
66
|
+
*
|
|
67
|
+
* const shoppingListItemCalled = (name: string) =>
|
|
68
|
+
* PageElements.located(By.css('#shopping-list li'))
|
|
69
|
+
* .describedAs('shopping list items')
|
|
70
|
+
* .where(Text, equals(name))
|
|
71
|
+
* .first()
|
|
72
|
+
*
|
|
73
|
+
* await actorCalled('Lisa')
|
|
74
|
+
* .attemptsTo(
|
|
75
|
+
* Ensure.that(
|
|
76
|
+
* CssClasses.of(shoppingListItemCalled('Honey)),
|
|
77
|
+
* contain('bought')
|
|
78
|
+
* ),
|
|
79
|
+
* )
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* ## Learn more
|
|
83
|
+
* - {@apilink BrowseTheWeb}
|
|
84
|
+
* - {@apilink MetaQuestion}
|
|
85
|
+
* - {@apilink QuestionAdapter}
|
|
86
|
+
* - {@apilink Question}
|
|
87
|
+
*
|
|
88
|
+
* @group Questions
|
|
71
89
|
*/
|
|
72
90
|
export declare class Text {
|
|
73
91
|
/**
|
|
74
|
-
* @
|
|
75
|
-
*
|
|
76
|
-
*
|
|
92
|
+
* Instantiates a {@apilink Question} that uses
|
|
93
|
+
* the {@apilink Actor|actor's} {@apilink Ability|ability} to {@apilink BrowseTheWeb} to retrieve
|
|
94
|
+
* the text of a single {@apilink PageElement}.
|
|
77
95
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
96
|
+
* #### Learn more
|
|
97
|
+
* - {@apilink MetaQuestion}
|
|
80
98
|
*
|
|
81
|
-
* @
|
|
99
|
+
* @param pageElement
|
|
82
100
|
*/
|
|
83
|
-
static of(
|
|
101
|
+
static of(pageElement: Answerable<PageElement>): QuestionAdapter<string> & // eslint-disable-line @typescript-eslint/indent
|
|
84
102
|
MetaQuestion<Answerable<PageElement>, Promise<string>>;
|
|
85
103
|
/**
|
|
86
|
-
* @
|
|
87
|
-
*
|
|
88
|
-
*
|
|
104
|
+
* Instantiates a {@apilink Question} that uses
|
|
105
|
+
* the {@apilink Actor|actor's} {@apilink Ability|ability} to {@apilink BrowseTheWeb} to retrieve
|
|
106
|
+
* the text of a group of {@apilink PageElements}.
|
|
89
107
|
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
108
|
+
* #### Learn more
|
|
109
|
+
* - {@apilink MetaQuestion}
|
|
92
110
|
*
|
|
93
|
-
* @
|
|
111
|
+
* @param pageElements
|
|
94
112
|
*/
|
|
95
|
-
static ofAll(
|
|
96
|
-
static ofAll(
|
|
113
|
+
static ofAll(pageElements: PageElements): QuestionAdapter<string[]> & MetaQuestion<Answerable<PageElement>, Promise<string[]>>;
|
|
114
|
+
static ofAll(pageElements: Answerable<PageElement[]>): QuestionAdapter<string[]>;
|
|
97
115
|
}
|
|
116
|
+
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/screenplay/questions/Text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAuB,YAAY,EAAY,eAAe,EAAiB,MAAM,mBAAmB,CAAC;AAG5H,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AACH,qBAAa,IAAI;IAEb;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC,GAC1C,eAAe,CAAC,MAAM,CAAC,GAAmC,gDAAgD;IAC1G,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAK1D;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,YAAY,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9H,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,UAAU,CAAC,WAAW,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC;CAYnF"}
|
|
@@ -4,131 +4,182 @@ exports.Text = void 0;
|
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
5
|
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
6
|
const models_1 = require("../models");
|
|
7
|
-
const ElementQuestion_1 = require("./ElementQuestion");
|
|
8
7
|
/**
|
|
9
|
-
* @
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
8
|
+
* Uses the {@apilink Actor|actor's} {@apilink Ability|ability} to {@apilink BrowseTheWeb} to retrieve
|
|
9
|
+
* the visible (i.e. not hidden by CSS) [`innerText`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText) of:
|
|
10
|
+
* - a given {@apilink PageElement}
|
|
11
|
+
* - a group of {@apilink PageElements}
|
|
12
|
+
*
|
|
13
|
+
* The result includes the visible text of any sub-elements, without any leading or trailing whitespace.
|
|
14
|
+
*
|
|
15
|
+
* ## Example widget
|
|
16
|
+
*
|
|
17
|
+
* ```html
|
|
18
|
+
* <h1>Shopping list</h1>
|
|
19
|
+
* <ul id="shopping-list">
|
|
20
|
+
* <li>Coffee<li>
|
|
21
|
+
* <li class="bought">Honey<li>
|
|
22
|
+
* <li>Chocolate<li>
|
|
23
|
+
* </ul>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* ## Retrieve text of a single {@apilink PageElement}
|
|
27
|
+
*
|
|
28
|
+
* ```ts
|
|
29
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
30
|
+
* import { Ensure, equals } from '@serenity-js/assertions'
|
|
31
|
+
* import { By, PageElement, Text } from '@serenity-js/web'
|
|
32
|
+
*
|
|
33
|
+
* const header = () =>
|
|
34
|
+
* PageElement.located(By.css('h1'))
|
|
35
|
+
* .describedAs('header')
|
|
36
|
+
*
|
|
37
|
+
* await actorCalled('Lisa')
|
|
38
|
+
* .whoCan(BrowseTheWebWithWebdriverIO.using(browser))
|
|
39
|
+
* .attemptsTo(
|
|
40
|
+
* Ensure.that(Text.of(header()), equals('Shopping list')),
|
|
41
|
+
* )
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* ## Retrieve text of multiple {@apilink PageElements}
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
48
|
+
* import { Ensure, equals } from '@serenity-js/assertions'
|
|
49
|
+
* import { By, PageElement, Text } from '@serenity-js/web'
|
|
50
|
+
*
|
|
51
|
+
* const shoppingListItems = () =>
|
|
52
|
+
* PageElements.located(By.css('#shopping-list li'))
|
|
53
|
+
* .describedAs('shopping list items')
|
|
54
|
+
*
|
|
55
|
+
* await actorCalled('Lisa')
|
|
56
|
+
* .attemptsTo(
|
|
57
|
+
* Ensure.that(
|
|
58
|
+
* Text.ofAll(shoppingListItems()),
|
|
59
|
+
* equals([ 'Coffee', 'Honey', 'Chocolate' ])
|
|
60
|
+
* ),
|
|
61
|
+
* )
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* ## Using as filter in {@apilink PageElements|Page Element Query Language}
|
|
65
|
+
*
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
68
|
+
* import { contain, Ensure } from '@serenity-js/assertions'
|
|
69
|
+
* import { By, CssClasses, PageElement, Text } from '@serenity-js/web'
|
|
70
|
+
*
|
|
71
|
+
* const shoppingListItemCalled = (name: string) =>
|
|
72
|
+
* PageElements.located(By.css('#shopping-list li'))
|
|
73
|
+
* .describedAs('shopping list items')
|
|
74
|
+
* .where(Text, equals(name))
|
|
75
|
+
* .first()
|
|
76
|
+
*
|
|
77
|
+
* await actorCalled('Lisa')
|
|
78
|
+
* .attemptsTo(
|
|
79
|
+
* Ensure.that(
|
|
80
|
+
* CssClasses.of(shoppingListItemCalled('Honey)),
|
|
81
|
+
* contain('bought')
|
|
82
|
+
* ),
|
|
83
|
+
* )
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* ## Learn more
|
|
87
|
+
* - {@apilink BrowseTheWeb}
|
|
88
|
+
* - {@apilink MetaQuestion}
|
|
89
|
+
* - {@apilink QuestionAdapter}
|
|
90
|
+
* - {@apilink Question}
|
|
91
|
+
*
|
|
92
|
+
* @group Questions
|
|
76
93
|
*/
|
|
77
94
|
class Text {
|
|
78
95
|
/**
|
|
79
|
-
* @
|
|
80
|
-
*
|
|
81
|
-
*
|
|
96
|
+
* Instantiates a {@apilink Question} that uses
|
|
97
|
+
* the {@apilink Actor|actor's} {@apilink Ability|ability} to {@apilink BrowseTheWeb} to retrieve
|
|
98
|
+
* the text of a single {@apilink PageElement}.
|
|
82
99
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
100
|
+
* #### Learn more
|
|
101
|
+
* - {@apilink MetaQuestion}
|
|
85
102
|
*
|
|
86
|
-
* @
|
|
103
|
+
* @param pageElement
|
|
87
104
|
*/
|
|
88
|
-
static of(
|
|
89
|
-
return TextOfSingleElement.of(
|
|
105
|
+
static of(pageElement) {
|
|
106
|
+
return TextOfSingleElement.of(pageElement);
|
|
90
107
|
}
|
|
91
|
-
static ofAll(
|
|
92
|
-
if (
|
|
93
|
-
return TextOfMultipleElements.of(
|
|
108
|
+
static ofAll(pageElements) {
|
|
109
|
+
if (pageElements instanceof models_1.PageElements) {
|
|
110
|
+
return TextOfMultipleElements.of(pageElements);
|
|
94
111
|
}
|
|
95
|
-
return core_1.Question.about((0, core_1.d) `the text of ${
|
|
96
|
-
const
|
|
97
|
-
return (0, io_1.asyncMap)(
|
|
112
|
+
return core_1.Question.about((0, core_1.d) `the text of ${pageElements}`, async (actor) => {
|
|
113
|
+
const elements = await actor.answer(pageElements);
|
|
114
|
+
return (0, io_1.asyncMap)(elements, element => element.text());
|
|
98
115
|
});
|
|
99
116
|
}
|
|
100
117
|
}
|
|
101
118
|
exports.Text = Text;
|
|
102
|
-
class TextOfSingleElement extends
|
|
103
|
-
constructor(element) {
|
|
104
|
-
super(`the text of ${element}`);
|
|
105
|
-
this.element = element;
|
|
106
|
-
}
|
|
119
|
+
class TextOfSingleElement extends core_1.Question {
|
|
107
120
|
static of(element) {
|
|
108
121
|
return core_1.Question.createAdapter(new TextOfSingleElement(element));
|
|
109
122
|
}
|
|
123
|
+
constructor(element) {
|
|
124
|
+
super();
|
|
125
|
+
this.element = element;
|
|
126
|
+
this.subject = (0, core_1.d) `the text of ${element}`;
|
|
127
|
+
}
|
|
110
128
|
of(parent) {
|
|
111
129
|
return new TextOfSingleElement(models_1.PageElement.of(this.element, parent));
|
|
112
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* @inheritDoc
|
|
133
|
+
*/
|
|
113
134
|
async answeredBy(actor) {
|
|
114
135
|
const element = await actor.answer(this.element);
|
|
115
136
|
return element.text();
|
|
116
137
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
this.
|
|
138
|
+
/**
|
|
139
|
+
* @inheritDoc
|
|
140
|
+
*/
|
|
141
|
+
describedAs(subject) {
|
|
142
|
+
this.subject = subject;
|
|
143
|
+
return this;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* @inheritDoc
|
|
147
|
+
*/
|
|
148
|
+
toString() {
|
|
149
|
+
return this.subject;
|
|
122
150
|
}
|
|
151
|
+
}
|
|
152
|
+
class TextOfMultipleElements extends core_1.Question {
|
|
123
153
|
static of(elements) {
|
|
124
154
|
return core_1.Question.createAdapter(new TextOfMultipleElements(elements));
|
|
125
155
|
}
|
|
156
|
+
constructor(elements) {
|
|
157
|
+
super();
|
|
158
|
+
this.elements = elements;
|
|
159
|
+
this.subject = (0, core_1.d) `the text of ${elements}`;
|
|
160
|
+
}
|
|
126
161
|
of(parent) {
|
|
127
162
|
return new TextOfMultipleElements(this.elements.of(parent));
|
|
128
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* @inheritDoc
|
|
166
|
+
*/
|
|
129
167
|
async answeredBy(actor) {
|
|
130
168
|
const elements = await actor.answer(this.elements);
|
|
131
169
|
return (0, io_1.asyncMap)(elements, element => element.text());
|
|
132
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* @inheritDoc
|
|
173
|
+
*/
|
|
174
|
+
describedAs(subject) {
|
|
175
|
+
this.subject = subject;
|
|
176
|
+
return this;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* @inheritDoc
|
|
180
|
+
*/
|
|
181
|
+
toString() {
|
|
182
|
+
return this.subject;
|
|
183
|
+
}
|
|
133
184
|
}
|
|
134
185
|
//# sourceMappingURL=Text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../src/screenplay/questions/Text.ts"],"names":[],"mappings":";;;AAAA,4CAA4H;AAC5H,iDAAoD;AAEpD,sCAAsD;
|
|
1
|
+
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../src/screenplay/questions/Text.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,64 +1,97 @@
|
|
|
1
|
-
import { Answerable, AnswersQuestions, MetaQuestion, Question, UsesAbilities } from '@serenity-js/core';
|
|
1
|
+
import { Answerable, AnswersQuestions, MetaQuestion, Question, QuestionAdapter, UsesAbilities } from '@serenity-js/core';
|
|
2
2
|
import { PageElement } from '../models';
|
|
3
|
-
import { ElementQuestion } from './ElementQuestion';
|
|
4
3
|
/**
|
|
5
|
-
* @
|
|
6
|
-
*
|
|
7
|
-
* represented by Answerable<{@link @wdio/types~Element}>
|
|
4
|
+
* Uses the {@apilink Actor|actor's} {@apilink Ability|ability} to {@apilink BrowseTheWeb} to retrieve
|
|
5
|
+
* the `value` attribute of a given {@apilink PageElement}.
|
|
8
6
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* ## Example widget
|
|
8
|
+
* ```html
|
|
9
|
+
* <input type="text" id="username" value="Alice" />
|
|
10
|
+
* ```
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
14
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
15
|
-
* import { BrowseTheWeb, by, Value, Target } from '@serenity-js/webdriverio';
|
|
12
|
+
* ## Retrieve the `value` of a given {@apilink PageElement}
|
|
16
13
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
16
|
+
* import { Ensure, equals } from '@serenity-js/assertions'
|
|
17
|
+
* import { By, PageElement, Value } from '@serenity-js/web'
|
|
19
18
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* Ensure.that(Value.of(usernameField), equals('Alice')),
|
|
24
|
-
* )
|
|
19
|
+
* const usernameField = () =>
|
|
20
|
+
* PageElement.located(By.id('username'))
|
|
21
|
+
* .describedAs('username field')
|
|
25
22
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
23
|
+
* await actorCalled('Lisa')
|
|
24
|
+
* .attemptsTo(
|
|
25
|
+
* Ensure.that(Value.of(usernameField), equals('Alice')),
|
|
26
|
+
* )
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* ## Using Value as {@apilink QuestionAdapter}
|
|
30
|
+
*
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
33
|
+
* import { Ensure, equals } from '@serenity-js/assertions'
|
|
34
|
+
* import { By, PageElement, Value } from '@serenity-js/web'
|
|
35
|
+
*
|
|
36
|
+
* const usernameField = () =>
|
|
37
|
+
* PageElement.located(By.id('username'))
|
|
38
|
+
* .describedAs('username field')
|
|
39
|
+
*
|
|
40
|
+
* await actorCalled('Lisa')
|
|
41
|
+
* .attemptsTo(
|
|
42
|
+
* Ensure.that(
|
|
43
|
+
* Value.of(usernameField).toLocaleLowerCase()[0],
|
|
44
|
+
* equals('a') // [a]lice
|
|
45
|
+
* ),
|
|
46
|
+
* )
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* ## Learn more
|
|
50
|
+
* - {@apilink BrowseTheWeb}
|
|
51
|
+
* - {@apilink MetaQuestion}
|
|
52
|
+
* - {@apilink QuestionAdapter}
|
|
53
|
+
* - {@apilink Question}
|
|
54
|
+
*
|
|
55
|
+
* @group Questions
|
|
28
56
|
*/
|
|
29
|
-
export declare class Value extends
|
|
57
|
+
export declare class Value extends Question<Promise<string>> implements MetaQuestion<Answerable<PageElement>, Promise<string>> {
|
|
30
58
|
private readonly element;
|
|
59
|
+
private subject;
|
|
31
60
|
/**
|
|
32
|
-
* @
|
|
33
|
-
* @
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
* @
|
|
61
|
+
* Instantiates a {@apilink Question} that uses
|
|
62
|
+
* the {@apilink Actor|actor's} {@apilink Ability|ability} to {@apilink BrowseTheWeb} to retrieve
|
|
63
|
+
* the `value` attribute of a given {@apilink PageElement}.
|
|
64
|
+
*
|
|
65
|
+
* #### Learn more
|
|
66
|
+
* - {@apilink MetaQuestion}
|
|
67
|
+
*
|
|
68
|
+
* @param pageElement
|
|
38
69
|
*/
|
|
39
|
-
|
|
70
|
+
static of(pageElement: Answerable<PageElement>): QuestionAdapter<string> & MetaQuestion<Answerable<PageElement>, Promise<string>>;
|
|
71
|
+
protected constructor(element: Answerable<PageElement>);
|
|
40
72
|
/**
|
|
41
|
-
* @
|
|
42
|
-
*
|
|
43
|
-
*
|
|
73
|
+
* Instantiates a {@apilink Question} that uses
|
|
74
|
+
* the {@apilink Actor|actor's} {@apilink Ability|ability} to {@apilink BrowseTheWeb} to retrieve
|
|
75
|
+
* the `value` attribute of a given {@apilink PageElement}
|
|
76
|
+
* located within the `parent` element.
|
|
44
77
|
*
|
|
45
|
-
*
|
|
46
|
-
* @
|
|
78
|
+
* #### Learn more
|
|
79
|
+
* - {@apilink MetaQuestion}
|
|
47
80
|
*
|
|
48
|
-
* @
|
|
81
|
+
* @param parent
|
|
49
82
|
*/
|
|
50
83
|
of(parent: Answerable<PageElement>): Question<Promise<string>>;
|
|
51
84
|
/**
|
|
52
|
-
* @
|
|
53
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
54
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
55
|
-
*
|
|
56
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
57
|
-
* @returns {Promise<void>}
|
|
58
|
-
*
|
|
59
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
60
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
61
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
85
|
+
* @inheritDoc
|
|
62
86
|
*/
|
|
63
87
|
answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<string>;
|
|
88
|
+
/**
|
|
89
|
+
* @inheritDoc
|
|
90
|
+
*/
|
|
91
|
+
describedAs(subject: string): this;
|
|
92
|
+
/**
|
|
93
|
+
* @inheritDoc
|
|
94
|
+
*/
|
|
95
|
+
toString(): string;
|
|
64
96
|
}
|
|
97
|
+
//# sourceMappingURL=Value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Value.d.ts","sourceRoot":"","sources":["../../../src/screenplay/questions/Value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAK,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE5H,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,qBAAa,KACT,SAAQ,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAChC,YAAW,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAkB3C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAhB9C,OAAO,CAAC,OAAO,CAAS;IAExB;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAIjI,SAAS,aAA8B,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC;IAKvE;;;;;;;;;;OAUG;IACH,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAI9D;;OAEG;IACG,UAAU,CAAC,KAAK,EAAE,gBAAgB,GAAG,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAM1E;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAKlC;;OAEG;IACH,QAAQ,IAAI,MAAM;CAGrB"}
|