@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
|
@@ -3,95 +3,101 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Press = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
5
|
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
|
-
const input_1 = require("../../input");
|
|
7
6
|
const abilities_1 = require("../abilities");
|
|
7
|
+
const models_1 = require("../models");
|
|
8
8
|
const PageElementInteraction_1 = require("./PageElementInteraction");
|
|
9
9
|
/**
|
|
10
|
-
* @
|
|
11
|
-
*
|
|
12
|
-
* send a key press or a sequence of keys to a Web element.
|
|
10
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
11
|
+
* to send a key press or a sequence of keys to a Web element.
|
|
13
12
|
*
|
|
14
|
-
*
|
|
13
|
+
* **Note:** On macOS, some keyboard shortcuts might not work
|
|
14
|
+
* with the [`devtools` protocol](https://webdriver.io/docs/automationProtocols/#devtools-protocol).
|
|
15
15
|
*
|
|
16
16
|
* For example:
|
|
17
|
-
* - to *copy*, instead of
|
|
18
|
-
* - to *cut*, instead of
|
|
19
|
-
* - to *paste*, instead of
|
|
17
|
+
* - to *copy*, instead of {@apilink Key.Meta}+`C`, use {@apilink Key.Control}+{@apilink Key.Insert}
|
|
18
|
+
* - to *cut*, instead of {@apilink Key.Meta}+`X`, use {@apilink Key.Control}+{@apilink Key.Delete}
|
|
19
|
+
* - to *paste*, instead of {@apilink Key.Meta}+`V`, use {@apilink Key.Shift}+{@apilink Key.Insert}
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
|
-
* <form>
|
|
23
|
-
* <input type="text" name="example" id="example" />
|
|
24
|
-
* </form>
|
|
21
|
+
* ## Example widget
|
|
25
22
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
23
|
+
* ```html
|
|
24
|
+
* <form>
|
|
25
|
+
* <input type="text" name="example" id="example" />
|
|
26
|
+
* </form>
|
|
27
|
+
* ```
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
* static exampleInput = Target.the('example input')
|
|
31
|
-
* .located(by.id('example'));
|
|
32
|
-
* }
|
|
29
|
+
* ## Lean Page Object describing the widget
|
|
33
30
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* import { BrowseTheWeb, Key, Press, Value } from '@serenity-js/webdriverio';
|
|
37
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { By, PageElement } from '@serenity-js/web'
|
|
38
33
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
34
|
+
* class Form {
|
|
35
|
+
* static exampleInput = () =>
|
|
36
|
+
* PageElement.located(By.id('example'))
|
|
37
|
+
* .describedAs('example input')
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
45
40
|
*
|
|
46
|
-
*
|
|
47
|
-
* @see {@link BrowseTheWeb}
|
|
48
|
-
* @see {@link Target}
|
|
49
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
50
|
-
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
41
|
+
* ## Pressing keys
|
|
51
42
|
*
|
|
52
|
-
*
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
45
|
+
* import { Key, Press, Value } from '@serenity-js/web'
|
|
46
|
+
* import { Ensure, equals } from '@serenity-js/assertions'
|
|
47
|
+
*
|
|
48
|
+
* await actorCalled('Priyanka')
|
|
49
|
+
* .attemptsTo(
|
|
50
|
+
* Press.the('H', 'i', '!', Key.ENTER).in(Form.exampleInput()),
|
|
51
|
+
* Ensure.that(Value.of(Form.exampleInput), equals('Hi!')),
|
|
52
|
+
* )
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* ## Learn more
|
|
56
|
+
*
|
|
57
|
+
* - {@apilink Key}
|
|
58
|
+
* - {@apilink BrowseTheWeb}
|
|
59
|
+
* - {@apilink PageElement}
|
|
60
|
+
*
|
|
61
|
+
* @group Activities
|
|
53
62
|
*/
|
|
54
63
|
class Press extends PageElementInteraction_1.PageElementInteraction {
|
|
55
64
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
|
|
59
|
-
constructor(keys) {
|
|
60
|
-
super((0, io_1.formatted) `#actor presses ${keys}`);
|
|
61
|
-
this.keys = keys;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* @desc
|
|
65
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
65
|
+
* Instantiates an {@apilink Interaction|interaction}
|
|
66
|
+
* that instructs the {@apilink Actor|actor}
|
|
67
|
+
* to press a sequence of {@apilink Key|keys},
|
|
66
68
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
+
* When no `field` is specified, the key sequence will be sent to the currently focused element,
|
|
70
|
+
* and if no element is focused - to the `document.body` to handle.
|
|
69
71
|
*
|
|
70
|
-
* @
|
|
72
|
+
* @param keys
|
|
73
|
+
* A sequence of one or more keys to press
|
|
71
74
|
*/
|
|
72
75
|
static the(...keys) {
|
|
73
76
|
return new Press(KeySequence.of(keys));
|
|
74
77
|
}
|
|
75
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Send the key sequence to a specific element.
|
|
80
|
+
*
|
|
81
|
+
* @param field
|
|
82
|
+
*/
|
|
83
|
+
in(field) {
|
|
76
84
|
return new PressKeyInField(this.keys, field);
|
|
77
85
|
}
|
|
78
86
|
/**
|
|
79
|
-
* @
|
|
80
|
-
*
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
*
|
|
88
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
89
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
90
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
87
|
+
* @param keys
|
|
88
|
+
* A sequence of one or more keys to press
|
|
89
|
+
*/
|
|
90
|
+
constructor(keys) {
|
|
91
|
+
super((0, core_1.d) `#actor presses ${keys}`);
|
|
92
|
+
this.keys = keys;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* @inheritDoc
|
|
91
96
|
*/
|
|
92
97
|
async performAs(actor) {
|
|
93
98
|
const keys = await actor.answer(this.keys);
|
|
94
|
-
|
|
99
|
+
const page = await abilities_1.BrowseTheWeb.as(actor).currentPage();
|
|
100
|
+
return page.sendKeys(keys);
|
|
95
101
|
}
|
|
96
102
|
}
|
|
97
103
|
exports.Press = Press;
|
|
@@ -104,34 +110,38 @@ class PressKeyInField extends PageElementInteraction_1.PageElementInteraction {
|
|
|
104
110
|
* Web element to send the keys to
|
|
105
111
|
*/
|
|
106
112
|
constructor(keys, field /* todo | Question<AlertPromise> | AlertPromise */) {
|
|
107
|
-
super((0,
|
|
113
|
+
super((0, core_1.d) `#actor presses ${keys} in ${field}`, core_1.Interaction.callerLocation(3));
|
|
108
114
|
this.keys = keys;
|
|
109
115
|
this.field = field;
|
|
110
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* @inheritDoc
|
|
119
|
+
*/
|
|
111
120
|
async performAs(actor) {
|
|
112
121
|
const field = await this.resolve(actor, this.field);
|
|
113
122
|
const keys = await actor.answer(this.keys);
|
|
123
|
+
const page = await abilities_1.BrowseTheWeb.as(actor).currentPage();
|
|
114
124
|
// fix for protractor
|
|
115
|
-
await
|
|
125
|
+
await page.executeScript(
|
|
116
126
|
/* istanbul ignore next */
|
|
117
127
|
function focus(element) {
|
|
118
128
|
element.focus();
|
|
119
129
|
}, await field.nativeElement());
|
|
120
|
-
return
|
|
130
|
+
return page.sendKeys(keys);
|
|
121
131
|
}
|
|
122
132
|
}
|
|
123
133
|
/**
|
|
124
134
|
* @package
|
|
125
135
|
*/
|
|
126
136
|
class KeySequence extends core_1.Question {
|
|
137
|
+
static of(keys) {
|
|
138
|
+
return new KeySequence(keys);
|
|
139
|
+
}
|
|
127
140
|
constructor(keys) {
|
|
128
141
|
super();
|
|
129
142
|
this.keys = keys;
|
|
130
143
|
this.subject = KeySequence.describe(keys);
|
|
131
144
|
}
|
|
132
|
-
static of(keys) {
|
|
133
|
-
return new KeySequence(keys);
|
|
134
|
-
}
|
|
135
145
|
async answeredBy(actor) {
|
|
136
146
|
const keys = await (0, io_1.asyncMap)(this.keys, key => actor.answer(key));
|
|
137
147
|
return keys
|
|
@@ -139,23 +149,24 @@ class KeySequence extends core_1.Question {
|
|
|
139
149
|
.filter(key => !!key);
|
|
140
150
|
}
|
|
141
151
|
/**
|
|
142
|
-
*
|
|
143
|
-
* Changes the description of this question's subject.
|
|
152
|
+
* Changes the description of this question's subject.
|
|
144
153
|
*
|
|
145
|
-
* @param
|
|
146
|
-
* @returns {Question<T>}
|
|
154
|
+
* @param subject
|
|
147
155
|
*/
|
|
148
156
|
describedAs(subject) {
|
|
149
157
|
this.subject = subject;
|
|
150
158
|
return this;
|
|
151
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* @inheritDoc
|
|
162
|
+
*/
|
|
152
163
|
toString() {
|
|
153
164
|
return this.subject;
|
|
154
165
|
}
|
|
155
166
|
static describe(keys) {
|
|
156
167
|
const prefix = keys.length === 1 ? 'key' : 'keys';
|
|
157
168
|
const description = keys.reduce((acc, key, index) => {
|
|
158
|
-
const separator =
|
|
169
|
+
const separator = models_1.Key.isKey(key) && key.isModifier
|
|
159
170
|
? '-'
|
|
160
171
|
: acc.separator;
|
|
161
172
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Press.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Press.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"Press.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Press.ts"],"names":[],"mappings":"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"}
|
|
@@ -2,88 +2,82 @@ import { Answerable, AnswersQuestions, Interaction, UsesAbilities } from '@seren
|
|
|
2
2
|
import { PageElement } from '../models';
|
|
3
3
|
import { PageElementInteraction } from './PageElementInteraction';
|
|
4
4
|
/**
|
|
5
|
-
* @
|
|
6
|
-
*
|
|
7
|
-
* perfom a right click on a given Web element.
|
|
5
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
6
|
+
* to perfom a right click on a given {@apilink PageElement}.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* This is typically used to open a [custom context menu](https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event)
|
|
9
|
+
* on a given Web element, since it's not possible to interact with the standard context menu offered by your browser.
|
|
11
10
|
*
|
|
12
|
-
*
|
|
13
|
-
* <form>
|
|
14
|
-
* <input type="text" id="field"
|
|
15
|
-
* oncontextmenu="showMenu(); return false;" />
|
|
11
|
+
* ## Example widget
|
|
16
12
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
13
|
+
* ```html
|
|
14
|
+
* <form>
|
|
15
|
+
* <input type="text" id="field"
|
|
16
|
+
* oncontextmenu="showMenu(); return false;" />
|
|
21
17
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* </script>
|
|
18
|
+
* <div id="context-menu" style="display:none">
|
|
19
|
+
* Custom context menu
|
|
20
|
+
* </div>
|
|
21
|
+
* </form>
|
|
27
22
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
23
|
+
* <script>
|
|
24
|
+
* function showMenu() {
|
|
25
|
+
* document.getElementById("context-menu").style.display = 'block';
|
|
26
|
+
* }
|
|
27
|
+
* </script>
|
|
28
|
+
* ```
|
|
30
29
|
*
|
|
31
|
-
*
|
|
32
|
-
* static exampleInput = Target.the('example input')
|
|
33
|
-
* .located(by.id('example'));
|
|
34
|
-
* static exampleContextMenu = Target.the('example context menu')
|
|
35
|
-
* .located(by.id('context-menu'));
|
|
36
|
-
* }
|
|
30
|
+
* ## Lean Page Object describing the widget
|
|
37
31
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* import { BrowseTheWeb, RightClick, isVisible } from '@serenity-js/webdriverio';
|
|
41
|
-
* import { Ensure } from '@serenity-js/assertions';
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { By, PageElement } from '@serenity-js/web'
|
|
42
34
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* Ensure.that(Form.exampleContextMenu, isVisible()),
|
|
48
|
-
* );
|
|
35
|
+
* class Form {
|
|
36
|
+
* static exampleInput = () =>
|
|
37
|
+
* PageElement.located(By.id('example'))
|
|
38
|
+
* .describedAs('example input')
|
|
49
39
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
40
|
+
* static exampleContextMenu = () =>
|
|
41
|
+
* PageElement.located(By.id('context-menu'))
|
|
42
|
+
* .describedAs('example context menu')
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
54
45
|
*
|
|
55
|
-
*
|
|
46
|
+
* ## Right-click on an element
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
50
|
+
* import { RightClick, isVisible } from '@serenity-js/web'
|
|
51
|
+
* import { Ensure } from '@serenity-js/assertions'
|
|
52
|
+
*
|
|
53
|
+
* await actorCalled('Chloé')
|
|
54
|
+
* .whoCan(BrowseTheWeb.using(browser))
|
|
55
|
+
* .attemptsTo(
|
|
56
|
+
* RightClick.on(Form.exampleInput()),
|
|
57
|
+
* Ensure.that(Form.exampleContextMenu(), isVisible()),
|
|
58
|
+
* )
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* ## Learn more
|
|
62
|
+
*
|
|
63
|
+
* - {@apilink BrowseTheWeb}
|
|
64
|
+
* - {@apilink PageElement}
|
|
65
|
+
*
|
|
66
|
+
* @group Activities
|
|
56
67
|
*/
|
|
57
68
|
export declare class RightClick extends PageElementInteraction {
|
|
58
|
-
private readonly
|
|
69
|
+
private readonly pageElement;
|
|
59
70
|
/**
|
|
60
|
-
* @
|
|
61
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
62
|
-
*
|
|
63
|
-
* @param {Answerable<PageElement>} target
|
|
64
|
-
* The element to be right-clicked on
|
|
71
|
+
* Instantiates this {@apilink Interaction}.
|
|
65
72
|
*
|
|
66
|
-
* @
|
|
67
|
-
*/
|
|
68
|
-
static on(target: Answerable<PageElement>): Interaction;
|
|
69
|
-
/**
|
|
70
|
-
* @param {Answerable<PageElement>} target
|
|
73
|
+
* @param pageElement
|
|
71
74
|
* The element to be right-clicked on
|
|
72
75
|
*/
|
|
73
|
-
|
|
76
|
+
static on(pageElement: Answerable<PageElement>): Interaction;
|
|
77
|
+
protected constructor(pageElement: Answerable<PageElement>);
|
|
74
78
|
/**
|
|
75
|
-
* @
|
|
76
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
77
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
78
|
-
*
|
|
79
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
80
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
81
|
-
*
|
|
82
|
-
* @returns {PromiseLike<void>}
|
|
83
|
-
*
|
|
84
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
85
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
86
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
79
|
+
* @inheritDoc
|
|
87
80
|
*/
|
|
88
81
|
performAs(actor: UsesAbilities & AnswersQuestions): Promise<void>;
|
|
89
82
|
}
|
|
83
|
+
//# sourceMappingURL=RightClick.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RightClick.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/RightClick.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAK,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEhG,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,qBAAa,UAAW,SAAQ,sBAAsB;IAW5B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAVlD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,WAAW;IAI5D,SAAS,aAA8B,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC;IAI3E;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAI1E"}
|
|
@@ -1,98 +1,91 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RightClick = void 0;
|
|
4
|
-
const
|
|
4
|
+
const core_1 = require("@serenity-js/core");
|
|
5
5
|
const PageElementInteraction_1 = require("./PageElementInteraction");
|
|
6
6
|
/**
|
|
7
|
-
* @
|
|
8
|
-
*
|
|
9
|
-
* perfom a right click on a given Web element.
|
|
7
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
8
|
+
* to perfom a right click on a given {@apilink PageElement}.
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* This is typically used to open a [custom context menu](https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event)
|
|
11
|
+
* on a given Web element, since it's not possible to interact with the standard context menu offered by your browser.
|
|
13
12
|
*
|
|
14
|
-
*
|
|
15
|
-
* <form>
|
|
16
|
-
* <input type="text" id="field"
|
|
17
|
-
* oncontextmenu="showMenu(); return false;" />
|
|
13
|
+
* ## Example widget
|
|
18
14
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
15
|
+
* ```html
|
|
16
|
+
* <form>
|
|
17
|
+
* <input type="text" id="field"
|
|
18
|
+
* oncontextmenu="showMenu(); return false;" />
|
|
23
19
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* </script>
|
|
20
|
+
* <div id="context-menu" style="display:none">
|
|
21
|
+
* Custom context menu
|
|
22
|
+
* </div>
|
|
23
|
+
* </form>
|
|
29
24
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
25
|
+
* <script>
|
|
26
|
+
* function showMenu() {
|
|
27
|
+
* document.getElementById("context-menu").style.display = 'block';
|
|
28
|
+
* }
|
|
29
|
+
* </script>
|
|
30
|
+
* ```
|
|
32
31
|
*
|
|
33
|
-
*
|
|
34
|
-
* static exampleInput = Target.the('example input')
|
|
35
|
-
* .located(by.id('example'));
|
|
36
|
-
* static exampleContextMenu = Target.the('example context menu')
|
|
37
|
-
* .located(by.id('context-menu'));
|
|
38
|
-
* }
|
|
32
|
+
* ## Lean Page Object describing the widget
|
|
39
33
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* import { BrowseTheWeb, RightClick, isVisible } from '@serenity-js/webdriverio';
|
|
43
|
-
* import { Ensure } from '@serenity-js/assertions';
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { By, PageElement } from '@serenity-js/web'
|
|
44
36
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* Ensure.that(Form.exampleContextMenu, isVisible()),
|
|
50
|
-
* );
|
|
37
|
+
* class Form {
|
|
38
|
+
* static exampleInput = () =>
|
|
39
|
+
* PageElement.located(By.id('example'))
|
|
40
|
+
* .describedAs('example input')
|
|
51
41
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
42
|
+
* static exampleContextMenu = () =>
|
|
43
|
+
* PageElement.located(By.id('context-menu'))
|
|
44
|
+
* .describedAs('example context menu')
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
56
47
|
*
|
|
57
|
-
*
|
|
48
|
+
* ## Right-click on an element
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
52
|
+
* import { RightClick, isVisible } from '@serenity-js/web'
|
|
53
|
+
* import { Ensure } from '@serenity-js/assertions'
|
|
54
|
+
*
|
|
55
|
+
* await actorCalled('Chloé')
|
|
56
|
+
* .whoCan(BrowseTheWeb.using(browser))
|
|
57
|
+
* .attemptsTo(
|
|
58
|
+
* RightClick.on(Form.exampleInput()),
|
|
59
|
+
* Ensure.that(Form.exampleContextMenu(), isVisible()),
|
|
60
|
+
* )
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* ## Learn more
|
|
64
|
+
*
|
|
65
|
+
* - {@apilink BrowseTheWeb}
|
|
66
|
+
* - {@apilink PageElement}
|
|
67
|
+
*
|
|
68
|
+
* @group Activities
|
|
58
69
|
*/
|
|
59
70
|
class RightClick extends PageElementInteraction_1.PageElementInteraction {
|
|
60
71
|
/**
|
|
61
|
-
* @
|
|
62
|
-
* The element to be right-clicked on
|
|
63
|
-
*/
|
|
64
|
-
constructor(target) {
|
|
65
|
-
super((0, io_1.formatted) `#actor right-clicks on ${target}`);
|
|
66
|
-
this.target = target;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* @desc
|
|
70
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
72
|
+
* Instantiates this {@apilink Interaction}.
|
|
71
73
|
*
|
|
72
|
-
* @param
|
|
74
|
+
* @param pageElement
|
|
73
75
|
* The element to be right-clicked on
|
|
74
|
-
*
|
|
75
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
76
76
|
*/
|
|
77
|
-
static on(
|
|
78
|
-
return new RightClick(
|
|
77
|
+
static on(pageElement) {
|
|
78
|
+
return new RightClick(pageElement);
|
|
79
|
+
}
|
|
80
|
+
constructor(pageElement) {
|
|
81
|
+
super((0, core_1.d) `#actor right-clicks on ${pageElement}`);
|
|
82
|
+
this.pageElement = pageElement;
|
|
79
83
|
}
|
|
80
84
|
/**
|
|
81
|
-
* @
|
|
82
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
83
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
84
|
-
*
|
|
85
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
86
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
87
|
-
*
|
|
88
|
-
* @returns {PromiseLike<void>}
|
|
89
|
-
*
|
|
90
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
91
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
92
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
85
|
+
* @inheritDoc
|
|
93
86
|
*/
|
|
94
87
|
async performAs(actor) {
|
|
95
|
-
const element = await this.resolve(actor, this.
|
|
88
|
+
const element = await this.resolve(actor, this.pageElement);
|
|
96
89
|
return element.rightClick();
|
|
97
90
|
}
|
|
98
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RightClick.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/RightClick.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"RightClick.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/RightClick.ts"],"names":[],"mappings":";;;AAAA,4CAAgG;AAGhG,qEAAkE;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,MAAa,UAAW,SAAQ,+CAAsB;IAClD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,WAAoC;QAC1C,OAAO,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;IAED,YAAuC,WAAoC;QACvE,KAAK,CAAC,IAAA,QAAC,EAAC,0BAA2B,WAAY,EAAE,CAAC,CAAC;QADhB,gBAAW,GAAX,WAAW,CAAyB;IAE3E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,KAAuC;QACnD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC5D,OAAO,OAAO,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC;CACJ;AAtBD,gCAsBC"}
|