@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,73 +1,64 @@
|
|
|
1
|
-
import { Answerable, AnswersQuestions, UsesAbilities } from '@serenity-js/core';
|
|
1
|
+
import { Answerable, AnswersQuestions, Interaction, UsesAbilities } from '@serenity-js/core';
|
|
2
2
|
import { PageElement } from '../models';
|
|
3
|
-
import { EnterBuilder } from './EnterBuilder';
|
|
4
3
|
import { PageElementInteraction } from './PageElementInteraction';
|
|
5
4
|
/**
|
|
6
|
-
* @
|
|
7
|
-
*
|
|
8
|
-
* enter a value into a [form `input`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) field.
|
|
5
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
6
|
+
* to enter a value into a [form `input`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) field.
|
|
9
7
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
8
|
+
* ## Example widget
|
|
9
|
+
* ```html
|
|
10
|
+
* <form>
|
|
11
|
+
* <input type="text" name="example" id="example" />
|
|
12
|
+
* </form>
|
|
13
|
+
* ```
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
15
|
+
* ## Lean Page Object describing the widget
|
|
17
16
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { By, PageElement } from '@serenity-js/web'
|
|
19
|
+
*
|
|
20
|
+
* class Form {
|
|
21
|
+
* static exampleInput = () =>
|
|
22
|
+
* PageElement.located(By.id('example'))
|
|
23
|
+
* .describedAs('example input')
|
|
21
24
|
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* ## Entering the value into a form field
|
|
28
|
+
*
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
31
|
+
* import { Enter } from '@serenity-js/web';
|
|
22
32
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
33
|
+
* await actorCalled('Esme')
|
|
34
|
+
* .attemptsTo(
|
|
35
|
+
* Enter.theValue('Hello world!').into(Form.exampleInput()),
|
|
36
|
+
* )
|
|
37
|
+
* ```
|
|
26
38
|
*
|
|
27
|
-
*
|
|
28
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
29
|
-
* .attemptsTo(
|
|
30
|
-
* Enter.theValue('Hello world!').into(Form.exampleInput),
|
|
31
|
-
* );
|
|
39
|
+
* ## Learn more
|
|
32
40
|
*
|
|
33
|
-
*
|
|
41
|
+
* - {@apilink BrowseTheWeb}
|
|
42
|
+
* - {@apilink PageElement}
|
|
34
43
|
*
|
|
35
|
-
* @
|
|
44
|
+
* @group Activities
|
|
36
45
|
*/
|
|
37
46
|
export declare class Enter extends PageElementInteraction {
|
|
38
47
|
private readonly values;
|
|
39
48
|
private readonly field;
|
|
40
49
|
/**
|
|
41
|
-
* @
|
|
42
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
43
|
-
*
|
|
44
|
-
* @param {Array<Answerable<string | number | string[] | number[]>>} values
|
|
45
|
-
* The value to be entered
|
|
46
|
-
*
|
|
47
|
-
* @returns {EnterBuilder}
|
|
48
|
-
*/
|
|
49
|
-
static theValue(...values: Array<Answerable<string | number | string[] | number[]>>): EnterBuilder;
|
|
50
|
-
/**
|
|
51
|
-
* @param {Array<Answerable<string | number | string[] | number[]>>} values
|
|
52
|
-
* The value to be entered
|
|
50
|
+
* Instantiates this {@apilink Interaction}.
|
|
53
51
|
*
|
|
54
|
-
* @param
|
|
55
|
-
* The
|
|
52
|
+
* @param values
|
|
53
|
+
* The text value to be entered
|
|
56
54
|
*/
|
|
57
|
-
|
|
55
|
+
static theValue(...values: Array<Answerable<string | number | string[] | number[]>>): {
|
|
56
|
+
into: (field: Answerable<PageElement>) => Interaction;
|
|
57
|
+
};
|
|
58
|
+
protected constructor(values: Array<Answerable<string | number | string[] | number[]>>, field: Answerable<PageElement>);
|
|
58
59
|
/**
|
|
59
|
-
* @
|
|
60
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
61
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
62
|
-
*
|
|
63
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
64
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
65
|
-
*
|
|
66
|
-
* @returns {Promise<void>}
|
|
67
|
-
*
|
|
68
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
69
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
70
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
60
|
+
* @inheritDoc
|
|
71
61
|
*/
|
|
72
62
|
performAs(actor: UsesAbilities & AnswersQuestions): Promise<void>;
|
|
73
63
|
}
|
|
64
|
+
//# sourceMappingURL=Enter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Enter.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/Enter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAK,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGhG,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,qBAAa,KAAM,SAAQ,sBAAsB;IAgBzC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAf1B;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,WAAW,CAAA;KAAE;IAO/I,SAAS,aACY,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,EAChE,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC;IAKnD;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAO1E"}
|
|
@@ -1,80 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Enter = void 0;
|
|
4
|
+
const core_1 = require("@serenity-js/core");
|
|
4
5
|
const io_1 = require("@serenity-js/core/lib/io");
|
|
5
6
|
const PageElementInteraction_1 = require("./PageElementInteraction");
|
|
6
7
|
/**
|
|
7
|
-
* @
|
|
8
|
-
*
|
|
9
|
-
* enter a value into a [form `input`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) field.
|
|
8
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
9
|
+
* to enter a value into a [form `input`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) field.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* ## Example widget
|
|
12
|
+
* ```html
|
|
13
|
+
* <form>
|
|
14
|
+
* <input type="text" name="example" id="example" />
|
|
15
|
+
* </form>
|
|
16
|
+
* ```
|
|
15
17
|
*
|
|
16
|
-
*
|
|
17
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
18
|
+
* ## Lean Page Object describing the widget
|
|
18
19
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { By, PageElement } from '@serenity-js/web'
|
|
22
|
+
*
|
|
23
|
+
* class Form {
|
|
24
|
+
* static exampleInput = () =>
|
|
25
|
+
* PageElement.located(By.id('example'))
|
|
26
|
+
* .describedAs('example input')
|
|
22
27
|
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* ## Entering the value into a form field
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
34
|
+
* import { Enter } from '@serenity-js/web';
|
|
23
35
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
36
|
+
* await actorCalled('Esme')
|
|
37
|
+
* .attemptsTo(
|
|
38
|
+
* Enter.theValue('Hello world!').into(Form.exampleInput()),
|
|
39
|
+
* )
|
|
40
|
+
* ```
|
|
27
41
|
*
|
|
28
|
-
*
|
|
29
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
30
|
-
* .attemptsTo(
|
|
31
|
-
* Enter.theValue('Hello world!').into(Form.exampleInput),
|
|
32
|
-
* );
|
|
42
|
+
* ## Learn more
|
|
33
43
|
*
|
|
34
|
-
*
|
|
44
|
+
* - {@apilink BrowseTheWeb}
|
|
45
|
+
* - {@apilink PageElement}
|
|
35
46
|
*
|
|
36
|
-
* @
|
|
47
|
+
* @group Activities
|
|
37
48
|
*/
|
|
38
49
|
class Enter extends PageElementInteraction_1.PageElementInteraction {
|
|
39
50
|
/**
|
|
40
|
-
*
|
|
41
|
-
* The value to be entered
|
|
42
|
-
*
|
|
43
|
-
* @param {Answerable<PageElement>} field
|
|
44
|
-
* The field to enter the value into
|
|
45
|
-
*/
|
|
46
|
-
constructor(values, field /* todo | Question<AlertPromise> | AlertPromise */) {
|
|
47
|
-
super((0, io_1.formatted) `#actor enters ${values.join(', ')} into ${field}`);
|
|
48
|
-
this.values = values;
|
|
49
|
-
this.field = field;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* @desc
|
|
53
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
54
|
-
*
|
|
55
|
-
* @param {Array<Answerable<string | number | string[] | number[]>>} values
|
|
56
|
-
* The value to be entered
|
|
51
|
+
* Instantiates this {@apilink Interaction}.
|
|
57
52
|
*
|
|
58
|
-
* @
|
|
53
|
+
* @param values
|
|
54
|
+
* The text value to be entered
|
|
59
55
|
*/
|
|
60
56
|
static theValue(...values) {
|
|
61
57
|
return {
|
|
62
58
|
into: (field /* todo Question<AlertPromise> | AlertPromise */) => new Enter(values, field),
|
|
63
59
|
};
|
|
64
60
|
}
|
|
61
|
+
constructor(values, field /* todo | Question<AlertPromise> | AlertPromise */) {
|
|
62
|
+
super((0, core_1.d) `#actor enters ${values.join(', ')} into ${field}`);
|
|
63
|
+
this.values = values;
|
|
64
|
+
this.field = field;
|
|
65
|
+
}
|
|
65
66
|
/**
|
|
66
|
-
* @
|
|
67
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
68
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
69
|
-
*
|
|
70
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
71
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
72
|
-
*
|
|
73
|
-
* @returns {Promise<void>}
|
|
74
|
-
*
|
|
75
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
76
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
77
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
67
|
+
* @inheritDoc
|
|
78
68
|
*/
|
|
79
69
|
async performAs(actor) {
|
|
80
70
|
const field = await this.resolve(actor, this.field);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Enter.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Enter.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Enter.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Enter.ts"],"names":[],"mappings":";;;AAAA,4CAAgG;AAChG,iDAAoD;AAGpD,qEAAkE;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAa,KAAM,SAAQ,+CAAsB;IAE7C;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAgE;QAC/E,OAAO;YACH,IAAI,EAAE,CAAC,KAA8B,CAAE,gDAAgD,EAAE,EAAE,CACvF,IAAI,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC;SAC/B,CAAC;IACN,CAAC;IAED,YACqB,MAAgE,EAChE,KAA8B,CAAC,kDAAkD;QAElG,KAAK,CAAC,IAAA,QAAC,EAAC,iBAAkB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAE,SAAU,KAAM,EAAE,CAAC,CAAC;QAH/C,WAAM,GAAN,MAAM,CAA0D;QAChE,UAAK,GAAL,KAAK,CAAyB;IAGnD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,KAAuC;QACnD,MAAM,KAAK,GAAI,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAErD,MAAM,aAAa,GAAG,MAAM,IAAA,aAAQ,EAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;QAE/E,OAAO,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;CACJ;AAhCD,sBAgCC"}
|
|
@@ -1,206 +1,202 @@
|
|
|
1
1
|
import { Answerable, AnswersQuestions, CollectsArtifacts, Interaction, UsesAbilities } from '@serenity-js/core';
|
|
2
2
|
/**
|
|
3
|
-
* @
|
|
4
|
-
*
|
|
5
|
-
* execute a script within the context of the current browser window.
|
|
3
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
4
|
+
* to execute a script within the context of the current browser tab.
|
|
6
5
|
*
|
|
7
|
-
*
|
|
6
|
+
* ## Learn more
|
|
8
7
|
*
|
|
9
|
-
*
|
|
8
|
+
* - {@apilink BrowseTheWeb}
|
|
9
|
+
* - {@apilink LastScriptExecution.result}
|
|
10
|
+
*
|
|
11
|
+
* @group Activities
|
|
10
12
|
*/
|
|
11
13
|
export declare class ExecuteScript {
|
|
12
14
|
/**
|
|
13
|
-
* @
|
|
14
|
-
*
|
|
15
|
-
* configured to load a script from `sourceUrl`.
|
|
15
|
+
* Instantiates a version of this {@apilink Interaction}
|
|
16
|
+
* configured to load a script from `sourceUrl`.
|
|
16
17
|
*
|
|
17
|
-
* @param
|
|
18
|
+
* @param sourceUrl
|
|
18
19
|
* The URL to load the script from
|
|
19
|
-
*
|
|
20
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
21
20
|
*/
|
|
22
|
-
static from(sourceUrl: string): Interaction;
|
|
21
|
+
static from(sourceUrl: Answerable<string>): Interaction;
|
|
23
22
|
/**
|
|
24
|
-
* @
|
|
25
|
-
*
|
|
26
|
-
* The script fragment will be executed as the body of an anonymous function.
|
|
27
|
-
* If the script is provided as a function object, that function will be converted to a string for injection
|
|
28
|
-
* into the target window.
|
|
23
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
24
|
+
* to execute an asynchronous script within the context of the current browser tab.
|
|
29
25
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* Arrays and objects may also be used as script arguments as long as each item adheres
|
|
34
|
-
* to the types previously mentioned.
|
|
26
|
+
* The script fragment will be executed as the body of an anonymous function.
|
|
27
|
+
* If the script is provided as a function object, that function will be converted to a string for injection
|
|
28
|
+
* into the target window.
|
|
35
29
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
30
|
+
* Any arguments provided in addition to the script will be included as script arguments and may be referenced
|
|
31
|
+
* using the `arguments` object. Arguments may be a `boolean`, `number`, `string`
|
|
32
|
+
* or {@apilink PageElement}.
|
|
33
|
+
* Arrays and objects may also be used as script arguments as long as each item adheres
|
|
34
|
+
* to the types previously mentioned.
|
|
38
35
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
36
|
+
* Unlike executing synchronous JavaScript with {@apilink ExecuteScript.sync},
|
|
37
|
+
* scripts executed with this function must explicitly signal they are finished by invoking the provided callback.
|
|
41
38
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
39
|
+
* This callback will always be injected into the executed function as the last argument,
|
|
40
|
+
* and thus may be referenced with `arguments[arguments.length - 1]`.
|
|
44
41
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
42
|
+
* If the script invokes the `callback` with a return value, this will be made available
|
|
43
|
+
* via the {@apilink LastScriptExecution.result}.
|
|
47
44
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
45
|
+
* **Please note** that in order to signal an error in the `script` you need to throw an {@apilink Error}
|
|
46
|
+
* instead of passing it to the callback function.
|
|
50
47
|
*
|
|
51
|
-
*
|
|
52
|
-
* ExecuteScript.async(`
|
|
53
|
-
* var callback = arguments[arguments.length - 1];
|
|
48
|
+
* #### Executing an async script
|
|
54
49
|
*
|
|
55
|
-
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
52
|
+
* import { ExecuteScript } from '@serenity-js/web'
|
|
56
53
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
54
|
+
* await actorCalled('Esti').attemptsTo(
|
|
55
|
+
* ExecuteScript.async(`
|
|
56
|
+
* var callback = arguments[arguments.length - 1]
|
|
60
57
|
*
|
|
61
|
-
*
|
|
62
|
-
* import { ExecuteScript } from '@serenity-js/webdriverio';
|
|
58
|
+
* // do stuff
|
|
63
59
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* var callback = arguments[arguments.length - 1];
|
|
60
|
+
* callback(result)
|
|
61
|
+
* `)
|
|
62
|
+
* )
|
|
63
|
+
* ```
|
|
69
64
|
*
|
|
70
|
-
*
|
|
65
|
+
* #### Passing arguments to an async script
|
|
71
66
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
67
|
+
* ```ts
|
|
68
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
69
|
+
* import { ExecuteScript } from '@serenity-js/web'
|
|
75
70
|
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
71
|
+
* await actorCalled('Esti').attemptsTo(
|
|
72
|
+
* ExecuteScript.async(`
|
|
73
|
+
* var name = arguments[0];
|
|
74
|
+
* var age = arguments[1];
|
|
75
|
+
* var callback = arguments[arguments.length - 1]
|
|
78
76
|
*
|
|
79
|
-
*
|
|
80
|
-
* ExecuteScript.async(`
|
|
81
|
-
* var header = arguments[0]; // Target gets converted to a WebElement
|
|
82
|
-
* var callback = arguments[arguments.length - 1];
|
|
77
|
+
* // do stuff
|
|
83
78
|
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
79
|
+
* callback(result)
|
|
80
|
+
* `).withArguments('Bob', 24)
|
|
81
|
+
* )
|
|
82
|
+
* ```
|
|
87
83
|
*
|
|
88
|
-
*
|
|
89
|
-
* import { ExecuteScript } from '@serenity-js/webdriverio';
|
|
84
|
+
* #### Passing Target arguments to an async script
|
|
90
85
|
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* }).withArguments(Target.the('header').located(by.css('h1')))
|
|
95
|
-
* );
|
|
86
|
+
* ```ts
|
|
87
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
88
|
+
* import { ExecuteScript } from '@serenity-js/web'
|
|
96
89
|
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
90
|
+
* await actorCalled('Esti').attemptsTo(
|
|
91
|
+
* ExecuteScript.async(`
|
|
92
|
+
* var header = arguments[0] // PageElement object gets converted to a WebElement
|
|
93
|
+
* var callback = arguments[arguments.length - 1]
|
|
94
|
+
*
|
|
95
|
+
* callback(header.innerText)
|
|
96
|
+
* `).withArguments(PageElement.located(By.css('h1')).describedAs('header'))
|
|
97
|
+
* )
|
|
98
|
+
* ```
|
|
99
99
|
*
|
|
100
|
-
*
|
|
100
|
+
* #### Executing async script as function
|
|
101
101
|
*
|
|
102
|
-
*
|
|
102
|
+
* ```ts
|
|
103
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
104
|
+
* import { ExecuteScript } from '@serenity-js/web'
|
|
105
|
+
*
|
|
106
|
+
* await actorCalled('Esti').attemptsTo(
|
|
107
|
+
* ExecuteScript.async(function getText(header, callback) {
|
|
108
|
+
* callback(header.innerText)
|
|
109
|
+
* }).withArguments(PageElement.located(By.css('h1')).describedAs('header'))
|
|
110
|
+
* )
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* #### Learn more
|
|
114
|
+
* - {@apilink LastScriptExecution.result}
|
|
115
|
+
*
|
|
116
|
+
* @param script
|
|
117
|
+
* The script to be executed
|
|
103
118
|
*/
|
|
104
119
|
static async(script: string | Function): ExecuteScriptWithArguments;
|
|
105
120
|
/**
|
|
106
|
-
* @
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* // inject JavaScript to read some property of an element
|
|
135
|
-
* ExecuteScript.sync(function getValue(element) {
|
|
136
|
-
* return element.value;
|
|
137
|
-
* }).withArguments(someOfferField),
|
|
138
|
-
*
|
|
139
|
-
* // use LastScriptExecution.result() to read the value
|
|
140
|
-
* // returned from the injected script
|
|
141
|
-
* // and pass it to another interaction
|
|
142
|
-
* Enter.theValue(LastScriptExecution.result<string>()).into(applyOfferCodeField),
|
|
143
|
-
* );
|
|
144
|
-
*
|
|
145
|
-
* @param {string | Function} script
|
|
146
|
-
* The script to be executed
|
|
121
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
122
|
+
* to execute a synchronous script within the context of the current browser tab.
|
|
123
|
+
*
|
|
124
|
+
* If the script returns a value, it will be made available via {@apilink LastScriptExecution.result}.
|
|
125
|
+
*
|
|
126
|
+
* #### Executing a sync script as string and reading the result
|
|
127
|
+
*
|
|
128
|
+
* ```ts
|
|
129
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
130
|
+
* import { ExecuteScript, LastScriptExecution } from '@serenity-js/web'
|
|
131
|
+
* import { Ensure, includes } from '@serenity-js/assertions'
|
|
132
|
+
*
|
|
133
|
+
* await actorCalled('Joseph')
|
|
134
|
+
* .attemptsTo(
|
|
135
|
+
* ExecuteScript.sync('return navigator.userAgent'),
|
|
136
|
+
* Ensure.that(LastScriptExecution.result<string>(), includes('Chrome')),
|
|
137
|
+
* )
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* #### Executing a sync script as function and reading the result
|
|
141
|
+
*
|
|
142
|
+
* ```ts
|
|
143
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
144
|
+
* import { By, Enter, ExecuteScript, LastScriptExecution, PageElement } from '@serenity-js/web'
|
|
145
|
+
*
|
|
146
|
+
* const someOfferField = () =>
|
|
147
|
+
* PageElement.located(By.id('offer-code'))
|
|
148
|
+
* .describedAs('offer code')
|
|
147
149
|
*
|
|
148
|
-
*
|
|
150
|
+
* const applyOfferCodeField = () =>
|
|
151
|
+
* PageElement.located(By.id('apply-offer-code'))
|
|
152
|
+
* .describedAs('apply offer field')
|
|
149
153
|
*
|
|
150
|
-
*
|
|
154
|
+
* await actorCalled('Joseph')
|
|
155
|
+
* .attemptsTo(
|
|
156
|
+
* // inject JavaScript to read some property of an element
|
|
157
|
+
* ExecuteScript.sync(function getValue(element) {
|
|
158
|
+
* return element.value;
|
|
159
|
+
* }).withArguments(someOfferField),
|
|
160
|
+
*
|
|
161
|
+
* // use LastScriptExecution.result() to read the value
|
|
162
|
+
* // returned from the injected script
|
|
163
|
+
* // and pass it to another interaction
|
|
164
|
+
* Enter.theValue(LastScriptExecution.result<string>()).into(applyOfferCodeField),
|
|
165
|
+
* )
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* #### Learn more
|
|
169
|
+
* - {@apilink LastScriptExecution.result}
|
|
170
|
+
*
|
|
171
|
+
* @param script
|
|
172
|
+
* The script to be executed
|
|
151
173
|
*/
|
|
152
174
|
static sync(script: string | Function): ExecuteScriptWithArguments;
|
|
153
175
|
}
|
|
154
176
|
/**
|
|
155
|
-
*
|
|
156
|
-
* Allows for a script to be executed to be parametrised.
|
|
177
|
+
* Allows for a script to be executed to be parametrised.
|
|
157
178
|
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
179
|
+
* ## Learn more
|
|
180
|
+
* - {@apilink ExecuteScript}
|
|
160
181
|
*
|
|
161
|
-
* @
|
|
162
|
-
*
|
|
163
|
-
* @see {@link ExecuteScript}
|
|
164
|
-
*
|
|
165
|
-
* @extends {@serenity-js/core/lib/screenplay~Interaction}
|
|
182
|
+
* @group Activities
|
|
166
183
|
*/
|
|
167
184
|
export declare abstract class ExecuteScriptWithArguments extends Interaction {
|
|
168
185
|
protected readonly script: string | Function;
|
|
169
186
|
protected readonly args: Array<Answerable<any>>;
|
|
170
|
-
|
|
171
|
-
* @param {string | Function} script
|
|
172
|
-
* The script to be executed
|
|
173
|
-
*
|
|
174
|
-
* @param {Array<Answerable<any>>} args
|
|
175
|
-
* Arguments to parametrise the script with
|
|
176
|
-
*/
|
|
177
|
-
constructor(script: string | Function, // eslint-disable-line @typescript-eslint/ban-types
|
|
187
|
+
constructor(description: string, script: string | Function, // eslint-disable-line @typescript-eslint/ban-types
|
|
178
188
|
args?: Array<Answerable<any>>);
|
|
179
189
|
/**
|
|
180
|
-
* @
|
|
181
|
-
* Instantiates an {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
182
|
-
* to {@link Enter}.
|
|
190
|
+
* Instantiates this {@apilink Interaction}
|
|
183
191
|
*
|
|
184
|
-
* @param
|
|
192
|
+
* @param args
|
|
185
193
|
* Arguments to parametrise the script with
|
|
186
|
-
*
|
|
187
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
188
194
|
*/
|
|
189
195
|
abstract withArguments(...args: Array<Answerable<any>>): Interaction;
|
|
190
196
|
/**
|
|
191
|
-
* @
|
|
192
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
193
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
194
|
-
*
|
|
195
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
196
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
197
|
-
*
|
|
198
|
-
* @returns {PromiseLike<void>}
|
|
199
|
-
*
|
|
200
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
201
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
202
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
197
|
+
* @inheritDoc
|
|
203
198
|
*/
|
|
204
199
|
performAs(actor: UsesAbilities & CollectsArtifacts & AnswersQuestions): Promise<void>;
|
|
205
200
|
protected abstract executeAs(actor: UsesAbilities & AnswersQuestions, args: any[]): Promise<any>;
|
|
206
201
|
}
|
|
202
|
+
//# sourceMappingURL=ExecuteScript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecuteScript.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/ExecuteScript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAK,WAAW,EAAc,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAM/H;;;;;;;;;;GAUG;AACH,qBAAa,aAAa;IAEtB;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,WAAW;IAIvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgGG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,0BAA0B;IAOnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqDG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,0BAA0B;CAMrE;AAED;;;;;;;GAOG;AACH,8BAAsB,0BAA2B,SAAQ,WAAW;IAI5D,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ;IAC5C,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;gBAF/C,WAAW,EAAE,MAAM,EACA,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAY,mDAAmD;IACxF,IAAI,GAAE,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAM;IAKxD;;;;;OAKG;aACa,aAAa,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW;IAE3E;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAc3F,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,gBAAgB,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;CACnG"}
|