@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
|
@@ -2,155 +2,155 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Navigate = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
5
|
const abilities_1 = require("../abilities");
|
|
7
6
|
/**
|
|
8
|
-
* @
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
8
|
+
* to navigate to a specific destination, as well as back and forth in the browser history,
|
|
9
|
+
* or reload the current page.
|
|
10
|
+
*
|
|
11
|
+
* ## Learn more
|
|
12
|
+
*
|
|
13
|
+
* - {@apilink BrowseTheWeb}
|
|
14
|
+
*
|
|
15
|
+
* @group Activities
|
|
12
16
|
*/
|
|
13
17
|
class Navigate {
|
|
14
18
|
/**
|
|
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
|
-
* @param {Answerable<string>} url
|
|
53
|
-
* An absolute URL or path an {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
54
|
-
* should navigate to
|
|
19
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
20
|
+
* to navigate to a given URL.
|
|
21
|
+
*
|
|
22
|
+
* The URL can be:
|
|
23
|
+
* - absolute, e.g. `https://example.org/search`
|
|
24
|
+
* - relative, e.g. `/search`
|
|
25
|
+
*
|
|
26
|
+
* If the URL is relative, your Web test integration tool will append it to any base URL
|
|
27
|
+
* specified in its respective configuration file.
|
|
28
|
+
*
|
|
29
|
+
*
|
|
30
|
+
* #### Navigate to path relative to baseUrl
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
34
|
+
* import { Navigate } from '@serenity-js/web'
|
|
35
|
+
*
|
|
36
|
+
* await actorCalled('Hannu')
|
|
37
|
+
* .attemptsTo(
|
|
38
|
+
* Navigate.to('/search'),
|
|
39
|
+
* )
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* ## Navigate to an absolute URL (overrides baseUrl)
|
|
43
|
+
*
|
|
44
|
+
* ```ts
|
|
45
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
46
|
+
* import { Navigate } from '@serenity-js/web'
|
|
47
|
+
*
|
|
48
|
+
* await actorCalled('Hannu')
|
|
49
|
+
* .whoCan(BrowseTheWeb.using(browser))
|
|
50
|
+
* .attemptsTo(
|
|
51
|
+
* Navigate.to('https://mycompany.org/login'),
|
|
52
|
+
* )
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* #### Learn more
|
|
55
56
|
*
|
|
56
|
-
*
|
|
57
|
+
* - {@apilink Page.navigateTo}
|
|
58
|
+
* - [WebdriverIO: Configuration Options](https://webdriver.io/docs/options/#baseurl)
|
|
59
|
+
* - [Playwright: Browser](https://playwright.dev/docs/api/class-browser#browser-new-context)
|
|
60
|
+
* - [Playwright: Test Options](https://playwright.dev/docs/api/class-testoptions#test-options-base-url)
|
|
61
|
+
* - [Protractor: Configuration](https://github.com/angular/protractor/blob/master/lib/config.ts)
|
|
57
62
|
*
|
|
58
|
-
* @
|
|
63
|
+
* @param url
|
|
64
|
+
* An absolute URL or path an {@apilink Actor}
|
|
65
|
+
* should navigate to
|
|
59
66
|
*/
|
|
60
67
|
static to(url) {
|
|
61
68
|
return new NavigateToUrl(url);
|
|
62
69
|
}
|
|
63
70
|
/**
|
|
64
|
-
* @
|
|
65
|
-
*
|
|
66
|
-
* navigate back one page in the joint session history of the current top-level browsing context.
|
|
67
|
-
*
|
|
68
|
-
* @example <caption>Navigate to path relative to baseUrl</caption>
|
|
69
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
70
|
-
* import { Ensure, endsWith } from '@serenity-js/assertions';
|
|
71
|
-
* import { BrowseTheWeb, Navigate } from '@serenity-js/webdriverio';
|
|
71
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
72
|
+
* to navigate back one page in the joint session history of the current top-level browsing context.
|
|
72
73
|
*
|
|
73
|
-
*
|
|
74
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
75
|
-
* .attemptsTo(
|
|
76
|
-
* Navigate.to('/first'),
|
|
77
|
-
* Navigate.to('/second'),
|
|
74
|
+
* #### Navigate back in browsing history
|
|
78
75
|
*
|
|
79
|
-
*
|
|
76
|
+
* ```ts
|
|
77
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
78
|
+
* import { Ensure, endsWith } from '@serenity-js/assertions'
|
|
79
|
+
* import { Navigate, Page } from '@serenity-js/web'
|
|
80
80
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
81
|
+
* await actorCalled('Hannu')
|
|
82
|
+
* .whoCan(BrowseTheWeb.using(browser))
|
|
83
|
+
* .attemptsTo(
|
|
84
|
+
* Navigate.to('/first'),
|
|
85
|
+
* Navigate.to('/second'),
|
|
83
86
|
*
|
|
84
|
-
*
|
|
87
|
+
* Navigate.back(),
|
|
85
88
|
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* @see {@link @serenity-js/assertions/lib/expectations~endsWith}
|
|
89
|
+
* Ensure.that(Page.current().url().href, endsWith('/first')),
|
|
90
|
+
* )
|
|
91
|
+
* ```
|
|
90
92
|
*/
|
|
91
93
|
static back() {
|
|
92
|
-
return core_1.Interaction.where(`#actor navigates back in the browser history`, actor =>
|
|
94
|
+
return core_1.Interaction.where(`#actor navigates back in the browser history`, async (actor) => {
|
|
95
|
+
const page = await abilities_1.BrowseTheWeb.as(actor).currentPage();
|
|
96
|
+
await page.navigateBack();
|
|
97
|
+
});
|
|
93
98
|
}
|
|
94
99
|
/**
|
|
95
|
-
* @
|
|
96
|
-
*
|
|
97
|
-
* navigate forward one page in the session history.
|
|
98
|
-
*
|
|
99
|
-
* @example <caption>Navigate to path relative to baseUrl</caption>
|
|
100
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
101
|
-
* import { Ensure, endsWith } from '@serenity-js/assertions';
|
|
102
|
-
* import { BrowseTheWeb, Navigate } from '@serenity-js/webdriverio';
|
|
100
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
101
|
+
* to navigate forward one page in the joint session history of the current top-level browsing context.
|
|
103
102
|
*
|
|
104
|
-
*
|
|
105
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
106
|
-
* .attemptsTo(
|
|
107
|
-
* Navigate.to('/first'),
|
|
108
|
-
* Navigate.to('/second'),
|
|
103
|
+
* #### Navigate forward in browsing history
|
|
109
104
|
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
105
|
+
* ```ts
|
|
106
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
107
|
+
* import { Ensure, endsWith } from '@serenity-js/assertions'
|
|
108
|
+
* import { Navigate, Page } from '@serenity-js/web'
|
|
112
109
|
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
110
|
+
* await actorCalled('Hannu')
|
|
111
|
+
* .whoCan(BrowseTheWeb.using(browser))
|
|
112
|
+
* .attemptsTo(
|
|
113
|
+
* Navigate.to('/first'),
|
|
114
|
+
* Navigate.to('/second'),
|
|
115
115
|
*
|
|
116
|
-
*
|
|
116
|
+
* Navigate.back(),
|
|
117
|
+
* Navigate.forward(),
|
|
117
118
|
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
* @see https://webdriver.io/docs/api/webdriver/#forward
|
|
119
|
+
* Ensure.that(Page.current().url().href, endsWith('/second')),
|
|
120
|
+
* )
|
|
121
|
+
* ```
|
|
122
122
|
*/
|
|
123
123
|
static forward() {
|
|
124
|
-
return core_1.Interaction.where(`#actor navigates forward in the browser history`, actor =>
|
|
124
|
+
return core_1.Interaction.where(`#actor navigates forward in the browser history`, async (actor) => {
|
|
125
|
+
const page = await abilities_1.BrowseTheWeb.as(actor).currentPage();
|
|
126
|
+
await page.navigateForward();
|
|
127
|
+
});
|
|
125
128
|
}
|
|
126
129
|
/**
|
|
127
|
-
* @
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
146
|
-
*
|
|
147
|
-
* @see {@link BrowseTheWeb}
|
|
148
|
-
* @see {@link Cookie}
|
|
149
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
150
|
-
* @see {@link @serenity-js/assertions/lib/expectations~endsWith}
|
|
130
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
131
|
+
* to reload the current page.
|
|
132
|
+
*
|
|
133
|
+
* #### Navigate to path relative to baseUrl
|
|
134
|
+
*
|
|
135
|
+
* ```ts
|
|
136
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
137
|
+
* import { Ensure, endsWith } from '@serenity-js/assertions'
|
|
138
|
+
* import { Navigate, Cookie } from '@serenity-js/web'
|
|
139
|
+
*
|
|
140
|
+
* await actorCalled('Hannu')
|
|
141
|
+
* .whoCan(BrowseTheWebWithWebdriverIO.using(browser))
|
|
142
|
+
* .attemptsTo(
|
|
143
|
+
* Navigate.to('/login'),
|
|
144
|
+
* Cookie.called('session_id').delete(),
|
|
145
|
+
* Navigate.reloadPage(),
|
|
146
|
+
* )
|
|
147
|
+
* ```
|
|
151
148
|
*/
|
|
152
149
|
static reloadPage() {
|
|
153
|
-
return core_1.Interaction.where(`#actor reloads the page`, actor =>
|
|
150
|
+
return core_1.Interaction.where(`#actor reloads the page`, async (actor) => {
|
|
151
|
+
const page = await abilities_1.BrowseTheWeb.as(actor).currentPage();
|
|
152
|
+
await page.reload();
|
|
153
|
+
});
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
exports.Navigate = Navigate;
|
|
@@ -159,40 +159,18 @@ exports.Navigate = Navigate;
|
|
|
159
159
|
*/
|
|
160
160
|
class NavigateToUrl extends core_1.Interaction {
|
|
161
161
|
constructor(url) {
|
|
162
|
-
super();
|
|
162
|
+
super((0, core_1.d) `#actor navigates to ${url}`);
|
|
163
163
|
this.url = url;
|
|
164
164
|
}
|
|
165
165
|
/**
|
|
166
|
-
* @
|
|
167
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
168
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
169
|
-
*
|
|
170
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
171
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
172
|
-
* to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
173
|
-
*
|
|
174
|
-
* @returns {PromiseLike<void>}
|
|
175
|
-
*
|
|
176
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
177
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
178
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
166
|
+
* @inheritDoc
|
|
179
167
|
*/
|
|
180
|
-
performAs(actor) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
.catch(error => {
|
|
168
|
+
async performAs(actor) {
|
|
169
|
+
const url = await actor.answer(this.url);
|
|
170
|
+
const page = await abilities_1.BrowseTheWeb.as(actor).currentPage();
|
|
171
|
+
return page.navigateTo(url).catch(error => {
|
|
185
172
|
throw new core_1.TestCompromisedError(`Couldn't navigate to ${url}`, error);
|
|
186
|
-
})
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* @desc
|
|
190
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
191
|
-
*
|
|
192
|
-
* @returns {string}
|
|
193
|
-
*/
|
|
194
|
-
toString() {
|
|
195
|
-
return (0, io_1.formatted) `#actor navigates to ${this.url}`;
|
|
173
|
+
});
|
|
196
174
|
}
|
|
197
175
|
}
|
|
198
176
|
//# sourceMappingURL=Navigate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navigate.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Navigate.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"Navigate.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Navigate.ts"],"names":[],"mappings":";;;AAAA,4CAAsH;AAEtH,4CAA4C;AAE5C;;;;;;;;;;GAUG;AACH,MAAa,QAAQ;IAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;IACH,MAAM,CAAC,EAAE,CAAC,GAAuB;QAC7B,OAAO,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM,CAAC,IAAI;QACP,OAAO,kBAAW,CAAC,KAAK,CAAC,8CAA8C,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;YACnF,MAAM,IAAI,GAAG,MAAM,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;YAExD,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CAAC,OAAO;QACV,OAAO,kBAAW,CAAC,KAAK,CAAC,iDAAiD,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;YACtF,MAAM,IAAI,GAAG,MAAM,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;YAExD,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QACjC,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,UAAU;QACb,OAAO,kBAAW,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,MAAM,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;YAExD,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAjJD,4BAiJC;AAED;;GAEG;AACH,MAAM,aAAc,SAAQ,kBAAW;IACnC,YAA6B,GAAuB;QAChD,KAAK,CAAC,IAAA,QAAC,EAAA,uBAAwB,GAAI,EAAE,CAAC,CAAC;QADd,QAAG,GAAH,GAAG,CAAoB;IAEpD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,KAAuC;QACnD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACzC,MAAM,IAAI,GAAG,MAAM,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QAExD,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACtC,MAAM,IAAI,2BAAoB,CAAC,wBAAyB,GAAI,EAAE,EAAE,KAAK,CAAC,CAAC;QAC3E,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -1,39 +1,23 @@
|
|
|
1
1
|
import { Answerable, AnswersQuestions, Interaction } from '@serenity-js/core';
|
|
2
|
+
import { FileSystemLocation } from '@serenity-js/core/lib/io';
|
|
2
3
|
import { PageElement } from '../models';
|
|
3
4
|
/**
|
|
4
|
-
* @
|
|
5
|
-
* A base class for interactions with {@link PageElement}s.
|
|
5
|
+
* A base class for interactions with {@apilink PageElement} objects.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* **Note:** The recommended way to implement custom interactions
|
|
8
|
+
* in your code is to use the {@apilink Interaction.where} factory method.
|
|
9
|
+
*
|
|
10
|
+
* @group Activities
|
|
8
11
|
*/
|
|
9
12
|
export declare abstract class PageElementInteraction extends Interaction {
|
|
10
|
-
|
|
13
|
+
protected constructor(description: string, location?: FileSystemLocation);
|
|
11
14
|
/**
|
|
12
|
-
* @
|
|
13
|
-
*
|
|
14
|
-
* this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
15
|
+
* Returns the resolved {@apilink PageElement}, or throws a {@apilink LogicError}
|
|
16
|
+
* if the element is `undefined`.
|
|
15
17
|
*
|
|
16
|
-
* @
|
|
17
|
-
|
|
18
|
-
protected constructor(description: string);
|
|
19
|
-
/**
|
|
20
|
-
* @desc
|
|
21
|
-
* Returns the resolved {@link PageElement}, or throws a {@link @serenity-js/core/lib/errors~LogicError}
|
|
22
|
-
* if the element is `undefined`.
|
|
23
|
-
*
|
|
24
|
-
* @param {@serenity-js/core/lib/screenplay/actor~AnswersQuestions} actor
|
|
25
|
-
* @param {@serenity-js/core/lib/screenplay~Answerable<Element<'async'>>} element
|
|
26
|
-
*
|
|
27
|
-
* @returns {Promise<PageElement>}
|
|
28
|
-
*
|
|
29
|
-
* @protected
|
|
18
|
+
* @param actor
|
|
19
|
+
* @param element
|
|
30
20
|
*/
|
|
31
21
|
protected resolve(actor: AnswersQuestions, element: Answerable<PageElement>): Promise<PageElement>;
|
|
32
|
-
/**
|
|
33
|
-
* @desc
|
|
34
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
35
|
-
*
|
|
36
|
-
* @returns {string}
|
|
37
|
-
*/
|
|
38
|
-
toString(): string;
|
|
39
22
|
}
|
|
23
|
+
//# sourceMappingURL=PageElementInteraction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageElementInteraction.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/PageElementInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAK,WAAW,EAAc,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;;;;;;GAOG;AACH,8BAAsB,sBAAuB,SAAQ,WAAW;IAE5D,SAAS,aAAa,WAAW,EAAE,MAAM,EAAE,QAAQ,GAAE,kBAAkD;IAIvG;;;;;;OAMG;cACa,OAAO,CACnB,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,WAAW,CAAC;CAS1B"}
|
|
@@ -2,53 +2,32 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PageElementInteraction = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
5
|
/**
|
|
7
|
-
* @
|
|
8
|
-
* A base class for interactions with {@link PageElement}s.
|
|
6
|
+
* A base class for interactions with {@apilink PageElement} objects.
|
|
9
7
|
*
|
|
10
|
-
*
|
|
8
|
+
* **Note:** The recommended way to implement custom interactions
|
|
9
|
+
* in your code is to use the {@apilink Interaction.where} factory method.
|
|
10
|
+
*
|
|
11
|
+
* @group Activities
|
|
11
12
|
*/
|
|
12
13
|
class PageElementInteraction extends core_1.Interaction {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* A human-readable description to be used when reporting
|
|
16
|
-
* this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
17
|
-
*
|
|
18
|
-
* @protected
|
|
19
|
-
*/
|
|
20
|
-
constructor(description) {
|
|
21
|
-
super();
|
|
22
|
-
this.description = description;
|
|
14
|
+
constructor(description, location = core_1.Interaction.callerLocation(4)) {
|
|
15
|
+
super(description, location);
|
|
23
16
|
}
|
|
24
17
|
/**
|
|
25
|
-
* @
|
|
26
|
-
*
|
|
27
|
-
* if the element is `undefined`.
|
|
28
|
-
*
|
|
29
|
-
* @param {@serenity-js/core/lib/screenplay/actor~AnswersQuestions} actor
|
|
30
|
-
* @param {@serenity-js/core/lib/screenplay~Answerable<Element<'async'>>} element
|
|
18
|
+
* Returns the resolved {@apilink PageElement}, or throws a {@apilink LogicError}
|
|
19
|
+
* if the element is `undefined`.
|
|
31
20
|
*
|
|
32
|
-
* @
|
|
33
|
-
*
|
|
34
|
-
* @protected
|
|
21
|
+
* @param actor
|
|
22
|
+
* @param element
|
|
35
23
|
*/
|
|
36
24
|
async resolve(actor, element) {
|
|
37
25
|
const resolved = await actor.answer(element);
|
|
38
26
|
if (!resolved) {
|
|
39
|
-
throw new core_1.LogicError((0,
|
|
27
|
+
throw new core_1.LogicError((0, core_1.d) `Couldn't find ${element}`);
|
|
40
28
|
}
|
|
41
29
|
return resolved;
|
|
42
30
|
}
|
|
43
|
-
/**
|
|
44
|
-
* @desc
|
|
45
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
46
|
-
*
|
|
47
|
-
* @returns {string}
|
|
48
|
-
*/
|
|
49
|
-
toString() {
|
|
50
|
-
return this.description;
|
|
51
|
-
}
|
|
52
31
|
}
|
|
53
32
|
exports.PageElementInteraction = PageElementInteraction;
|
|
54
33
|
//# sourceMappingURL=PageElementInteraction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageElementInteraction.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/PageElementInteraction.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"PageElementInteraction.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/PageElementInteraction.ts"],"names":[],"mappings":";;;AAAA,4CAA6F;AAK7F;;;;;;;GAOG;AACH,MAAsB,sBAAuB,SAAQ,kBAAW;IAE5D,YAAsB,WAAmB,EAAE,WAA+B,kBAAW,CAAC,cAAc,CAAC,CAAC,CAAC;QACnG,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACjC,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,OAAO,CACnB,KAAuB,EACvB,OAAgC;QAEhC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAE7C,IAAI,CAAE,QAAQ,EAAE;YACZ,MAAM,IAAI,iBAAU,CAAC,IAAA,QAAC,EAAC,iBAAkB,OAAQ,EAAE,CAAC,CAAC;SACxD;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAzBD,wDAyBC"}
|
|
@@ -1,84 +1,90 @@
|
|
|
1
1
|
import { Activity, Answerable, AnswersQuestions, Interaction, UsesAbilities } from '@serenity-js/core';
|
|
2
|
-
import { Key } from '
|
|
3
|
-
import { PageElement } from '../models';
|
|
2
|
+
import { Key, PageElement } from '../models';
|
|
4
3
|
import { PageElementInteraction } from './PageElementInteraction';
|
|
5
|
-
import { PressBuilder } from './PressBuilder';
|
|
6
4
|
/**
|
|
7
|
-
* @
|
|
8
|
-
*
|
|
9
|
-
* send a key press or a sequence of keys to a Web element.
|
|
5
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
6
|
+
* to send a key press or a sequence of keys to a Web element.
|
|
10
7
|
*
|
|
11
|
-
*
|
|
8
|
+
* **Note:** On macOS, some keyboard shortcuts might not work
|
|
9
|
+
* with the [`devtools` protocol](https://webdriver.io/docs/automationProtocols/#devtools-protocol).
|
|
12
10
|
*
|
|
13
11
|
* For example:
|
|
14
|
-
* - to *copy*, instead of
|
|
15
|
-
* - to *cut*, instead of
|
|
16
|
-
* - to *paste*, instead of
|
|
12
|
+
* - to *copy*, instead of {@apilink Key.Meta}+`C`, use {@apilink Key.Control}+{@apilink Key.Insert}
|
|
13
|
+
* - to *cut*, instead of {@apilink Key.Meta}+`X`, use {@apilink Key.Control}+{@apilink Key.Delete}
|
|
14
|
+
* - to *paste*, instead of {@apilink Key.Meta}+`V`, use {@apilink Key.Shift}+{@apilink Key.Insert}
|
|
17
15
|
*
|
|
18
|
-
*
|
|
19
|
-
* <form>
|
|
20
|
-
* <input type="text" name="example" id="example" />
|
|
21
|
-
* </form>
|
|
16
|
+
* ## Example widget
|
|
22
17
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
18
|
+
* ```html
|
|
19
|
+
* <form>
|
|
20
|
+
* <input type="text" name="example" id="example" />
|
|
21
|
+
* </form>
|
|
22
|
+
* ```
|
|
25
23
|
*
|
|
26
|
-
*
|
|
27
|
-
* static exampleInput = Target.the('example input')
|
|
28
|
-
* .located(by.id('example'));
|
|
29
|
-
* }
|
|
24
|
+
* ## Lean Page Object describing the widget
|
|
30
25
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* import { BrowseTheWeb, Key, Press, Value } from '@serenity-js/webdriverio';
|
|
34
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { By, PageElement } from '@serenity-js/web'
|
|
35
28
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
29
|
+
* class Form {
|
|
30
|
+
* static exampleInput = () =>
|
|
31
|
+
* PageElement.located(By.id('example'))
|
|
32
|
+
* .describedAs('example input')
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
42
35
|
*
|
|
43
|
-
*
|
|
44
|
-
* @see {@link BrowseTheWeb}
|
|
45
|
-
* @see {@link Target}
|
|
46
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
47
|
-
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
36
|
+
* ## Pressing keys
|
|
48
37
|
*
|
|
49
|
-
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
40
|
+
* import { Key, Press, Value } from '@serenity-js/web'
|
|
41
|
+
* import { Ensure, equals } from '@serenity-js/assertions'
|
|
42
|
+
*
|
|
43
|
+
* await actorCalled('Priyanka')
|
|
44
|
+
* .attemptsTo(
|
|
45
|
+
* Press.the('H', 'i', '!', Key.ENTER).in(Form.exampleInput()),
|
|
46
|
+
* Ensure.that(Value.of(Form.exampleInput), equals('Hi!')),
|
|
47
|
+
* )
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* ## Learn more
|
|
51
|
+
*
|
|
52
|
+
* - {@apilink Key}
|
|
53
|
+
* - {@apilink BrowseTheWeb}
|
|
54
|
+
* - {@apilink PageElement}
|
|
55
|
+
*
|
|
56
|
+
* @group Activities
|
|
50
57
|
*/
|
|
51
58
|
export declare class Press extends PageElementInteraction {
|
|
52
59
|
private readonly keys;
|
|
53
60
|
/**
|
|
54
|
-
* @
|
|
55
|
-
*
|
|
61
|
+
* Instantiates an {@apilink Interaction|interaction}
|
|
62
|
+
* that instructs the {@apilink Actor|actor}
|
|
63
|
+
* to press a sequence of {@apilink Key|keys},
|
|
64
|
+
*
|
|
65
|
+
* When no `field` is specified, the key sequence will be sent to the currently focused element,
|
|
66
|
+
* and if no element is focused - to the `document.body` to handle.
|
|
56
67
|
*
|
|
57
|
-
* @param
|
|
68
|
+
* @param keys
|
|
58
69
|
* A sequence of one or more keys to press
|
|
70
|
+
*/
|
|
71
|
+
static the(...keys: Array<Answerable<Key | string | Key[] | string[]>>): Activity & {
|
|
72
|
+
in: (field: Answerable<PageElement>) => Interaction;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Send the key sequence to a specific element.
|
|
59
76
|
*
|
|
60
|
-
* @
|
|
77
|
+
* @param field
|
|
61
78
|
*/
|
|
62
|
-
static the(...keys: Array<Answerable<Key | string | Key[] | string[]>>): Activity & PressBuilder;
|
|
63
79
|
in(field: Answerable<PageElement>): Interaction;
|
|
64
80
|
/**
|
|
65
|
-
* @param
|
|
81
|
+
* @param keys
|
|
66
82
|
* A sequence of one or more keys to press
|
|
67
83
|
*/
|
|
68
|
-
constructor(keys: Answerable<Array<Key | string>>);
|
|
84
|
+
protected constructor(keys: Answerable<Array<Key | string>>);
|
|
69
85
|
/**
|
|
70
|
-
* @
|
|
71
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
72
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
73
|
-
*
|
|
74
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
75
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
76
|
-
*
|
|
77
|
-
* @returns {PromiseLike<void>}
|
|
78
|
-
*
|
|
79
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
80
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
81
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
86
|
+
* @inheritDoc
|
|
82
87
|
*/
|
|
83
88
|
performAs(actor: UsesAbilities & AnswersQuestions): Promise<void>;
|
|
84
89
|
}
|
|
90
|
+
//# sourceMappingURL=Press.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Press.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/Press.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAK,WAAW,EAAY,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIpH,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,qBAAa,KAAM,SAAQ,sBAAsB;IA+BzC,OAAO,CAAC,QAAQ,CAAC,IAAI;IA7BzB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,GAAG,MAAM,GAAG,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,GAAG,QAAQ,GAAG;QAAE,EAAE,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,WAAW,CAAA;KAAE;IAI3I;;;;OAIG;IACH,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,WAAW;IAI/C;;;OAGG;IACH,SAAS,aACY,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC;IAK1D;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAK1E"}
|