@serenity-js/web 3.0.0-rc.8 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +336 -73
- package/README.md +8 -12
- package/lib/errors/BrowserWindowClosedError.d.ts +15 -0
- package/lib/errors/BrowserWindowClosedError.d.ts.map +1 -0
- package/lib/errors/BrowserWindowClosedError.js +21 -0
- package/lib/errors/BrowserWindowClosedError.js.map +1 -0
- package/lib/errors/CookieMissingError.d.ts +11 -0
- package/lib/errors/CookieMissingError.d.ts.map +1 -0
- package/lib/errors/CookieMissingError.js +10 -0
- package/lib/errors/CookieMissingError.js.map +1 -1
- package/lib/errors/ModalDialogObstructsScreenshotError.d.ts +15 -0
- package/lib/errors/ModalDialogObstructsScreenshotError.d.ts.map +1 -0
- package/lib/errors/ModalDialogObstructsScreenshotError.js +21 -0
- package/lib/errors/ModalDialogObstructsScreenshotError.js.map +1 -0
- package/lib/errors/index.d.ts +3 -0
- package/lib/errors/index.d.ts.map +1 -0
- package/lib/errors/index.js +7 -1
- package/lib/errors/index.js.map +1 -1
- package/lib/expectations/index.d.ts +1 -1
- package/lib/expectations/index.d.ts.map +1 -0
- package/lib/expectations/index.js +5 -2
- package/lib/expectations/index.js.map +1 -1
- package/lib/expectations/isActive.d.ts +14 -8
- package/lib/expectations/isActive.d.ts.map +1 -0
- package/lib/expectations/isActive.js +17 -11
- package/lib/expectations/isActive.js.map +1 -1
- package/lib/expectations/isClickable.d.ts +14 -13
- package/lib/expectations/isClickable.d.ts.map +1 -0
- package/lib/expectations/isClickable.js +15 -17
- package/lib/expectations/isClickable.js.map +1 -1
- package/lib/expectations/isEnabled.d.ts +14 -7
- package/lib/expectations/isEnabled.d.ts.map +1 -0
- package/lib/expectations/isEnabled.js +17 -9
- package/lib/expectations/isEnabled.js.map +1 -1
- package/lib/expectations/isSelected.d.ts +14 -7
- package/lib/expectations/isSelected.d.ts.map +1 -0
- package/lib/expectations/isSelected.js +15 -9
- package/lib/expectations/isSelected.js.map +1 -1
- package/lib/expectations/isVisible.d.ts +14 -7
- package/lib/expectations/isVisible.d.ts.map +1 -0
- package/lib/expectations/isVisible.js +17 -9
- package/lib/expectations/isVisible.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -2
- package/lib/index.js.map +1 -1
- package/lib/screenplay/abilities/BrowseTheWeb.d.ts +88 -45
- package/lib/screenplay/abilities/BrowseTheWeb.d.ts.map +1 -0
- package/lib/screenplay/abilities/BrowseTheWeb.js +89 -19
- package/lib/screenplay/abilities/BrowseTheWeb.js.map +1 -1
- package/lib/screenplay/abilities/index.d.ts +1 -1
- package/lib/screenplay/abilities/index.d.ts.map +1 -0
- package/lib/screenplay/abilities/index.js +5 -2
- package/lib/screenplay/abilities/index.js.map +1 -1
- package/lib/screenplay/index.d.ts +1 -0
- package/lib/screenplay/index.d.ts.map +1 -0
- package/lib/screenplay/index.js +5 -1
- package/lib/screenplay/index.js.map +1 -1
- package/lib/screenplay/interactions/Clear.d.ts +50 -55
- package/lib/screenplay/interactions/Clear.d.ts.map +1 -0
- package/lib/screenplay/interactions/Clear.js +70 -63
- package/lib/screenplay/interactions/Clear.js.map +1 -1
- package/lib/screenplay/interactions/Click.d.ts +41 -50
- package/lib/screenplay/interactions/Click.d.ts.map +1 -0
- package/lib/screenplay/interactions/Click.js +45 -55
- package/lib/screenplay/interactions/Click.js.map +1 -1
- package/lib/screenplay/interactions/DoubleClick.d.ts +64 -67
- package/lib/screenplay/interactions/DoubleClick.d.ts.map +1 -0
- package/lib/screenplay/interactions/DoubleClick.js +68 -72
- package/lib/screenplay/interactions/DoubleClick.js.map +1 -1
- package/lib/screenplay/interactions/Enter.d.ts +42 -51
- package/lib/screenplay/interactions/Enter.d.ts.map +1 -0
- package/lib/screenplay/interactions/Enter.js +42 -52
- package/lib/screenplay/interactions/Enter.js.map +1 -1
- package/lib/screenplay/interactions/ExecuteScript.d.ts +144 -148
- package/lib/screenplay/interactions/ExecuteScript.d.ts.map +1 -0
- package/lib/screenplay/interactions/ExecuteScript.js +163 -185
- package/lib/screenplay/interactions/ExecuteScript.js.map +1 -1
- package/lib/screenplay/interactions/Hover.d.ts +40 -50
- package/lib/screenplay/interactions/Hover.d.ts.map +1 -0
- package/lib/screenplay/interactions/Hover.js +44 -55
- package/lib/screenplay/interactions/Hover.js.map +1 -1
- package/lib/screenplay/interactions/Navigate.d.ts +106 -113
- package/lib/screenplay/interactions/Navigate.d.ts.map +1 -0
- package/lib/screenplay/interactions/Navigate.js +124 -146
- package/lib/screenplay/interactions/Navigate.js.map +1 -1
- package/lib/screenplay/interactions/PageElementInteraction.d.ts +12 -28
- package/lib/screenplay/interactions/PageElementInteraction.d.ts.map +1 -0
- package/lib/screenplay/interactions/PageElementInteraction.js +12 -33
- package/lib/screenplay/interactions/PageElementInteraction.js.map +1 -1
- package/lib/screenplay/interactions/Press.d.ts +61 -55
- package/lib/screenplay/interactions/Press.d.ts.map +1 -0
- package/lib/screenplay/interactions/Press.js +83 -72
- package/lib/screenplay/interactions/Press.js.map +1 -1
- package/lib/screenplay/interactions/RightClick.d.ts +59 -65
- package/lib/screenplay/interactions/RightClick.d.ts.map +1 -0
- package/lib/screenplay/interactions/RightClick.js +63 -70
- package/lib/screenplay/interactions/RightClick.js.map +1 -1
- package/lib/screenplay/interactions/Scroll.d.ts +46 -64
- package/lib/screenplay/interactions/Scroll.d.ts.map +1 -0
- package/lib/screenplay/interactions/Scroll.js +49 -71
- package/lib/screenplay/interactions/Scroll.js.map +1 -1
- package/lib/screenplay/interactions/Select.d.ts +217 -193
- package/lib/screenplay/interactions/Select.d.ts.map +1 -0
- package/lib/screenplay/interactions/Select.js +218 -245
- package/lib/screenplay/interactions/Select.js.map +1 -1
- package/lib/screenplay/interactions/Switch.d.ts +105 -128
- package/lib/screenplay/interactions/Switch.d.ts.map +1 -0
- package/lib/screenplay/interactions/Switch.js +121 -172
- package/lib/screenplay/interactions/Switch.js.map +1 -1
- package/lib/screenplay/interactions/TakeScreenshot.d.ts +28 -50
- package/lib/screenplay/interactions/TakeScreenshot.d.ts.map +1 -0
- package/lib/screenplay/interactions/TakeScreenshot.js +32 -57
- package/lib/screenplay/interactions/TakeScreenshot.js.map +1 -1
- package/lib/screenplay/interactions/index.d.ts +2 -3
- package/lib/screenplay/interactions/index.d.ts.map +1 -0
- package/lib/screenplay/interactions/index.js +6 -4
- package/lib/screenplay/interactions/index.js.map +1 -1
- package/lib/screenplay/models/BrowserCapabilities.d.ts +24 -0
- package/lib/screenplay/models/BrowserCapabilities.d.ts.map +1 -0
- package/lib/screenplay/models/BrowserCapabilities.js.map +1 -0
- package/lib/screenplay/models/BrowsingSession.d.ts +69 -0
- package/lib/screenplay/models/BrowsingSession.d.ts.map +1 -0
- package/lib/screenplay/models/BrowsingSession.js +101 -0
- package/lib/screenplay/models/BrowsingSession.js.map +1 -0
- package/lib/screenplay/models/Cookie.d.ts +104 -64
- package/lib/screenplay/models/Cookie.d.ts.map +1 -0
- package/lib/screenplay/models/Cookie.js +110 -59
- package/lib/screenplay/models/Cookie.js.map +1 -1
- package/lib/screenplay/models/CookieData.d.ts +20 -58
- package/lib/screenplay/models/CookieData.d.ts.map +1 -0
- package/lib/{input → screenplay/models}/Key.d.ts +13 -9
- package/lib/screenplay/models/Key.d.ts.map +1 -0
- package/lib/{input → screenplay/models}/Key.js +16 -13
- package/lib/screenplay/models/Key.js.map +1 -0
- package/lib/screenplay/models/Locator.d.ts +29 -8
- package/lib/screenplay/models/Locator.d.ts.map +1 -0
- package/lib/screenplay/models/Locator.js +53 -7
- package/lib/screenplay/models/Locator.js.map +1 -1
- package/lib/screenplay/models/Page.d.ts +398 -36
- package/lib/screenplay/models/Page.d.ts.map +1 -0
- package/lib/screenplay/models/Page.js +209 -4
- package/lib/screenplay/models/Page.js.map +1 -1
- package/lib/screenplay/models/PageElement.d.ts +77 -5
- package/lib/screenplay/models/PageElement.d.ts.map +1 -0
- package/lib/screenplay/models/PageElement.js +29 -7
- package/lib/screenplay/models/PageElement.js.map +1 -1
- package/lib/screenplay/models/PageElements.d.ts +16 -3
- package/lib/screenplay/models/PageElements.d.ts.map +1 -0
- package/lib/screenplay/models/PageElements.js +21 -8
- package/lib/screenplay/models/PageElements.js.map +1 -1
- package/lib/screenplay/models/RootLocator.d.ts +25 -0
- package/lib/screenplay/models/RootLocator.d.ts.map +1 -0
- package/lib/screenplay/models/RootLocator.js +52 -0
- package/lib/screenplay/models/RootLocator.js.map +1 -0
- package/lib/screenplay/models/SelectOption.d.ts +25 -0
- package/lib/screenplay/models/SelectOption.d.ts.map +1 -0
- package/lib/screenplay/models/SelectOption.js +37 -0
- package/lib/screenplay/models/SelectOption.js.map +1 -0
- package/lib/screenplay/models/Switchable.d.ts +23 -0
- package/lib/screenplay/models/Switchable.d.ts.map +1 -0
- package/lib/screenplay/{interactions/WaitBuilder.js → models/Switchable.js} +1 -1
- package/lib/screenplay/models/Switchable.js.map +1 -0
- package/lib/screenplay/models/SwitchableOrigin.d.ts +18 -0
- package/lib/screenplay/models/SwitchableOrigin.d.ts.map +1 -0
- package/lib/screenplay/{interactions/EnterBuilder.js → models/SwitchableOrigin.js} +1 -1
- package/lib/screenplay/models/SwitchableOrigin.js.map +1 -0
- package/lib/screenplay/models/dialogs/AbsentModalDialog.d.ts +15 -0
- package/lib/screenplay/models/dialogs/AbsentModalDialog.d.ts.map +1 -0
- package/lib/screenplay/models/dialogs/AbsentModalDialog.js +24 -0
- package/lib/screenplay/models/dialogs/AbsentModalDialog.js.map +1 -0
- package/lib/screenplay/models/dialogs/AcceptedModalDialog.d.ts +17 -0
- package/lib/screenplay/models/dialogs/AcceptedModalDialog.d.ts.map +1 -0
- package/lib/screenplay/models/dialogs/AcceptedModalDialog.js +29 -0
- package/lib/screenplay/models/dialogs/AcceptedModalDialog.js.map +1 -0
- package/lib/screenplay/models/dialogs/DismissedModalDialog.d.ts +17 -0
- package/lib/screenplay/models/dialogs/DismissedModalDialog.d.ts.map +1 -0
- package/lib/screenplay/models/dialogs/DismissedModalDialog.js +29 -0
- package/lib/screenplay/models/dialogs/DismissedModalDialog.js.map +1 -0
- package/lib/screenplay/models/dialogs/ModalDialog.d.ts +168 -0
- package/lib/screenplay/models/dialogs/ModalDialog.d.ts.map +1 -0
- package/lib/screenplay/models/dialogs/ModalDialog.js +174 -0
- package/lib/screenplay/models/dialogs/ModalDialog.js.map +1 -0
- package/lib/screenplay/models/dialogs/ModalDialogHandler.d.ts +38 -0
- package/lib/screenplay/models/dialogs/ModalDialogHandler.d.ts.map +1 -0
- package/lib/screenplay/models/dialogs/ModalDialogHandler.js +30 -0
- package/lib/screenplay/models/dialogs/ModalDialogHandler.js.map +1 -0
- package/lib/screenplay/models/dialogs/index.d.ts +6 -0
- package/lib/screenplay/models/dialogs/index.d.ts.map +1 -0
- package/lib/screenplay/models/dialogs/index.js +22 -0
- package/lib/screenplay/models/dialogs/index.js.map +1 -0
- package/lib/screenplay/models/index.d.ts +9 -1
- package/lib/screenplay/models/index.d.ts.map +1 -0
- package/lib/screenplay/models/index.js +13 -2
- package/lib/screenplay/models/index.js.map +1 -1
- package/lib/screenplay/models/selectors/By.d.ts +38 -0
- package/lib/screenplay/models/selectors/By.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/By.js +43 -0
- package/lib/screenplay/models/selectors/By.js.map +1 -1
- package/lib/screenplay/models/selectors/ByCss.d.ts +8 -0
- package/lib/screenplay/models/selectors/ByCss.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/ByCss.js +7 -0
- package/lib/screenplay/models/selectors/ByCss.js.map +1 -1
- package/lib/screenplay/models/selectors/ByCssContainingText.d.ts +9 -0
- package/lib/screenplay/models/selectors/ByCssContainingText.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/ByCssContainingText.js +8 -0
- package/lib/screenplay/models/selectors/ByCssContainingText.js.map +1 -1
- package/lib/screenplay/models/selectors/ByDeepCss.d.ts +14 -0
- package/lib/screenplay/models/selectors/ByDeepCss.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/ByDeepCss.js +20 -0
- package/lib/screenplay/models/selectors/ByDeepCss.js.map +1 -0
- package/lib/screenplay/models/selectors/ById.d.ts +8 -0
- package/lib/screenplay/models/selectors/ById.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/ById.js +7 -0
- package/lib/screenplay/models/selectors/ById.js.map +1 -1
- package/lib/screenplay/models/selectors/ByTagName.d.ts +8 -0
- package/lib/screenplay/models/selectors/ByTagName.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/ByTagName.js +7 -0
- package/lib/screenplay/models/selectors/ByTagName.js.map +1 -1
- package/lib/screenplay/models/selectors/ByXPath.d.ts +8 -0
- package/lib/screenplay/models/selectors/ByXPath.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/ByXPath.js +7 -0
- package/lib/screenplay/models/selectors/ByXPath.js.map +1 -1
- package/lib/screenplay/models/selectors/Selector.d.ts +6 -0
- package/lib/screenplay/models/selectors/Selector.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/Selector.js +6 -1
- package/lib/screenplay/models/selectors/Selector.js.map +1 -1
- package/lib/screenplay/models/selectors/index.d.ts +2 -0
- package/lib/screenplay/models/selectors/index.d.ts.map +1 -0
- package/lib/screenplay/models/selectors/index.js +6 -1
- package/lib/screenplay/models/selectors/index.js.map +1 -1
- package/lib/screenplay/questions/Attribute.d.ts +115 -67
- package/lib/screenplay/questions/Attribute.d.ts.map +1 -0
- package/lib/screenplay/questions/Attribute.js +128 -74
- package/lib/screenplay/questions/Attribute.js.map +1 -1
- package/lib/screenplay/questions/CssClasses.d.ts +124 -79
- package/lib/screenplay/questions/CssClasses.d.ts.map +1 -0
- package/lib/screenplay/questions/CssClasses.js +132 -83
- package/lib/screenplay/questions/CssClasses.js.map +1 -1
- package/lib/screenplay/questions/LastScriptExecution.d.ts +42 -6
- package/lib/screenplay/questions/LastScriptExecution.d.ts.map +1 -0
- package/lib/screenplay/questions/LastScriptExecution.js +45 -7
- package/lib/screenplay/questions/LastScriptExecution.js.map +1 -1
- package/lib/screenplay/questions/Selected.d.ts +202 -171
- package/lib/screenplay/questions/Selected.d.ts.map +1 -0
- package/lib/screenplay/questions/Selected.js +225 -186
- package/lib/screenplay/questions/Selected.js.map +1 -1
- package/lib/screenplay/questions/Text.d.ts +101 -82
- package/lib/screenplay/questions/Text.d.ts.map +1 -0
- package/lib/screenplay/questions/Text.js +143 -92
- package/lib/screenplay/questions/Text.js.map +1 -1
- package/lib/screenplay/questions/Value.d.ts +77 -44
- package/lib/screenplay/questions/Value.d.ts.map +1 -0
- package/lib/screenplay/questions/Value.js +84 -47
- package/lib/screenplay/questions/Value.js.map +1 -1
- package/lib/screenplay/questions/index.d.ts +1 -0
- package/lib/screenplay/questions/index.d.ts.map +1 -0
- package/lib/screenplay/questions/index.js +5 -1
- package/lib/screenplay/questions/index.js.map +1 -1
- package/lib/scripts/index.d.ts +2 -0
- package/lib/scripts/index.d.ts.map +1 -0
- package/lib/{input → scripts}/index.js +6 -2
- package/lib/scripts/index.js.map +1 -0
- package/lib/scripts/isVisible.d.ts +2 -0
- package/lib/scripts/isVisible.d.ts.map +1 -0
- package/lib/scripts/isVisible.js +96 -0
- package/lib/scripts/isVisible.js.map +1 -0
- package/lib/stage/crew/index.d.ts +1 -0
- package/lib/stage/crew/index.d.ts.map +1 -0
- package/lib/stage/crew/index.js +5 -1
- package/lib/stage/crew/index.js.map +1 -1
- package/lib/stage/crew/photographer/Photographer.d.ts +126 -39
- package/lib/stage/crew/photographer/Photographer.d.ts.map +1 -0
- package/lib/stage/crew/photographer/Photographer.js +161 -42
- package/lib/stage/crew/photographer/Photographer.js.map +1 -1
- package/lib/stage/crew/photographer/index.d.ts +1 -0
- package/lib/stage/crew/photographer/index.d.ts.map +1 -0
- package/lib/stage/crew/photographer/index.js +5 -1
- package/lib/stage/crew/photographer/index.js.map +1 -1
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.d.ts +13 -12
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.d.ts.map +1 -0
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js +22 -33
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js.map +1 -1
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.d.ts +8 -8
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.d.ts.map +1 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js +7 -8
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js.map +1 -1
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.d.ts +8 -7
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.d.ts.map +1 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js +7 -7
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.d.ts +8 -8
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.d.ts.map +1 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js +7 -8
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js.map +1 -1
- package/lib/stage/crew/photographer/strategies/index.d.ts +1 -0
- package/lib/stage/crew/photographer/strategies/index.d.ts.map +1 -0
- package/lib/stage/crew/photographer/strategies/index.js +5 -1
- package/lib/stage/crew/photographer/strategies/index.js.map +1 -1
- package/lib/stage/index.d.ts +1 -0
- package/lib/stage/index.d.ts.map +1 -0
- package/lib/stage/index.js +5 -1
- package/lib/stage/index.js.map +1 -1
- package/package.json +20 -43
- package/src/errors/BrowserWindowClosedError.ts +17 -0
- package/src/errors/CookieMissingError.ts +10 -0
- package/src/errors/ModalDialogObstructsScreenshotError.ts +17 -0
- package/src/errors/index.ts +2 -0
- package/src/expectations/index.ts +0 -1
- package/src/expectations/isActive.ts +23 -12
- package/src/expectations/isClickable.ts +22 -21
- package/src/expectations/isEnabled.ts +23 -9
- package/src/expectations/isSelected.ts +20 -10
- package/src/expectations/isVisible.ts +23 -9
- package/src/index.ts +0 -1
- package/src/screenplay/abilities/BrowseTheWeb.ts +95 -87
- package/src/screenplay/abilities/index.ts +0 -1
- package/src/screenplay/interactions/Clear.ts +75 -63
- package/src/screenplay/interactions/Click.ts +43 -54
- package/src/screenplay/interactions/DoubleClick.ts +66 -71
- package/src/screenplay/interactions/Enter.ts +41 -53
- package/src/screenplay/interactions/ExecuteScript.ts +207 -220
- package/src/screenplay/interactions/Hover.ts +42 -54
- package/src/screenplay/interactions/Navigate.ts +129 -156
- package/src/screenplay/interactions/PageElementInteraction.ts +14 -34
- package/src/screenplay/interactions/Press.ts +78 -69
- package/src/screenplay/interactions/RightClick.ts +61 -69
- package/src/screenplay/interactions/Scroll.ts +48 -71
- package/src/screenplay/interactions/Select.ts +229 -269
- package/src/screenplay/interactions/Switch.ts +123 -179
- package/src/screenplay/interactions/TakeScreenshot.ts +31 -57
- package/src/screenplay/interactions/index.ts +1 -3
- package/src/screenplay/models/BrowserCapabilities.ts +26 -0
- package/src/screenplay/models/BrowsingSession.ts +115 -0
- package/src/screenplay/models/Cookie.ts +115 -73
- package/src/screenplay/models/CookieData.ts +20 -58
- package/src/{input → screenplay/models}/Key.ts +12 -9
- package/src/screenplay/models/Locator.ts +43 -9
- package/src/screenplay/models/Page.ts +438 -37
- package/src/screenplay/models/PageElement.ts +92 -12
- package/src/screenplay/models/PageElements.ts +23 -9
- package/src/screenplay/models/RootLocator.ts +30 -0
- package/src/screenplay/models/SelectOption.ts +38 -0
- package/src/screenplay/models/Switchable.ts +24 -0
- package/src/screenplay/models/SwitchableOrigin.ts +18 -0
- package/src/screenplay/models/dialogs/AbsentModalDialog.ts +22 -0
- package/src/screenplay/models/dialogs/AcceptedModalDialog.ts +27 -0
- package/src/screenplay/models/dialogs/DismissedModalDialog.ts +27 -0
- package/src/screenplay/models/dialogs/ModalDialog.ts +200 -0
- package/src/screenplay/models/dialogs/ModalDialogHandler.ts +50 -0
- package/src/screenplay/models/dialogs/index.ts +5 -0
- package/src/screenplay/models/index.ts +8 -1
- package/src/screenplay/models/selectors/By.ts +45 -0
- package/src/screenplay/models/selectors/ByCss.ts +7 -0
- package/src/screenplay/models/selectors/ByCssContainingText.ts +8 -0
- package/src/screenplay/models/selectors/ByDeepCss.ts +15 -0
- package/src/screenplay/models/selectors/ById.ts +7 -0
- package/src/screenplay/models/selectors/ByTagName.ts +7 -0
- package/src/screenplay/models/selectors/ByXPath.ts +7 -0
- package/src/screenplay/models/selectors/Selector.ts +6 -1
- package/src/screenplay/models/selectors/index.ts +1 -0
- package/src/screenplay/questions/Attribute.ts +137 -76
- package/src/screenplay/questions/CssClasses.ts +135 -83
- package/src/screenplay/questions/LastScriptExecution.ts +45 -8
- package/src/screenplay/questions/Selected.ts +237 -191
- package/src/screenplay/questions/Text.ts +161 -96
- package/src/screenplay/questions/Value.ts +88 -48
- package/src/scripts/index.ts +1 -0
- package/src/scripts/isVisible.ts +113 -0
- package/src/stage/crew/photographer/Photographer.ts +142 -41
- package/src/stage/crew/photographer/strategies/PhotoTakingStrategy.ts +27 -42
- package/src/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.ts +7 -8
- package/src/stage/crew/photographer/strategies/TakePhotosOfFailures.ts +7 -7
- package/src/stage/crew/photographer/strategies/TakePhotosOfInteractions.ts +7 -8
- package/tsconfig.build.json +14 -0
- package/lib/expectations/ElementExpectation.d.ts +0 -83
- package/lib/expectations/ElementExpectation.js +0 -102
- package/lib/expectations/ElementExpectation.js.map +0 -1
- package/lib/input/Key.js.map +0 -1
- package/lib/input/index.d.ts +0 -1
- package/lib/input/index.js.map +0 -1
- package/lib/screenplay/abilities/BrowserCapabilities.d.ts +0 -5
- package/lib/screenplay/abilities/BrowserCapabilities.js.map +0 -1
- package/lib/screenplay/interactions/EnterBuilder.d.ts +0 -25
- package/lib/screenplay/interactions/EnterBuilder.js.map +0 -1
- package/lib/screenplay/interactions/PressBuilder.d.ts +0 -26
- package/lib/screenplay/interactions/PressBuilder.js +0 -3
- package/lib/screenplay/interactions/PressBuilder.js.map +0 -1
- package/lib/screenplay/interactions/SelectBuilder.d.ts +0 -33
- package/lib/screenplay/interactions/SelectBuilder.js +0 -3
- package/lib/screenplay/interactions/SelectBuilder.js.map +0 -1
- package/lib/screenplay/interactions/Wait.d.ts +0 -143
- package/lib/screenplay/interactions/Wait.js +0 -238
- package/lib/screenplay/interactions/Wait.js.map +0 -1
- package/lib/screenplay/interactions/WaitBuilder.d.ts +0 -32
- package/lib/screenplay/interactions/WaitBuilder.js.map +0 -1
- package/lib/screenplay/models/ModalDialog.d.ts +0 -9
- package/lib/screenplay/models/ModalDialog.js +0 -14
- package/lib/screenplay/models/ModalDialog.js.map +0 -1
- package/lib/screenplay/questions/ElementQuestion.d.ts +0 -33
- package/lib/screenplay/questions/ElementQuestion.js +0 -53
- package/lib/screenplay/questions/ElementQuestion.js.map +0 -1
- package/src/expectations/ElementExpectation.ts +0 -108
- package/src/input/index.ts +0 -1
- package/src/screenplay/abilities/BrowserCapabilities.ts +0 -5
- package/src/screenplay/interactions/EnterBuilder.ts +0 -28
- package/src/screenplay/interactions/PressBuilder.ts +0 -29
- package/src/screenplay/interactions/SelectBuilder.ts +0 -36
- package/src/screenplay/interactions/Wait.ts +0 -260
- package/src/screenplay/interactions/WaitBuilder.ts +0 -34
- package/src/screenplay/models/ModalDialog.ts +0 -19
- package/src/screenplay/questions/ElementQuestion.ts +0 -58
- package/tsconfig.eslint.json +0 -10
- /package/lib/screenplay/{abilities → models}/BrowserCapabilities.js +0 -0
|
@@ -1,53 +1,96 @@
|
|
|
1
|
-
import { Ability
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Ability } from '@serenity-js/core';
|
|
2
|
+
import { BrowserCapabilities, BrowsingSession, Page } from '../models';
|
|
3
|
+
/**
|
|
4
|
+
* The {@apilink Ability|ability} to `BrowseTheWeb` enables an {@apilink Actor|actor}
|
|
5
|
+
* to {@apilink Interaction|interact with} and {@apilink Question|retrieve information from} Web-based user interfaces.
|
|
6
|
+
*
|
|
7
|
+
* `BrowseTheWeb` wraps test integration tools such as [Playwright](/api/playwright),
|
|
8
|
+
* [Protractor](/api/protractor), or [WebdriverIO](/api/webdriverio),
|
|
9
|
+
* and together with Serenity/JS Web models, such as {@apilink Page} or {@apilink PageElement} - offers a standardised way
|
|
10
|
+
* to write Web-based tests following the Screenplay Pattern.
|
|
11
|
+
*
|
|
12
|
+
* The consistent and portable design of abstractions provided by the [`@serenity-js/web` module](/api/web)
|
|
13
|
+
* also helps to make your tests portable across the various test integration tools and helps to make your test
|
|
14
|
+
* code easier to reuse across projects and teams.
|
|
15
|
+
*
|
|
16
|
+
* ## Giving the actors an ability to `BrowseTheWeb`
|
|
17
|
+
*
|
|
18
|
+
* To give an {@apilink Actor|actor} an ability to `BrowseTheWeb`, provide the **integration tool-specific implementation**
|
|
19
|
+
* via {@apilink Actor.whoCan} in {@apilink Cast.prepare}, or via {@apilink Cast.where}.
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { beforeEach } from 'mocha'
|
|
23
|
+
* import { engage, Actor, Cast } from '@serenity-js/core'
|
|
24
|
+
* import { BrowseTheWebWithPlaywright } from '@serenity-js/playwright'
|
|
25
|
+
* import { Browser, chromium } from 'playwright'
|
|
26
|
+
*
|
|
27
|
+
* beforeEach(async () => {
|
|
28
|
+
* const browser = await chromium.launch({ headless: true })
|
|
29
|
+
*
|
|
30
|
+
* engage(
|
|
31
|
+
* BrowseTheWebWithPlaywright.using(browser),
|
|
32
|
+
* )
|
|
33
|
+
* })
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* ### Learn more
|
|
37
|
+
*
|
|
38
|
+
* To learn more about using Serenity/JS with your chosen test integration tool, follow their respective documentation:
|
|
39
|
+
*
|
|
40
|
+
* - {@apilink BrowseTheWebWithPlaywright}
|
|
41
|
+
* - {@apilink BrowseTheWebWithProtractor}
|
|
42
|
+
* - {@apilink BrowseTheWebWithWebdriverIO}
|
|
43
|
+
*
|
|
44
|
+
* ## Using the ability to `BrowseTheWeb`
|
|
45
|
+
*
|
|
46
|
+
* To use the ability to `BrowseTheWeb` in a custom {@apilink Interaction} or {@apilink Question}, use the **generic** method {@apilink BrowseTheWeb.as}
|
|
47
|
+
* to retrieve it.
|
|
48
|
+
*
|
|
49
|
+
* This generic method retrieves the integration tool-specific implementation of {@apilink BrowseTheWeb} present on the {@apilink Actor},
|
|
50
|
+
* such as {@apilink BrowseTheWebWithPlaywright} or {@apilink BrowseTheWebWethWebdriverIO}, using {@apilink Actor.abilityTo}.
|
|
51
|
+
*
|
|
52
|
+
* This decoupling mechanism helps to make your test code portable across test integration tools,
|
|
53
|
+
* since the only part of your test suite that needs to know about the test integration tool used are the actors.
|
|
54
|
+
* The rest of your test code, so {@apilink Task|tasks}, {@apilink Interaction|interactions}, and {@apilink Question|questions},
|
|
55
|
+
* remain fully agnostic of the underlying tool.
|
|
56
|
+
*
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { BrowseTheWeb, Question } from '@serenity-js/web'
|
|
59
|
+
*
|
|
60
|
+
* const BrowserDetails = () =>
|
|
61
|
+
* Question.about('browser details', async actor => {
|
|
62
|
+
* const capabilities = await BrowseTheWeb.as(actor).browserCapabilities();
|
|
63
|
+
* return ${ capabilities.browserName } ${ capabilities.browserVersion }`;
|
|
64
|
+
* })
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* **Pro tip:** Use the specific `BrowseTheWebWith<test integration tool name>` to give the actor the ability,
|
|
68
|
+
* and generic `BrowseTheWeb.as(actor)` to retrieve it.
|
|
69
|
+
*
|
|
70
|
+
* ### Learn more
|
|
71
|
+
*
|
|
72
|
+
* - {@apilink Ability}
|
|
73
|
+
* - {@apilink Actor.whoCan}
|
|
74
|
+
* - {@apilink Cast.where}
|
|
75
|
+
* - {@apilink Cast.prepare}
|
|
76
|
+
*
|
|
77
|
+
* @group Abilities
|
|
78
|
+
*/
|
|
79
|
+
export declare abstract class BrowseTheWeb<Native_Element_Type = any> extends Ability {
|
|
80
|
+
protected readonly session: BrowsingSession<Page<Native_Element_Type>>;
|
|
81
|
+
constructor(session: BrowsingSession<Page<Native_Element_Type>>);
|
|
7
82
|
/**
|
|
8
|
-
* @
|
|
9
|
-
* Used to access the Actor's ability to {@link BrowseTheWeb}
|
|
10
|
-
* from within the {@link @serenity-js/core/lib/screenplay~Interaction} classes,
|
|
11
|
-
* such as {@link Click}.
|
|
12
|
-
*
|
|
13
|
-
* @param {@serenity-js/core/lib/screenplay/actor~UsesAbilities} actor
|
|
14
|
-
* @return {BrowseTheWeb}
|
|
83
|
+
* Returns {@apilink BrowserCapabilities|basic meta-data} about the browser associated with this ability.
|
|
15
84
|
*/
|
|
16
|
-
static as<NET = any, NRET = unknown>(actor: UsesAbilities): BrowseTheWeb<NET, NRET>;
|
|
17
|
-
constructor(locators: Map<new (...args: unknown[]) => Selector, (selector: Selector) => Locator<Native_Element_Type, Native_Root_Element_Type>>);
|
|
18
|
-
abstract navigateTo(destination: string): Promise<void>;
|
|
19
|
-
abstract navigateBack(): Promise<void>;
|
|
20
|
-
abstract navigateForward(): Promise<void>;
|
|
21
|
-
abstract reloadPage(): Promise<void>;
|
|
22
|
-
abstract waitFor(duration: Duration): Promise<void>;
|
|
23
|
-
abstract waitUntil(condition: () => boolean | Promise<boolean>, timeout: Duration): Promise<void>;
|
|
24
|
-
locate(selector: Selector): Locator<Native_Element_Type, Native_Root_Element_Type>;
|
|
25
85
|
abstract browserCapabilities(): Promise<BrowserCapabilities>;
|
|
26
|
-
abstract sendKeys(keys: Array<Key | string>): Promise<void>;
|
|
27
|
-
abstract executeScript<Result, InnerArguments extends any[]>(script: string | ((...parameters: InnerArguments) => Result), ...args: InnerArguments): Promise<Result>;
|
|
28
|
-
abstract executeAsyncScript<Result, Parameters extends any[]>(script: string | ((...args: [...parameters: Parameters, callback: (result: Result) => void]) => void), ...args: Parameters): Promise<Result>;
|
|
29
|
-
abstract lastScriptExecutionResult<R = any>(): R;
|
|
30
|
-
abstract takeScreenshot(): Promise<string>;
|
|
31
86
|
/**
|
|
32
|
-
* @
|
|
33
|
-
* Returns a {@link Page} representing the currently active top-level browsing context.
|
|
34
|
-
*
|
|
35
|
-
* @returns {Promise<Page>}
|
|
87
|
+
* Returns a {@apilink Page} representing the currently active browser tab.
|
|
36
88
|
*/
|
|
37
|
-
|
|
89
|
+
currentPage(): Promise<Page<Native_Element_Type>>;
|
|
38
90
|
/**
|
|
39
|
-
* @
|
|
40
|
-
*
|
|
41
|
-
* top-level browsing context, e.g. all the open browser tabs.
|
|
42
|
-
*
|
|
43
|
-
* @returns {Promise<Array<Page>>}
|
|
91
|
+
* Returns an array of {@apilink Page|pages} representing all the browser tabs
|
|
92
|
+
* available in the current {@apilink BrowsingSession}.
|
|
44
93
|
*/
|
|
45
|
-
|
|
46
|
-
abstract cookie(name: string): Promise<Cookie>;
|
|
47
|
-
abstract setCookie(cookieData: CookieData): Promise<void>;
|
|
48
|
-
abstract deleteAllCookies(): Promise<void>;
|
|
49
|
-
abstract modalDialog(): Promise<ModalDialog>;
|
|
50
|
-
abstract switchToFrame(targetOrIndex: PageElement | number | string): Promise<void>;
|
|
51
|
-
abstract switchToParentFrame(): Promise<void>;
|
|
52
|
-
abstract switchToDefaultContent(): Promise<void>;
|
|
94
|
+
allPages(): Promise<Array<Page<Native_Element_Type>>>;
|
|
53
95
|
}
|
|
96
|
+
//# sourceMappingURL=BrowseTheWeb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowseTheWeb.d.ts","sourceRoot":"","sources":["../../../src/screenplay/abilities/BrowseTheWeb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AACH,8BAAsB,YAAY,CAAC,mBAAmB,GAAG,GAAG,CAAE,SAAQ,OAAO;IAE7D,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;gBAAnD,OAAO,EAAE,eAAe,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAIlF;;OAEG;IACH,QAAQ,CAAC,mBAAmB,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAE5D;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAIvD;;;OAGG;IACH,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;CAGxD"}
|
|
@@ -2,29 +2,99 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BrowseTheWeb = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The {@apilink Ability|ability} to `BrowseTheWeb` enables an {@apilink Actor|actor}
|
|
7
|
+
* to {@apilink Interaction|interact with} and {@apilink Question|retrieve information from} Web-based user interfaces.
|
|
8
|
+
*
|
|
9
|
+
* `BrowseTheWeb` wraps test integration tools such as [Playwright](/api/playwright),
|
|
10
|
+
* [Protractor](/api/protractor), or [WebdriverIO](/api/webdriverio),
|
|
11
|
+
* and together with Serenity/JS Web models, such as {@apilink Page} or {@apilink PageElement} - offers a standardised way
|
|
12
|
+
* to write Web-based tests following the Screenplay Pattern.
|
|
13
|
+
*
|
|
14
|
+
* The consistent and portable design of abstractions provided by the [`@serenity-js/web` module](/api/web)
|
|
15
|
+
* also helps to make your tests portable across the various test integration tools and helps to make your test
|
|
16
|
+
* code easier to reuse across projects and teams.
|
|
17
|
+
*
|
|
18
|
+
* ## Giving the actors an ability to `BrowseTheWeb`
|
|
19
|
+
*
|
|
20
|
+
* To give an {@apilink Actor|actor} an ability to `BrowseTheWeb`, provide the **integration tool-specific implementation**
|
|
21
|
+
* via {@apilink Actor.whoCan} in {@apilink Cast.prepare}, or via {@apilink Cast.where}.
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { beforeEach } from 'mocha'
|
|
25
|
+
* import { engage, Actor, Cast } from '@serenity-js/core'
|
|
26
|
+
* import { BrowseTheWebWithPlaywright } from '@serenity-js/playwright'
|
|
27
|
+
* import { Browser, chromium } from 'playwright'
|
|
28
|
+
*
|
|
29
|
+
* beforeEach(async () => {
|
|
30
|
+
* const browser = await chromium.launch({ headless: true })
|
|
31
|
+
*
|
|
32
|
+
* engage(
|
|
33
|
+
* BrowseTheWebWithPlaywright.using(browser),
|
|
34
|
+
* )
|
|
35
|
+
* })
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* ### Learn more
|
|
39
|
+
*
|
|
40
|
+
* To learn more about using Serenity/JS with your chosen test integration tool, follow their respective documentation:
|
|
41
|
+
*
|
|
42
|
+
* - {@apilink BrowseTheWebWithPlaywright}
|
|
43
|
+
* - {@apilink BrowseTheWebWithProtractor}
|
|
44
|
+
* - {@apilink BrowseTheWebWithWebdriverIO}
|
|
45
|
+
*
|
|
46
|
+
* ## Using the ability to `BrowseTheWeb`
|
|
47
|
+
*
|
|
48
|
+
* To use the ability to `BrowseTheWeb` in a custom {@apilink Interaction} or {@apilink Question}, use the **generic** method {@apilink BrowseTheWeb.as}
|
|
49
|
+
* to retrieve it.
|
|
50
|
+
*
|
|
51
|
+
* This generic method retrieves the integration tool-specific implementation of {@apilink BrowseTheWeb} present on the {@apilink Actor},
|
|
52
|
+
* such as {@apilink BrowseTheWebWithPlaywright} or {@apilink BrowseTheWebWethWebdriverIO}, using {@apilink Actor.abilityTo}.
|
|
53
|
+
*
|
|
54
|
+
* This decoupling mechanism helps to make your test code portable across test integration tools,
|
|
55
|
+
* since the only part of your test suite that needs to know about the test integration tool used are the actors.
|
|
56
|
+
* The rest of your test code, so {@apilink Task|tasks}, {@apilink Interaction|interactions}, and {@apilink Question|questions},
|
|
57
|
+
* remain fully agnostic of the underlying tool.
|
|
58
|
+
*
|
|
59
|
+
* ```ts
|
|
60
|
+
* import { BrowseTheWeb, Question } from '@serenity-js/web'
|
|
61
|
+
*
|
|
62
|
+
* const BrowserDetails = () =>
|
|
63
|
+
* Question.about('browser details', async actor => {
|
|
64
|
+
* const capabilities = await BrowseTheWeb.as(actor).browserCapabilities();
|
|
65
|
+
* return ${ capabilities.browserName } ${ capabilities.browserVersion }`;
|
|
66
|
+
* })
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* **Pro tip:** Use the specific `BrowseTheWebWith<test integration tool name>` to give the actor the ability,
|
|
70
|
+
* and generic `BrowseTheWeb.as(actor)` to retrieve it.
|
|
71
|
+
*
|
|
72
|
+
* ### Learn more
|
|
73
|
+
*
|
|
74
|
+
* - {@apilink Ability}
|
|
75
|
+
* - {@apilink Actor.whoCan}
|
|
76
|
+
* - {@apilink Cast.where}
|
|
77
|
+
* - {@apilink Cast.prepare}
|
|
78
|
+
*
|
|
79
|
+
* @group Abilities
|
|
80
|
+
*/
|
|
81
|
+
class BrowseTheWeb extends core_1.Ability {
|
|
82
|
+
constructor(session) {
|
|
83
|
+
super();
|
|
84
|
+
this.session = session;
|
|
8
85
|
}
|
|
9
86
|
/**
|
|
10
|
-
* @
|
|
11
|
-
* Used to access the Actor's ability to {@link BrowseTheWeb}
|
|
12
|
-
* from within the {@link @serenity-js/core/lib/screenplay~Interaction} classes,
|
|
13
|
-
* such as {@link Click}.
|
|
14
|
-
*
|
|
15
|
-
* @param {@serenity-js/core/lib/screenplay/actor~UsesAbilities} actor
|
|
16
|
-
* @return {BrowseTheWeb}
|
|
87
|
+
* Returns a {@apilink Page} representing the currently active browser tab.
|
|
17
88
|
*/
|
|
18
|
-
|
|
19
|
-
return
|
|
89
|
+
async currentPage() {
|
|
90
|
+
return this.session.currentPage();
|
|
20
91
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
throw new core_1.LogicError((0, core_1.f) `${selector} is not supported by ${this.constructor.name}`);
|
|
92
|
+
/**
|
|
93
|
+
* Returns an array of {@apilink Page|pages} representing all the browser tabs
|
|
94
|
+
* available in the current {@apilink BrowsingSession}.
|
|
95
|
+
*/
|
|
96
|
+
allPages() {
|
|
97
|
+
return this.session.allPages();
|
|
28
98
|
}
|
|
29
99
|
}
|
|
30
100
|
exports.BrowseTheWeb = BrowseTheWeb;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowseTheWeb.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/BrowseTheWeb.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"BrowseTheWeb.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/BrowseTheWeb.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAI5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AACH,MAAsB,YAAwC,SAAQ,cAAO;IAEzE,YAA+B,OAAmD;QAC9E,KAAK,EAAE,CAAC;QADmB,YAAO,GAAP,OAAO,CAA4C;IAElF,CAAC;IAOD;;OAEG;IACH,KAAK,CAAC,WAAW;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IACtC,CAAC;IAED;;;OAGG;IACH,QAAQ;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;CACJ;AAzBD,oCAyBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screenplay/abilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -10,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
15
|
};
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./BrowserCapabilities"), exports);
|
|
14
17
|
__exportStar(require("./BrowseTheWeb"), exports);
|
|
15
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/screenplay/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
package/lib/screenplay/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/screenplay/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/screenplay/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,iDAA+B;AAC/B,2CAAyB;AACzB,8CAA4B"}
|
|
@@ -2,78 +2,73 @@ import { Answerable, AnswersQuestions, Interaction, UsesAbilities } from '@seren
|
|
|
2
2
|
import { PageElement } from '../models';
|
|
3
3
|
import { PageElementInteraction } from './PageElementInteraction';
|
|
4
4
|
/**
|
|
5
|
-
* @
|
|
6
|
-
*
|
|
7
|
-
* clear the `value` of a [form `input`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
|
5
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
6
|
+
* to clear the `value` of a [form `input` field](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
* <form>
|
|
11
|
-
* <input type="text" name="example" id="example" />
|
|
12
|
-
* </form>
|
|
8
|
+
* ## Example widget
|
|
13
9
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
10
|
+
* ```html
|
|
11
|
+
* <form>
|
|
12
|
+
* <input type="text" name="example" id="example" />
|
|
13
|
+
* </form>
|
|
14
|
+
* ```
|
|
16
15
|
*
|
|
17
|
-
*
|
|
18
|
-
* static exampleInput = Target.the('example input')
|
|
19
|
-
* .located(by.id('example'));
|
|
20
|
-
* }
|
|
16
|
+
* ## Lean Page Object describing the widget
|
|
21
17
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* import { BrowseTheWeb, Clear, Enter, Value } from '@serenity-js/webdriverio';
|
|
25
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { By, PageElement } from '@serenity-js/web'
|
|
26
20
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
21
|
+
* const Form = {
|
|
22
|
+
* exampleInput: () =>
|
|
23
|
+
* PageElement.located(By.id('example'))
|
|
24
|
+
* .describedAs('example input')
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
32
27
|
*
|
|
33
|
-
*
|
|
34
|
-
* Ensure.that(Value.of(Form.exampleInput), equals('')),
|
|
35
|
-
* );
|
|
28
|
+
* ## Clearing the value of an input field
|
|
36
29
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
42
|
-
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
32
|
+
* import { Clear, Enter, Value } from '@serenity-js/web'
|
|
33
|
+
* import { Ensure, equals } from '@serenity-js/assertions'
|
|
43
34
|
*
|
|
44
|
-
*
|
|
35
|
+
* await actorCalled('Inés')
|
|
36
|
+
* .whoCan(BrowseTheWeb.using(browser))
|
|
37
|
+
* .attemptsTo(
|
|
38
|
+
* Enter.theValue('Hello world!').into(Form.exampleInput()),
|
|
39
|
+
* Ensure.that(Value.of(Form.exampleInput()), equals('Hello world!')),
|
|
40
|
+
*
|
|
41
|
+
* Clear.theValueOf(Form.exampleInput()),
|
|
42
|
+
* Ensure.that(Value.of(Form.exampleInput()), equals('')),
|
|
43
|
+
* )
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* ## Learn more
|
|
47
|
+
*
|
|
48
|
+
* - {@apilink BrowseTheWeb}
|
|
49
|
+
* - {@apilink Enter}
|
|
50
|
+
* - {@apilink Value}
|
|
51
|
+
* - {@apilink PageElement}
|
|
52
|
+
*
|
|
53
|
+
* @group Activities
|
|
45
54
|
*/
|
|
46
55
|
export declare class Clear extends PageElementInteraction {
|
|
47
56
|
private readonly field;
|
|
48
57
|
/**
|
|
49
|
-
* @
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* @param {Answerable<PageElement>} field
|
|
53
|
-
* The field to be cleared
|
|
58
|
+
* Instantiates an {@apilink Interaction|interaction}
|
|
59
|
+
* that instructs the {@apilink Actor|actor}
|
|
60
|
+
* to clear the value of an input `field`,
|
|
54
61
|
*
|
|
55
|
-
* @
|
|
62
|
+
* @param field
|
|
63
|
+
* The field which value should be cleared
|
|
56
64
|
*/
|
|
57
65
|
static theValueOf(field: Answerable<PageElement>): Interaction;
|
|
66
|
+
protected constructor(field: Answerable<PageElement>);
|
|
58
67
|
/**
|
|
59
|
-
* @
|
|
60
|
-
* The element to be clicked on
|
|
61
|
-
*/
|
|
62
|
-
constructor(field: Answerable<PageElement>);
|
|
63
|
-
/**
|
|
64
|
-
* @desc
|
|
65
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
66
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
67
|
-
*
|
|
68
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
69
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
70
|
-
*
|
|
71
|
-
* @returns {PromiseLike<void>}
|
|
72
|
-
*
|
|
73
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
74
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
75
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
68
|
+
* @inheritDoc
|
|
76
69
|
*/
|
|
77
70
|
performAs(actor: UsesAbilities & AnswersQuestions): Promise<void>;
|
|
71
|
+
private isClearable;
|
|
78
72
|
private capitaliseFirstLetter;
|
|
79
73
|
}
|
|
74
|
+
//# sourceMappingURL=Clear.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Clear.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/Clear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAK,WAAW,EAAc,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE5G,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,qBAAa,KAAM,SAAQ,sBAAsB;IAcvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAZ5C;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,WAAW;IAI9D,SAAS,aAA8B,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC;IAIrE;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;YAczD,WAAW;IAmBzB,OAAO,CAAC,qBAAqB;CAGhC"}
|
|
@@ -2,92 +2,99 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Clear = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
5
|
const PageElementInteraction_1 = require("./PageElementInteraction");
|
|
7
6
|
/**
|
|
8
|
-
* @
|
|
9
|
-
*
|
|
10
|
-
* clear the `value` of a [form `input`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
|
7
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
8
|
+
* to clear the `value` of a [form `input` field](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
|
11
9
|
*
|
|
12
|
-
*
|
|
13
|
-
* <form>
|
|
14
|
-
* <input type="text" name="example" id="example" />
|
|
15
|
-
* </form>
|
|
10
|
+
* ## Example widget
|
|
16
11
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
12
|
+
* ```html
|
|
13
|
+
* <form>
|
|
14
|
+
* <input type="text" name="example" id="example" />
|
|
15
|
+
* </form>
|
|
16
|
+
* ```
|
|
19
17
|
*
|
|
20
|
-
*
|
|
21
|
-
* static exampleInput = Target.the('example input')
|
|
22
|
-
* .located(by.id('example'));
|
|
23
|
-
* }
|
|
18
|
+
* ## Lean Page Object describing the widget
|
|
24
19
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* import { BrowseTheWeb, Clear, Enter, Value } from '@serenity-js/webdriverio';
|
|
28
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { By, PageElement } from '@serenity-js/web'
|
|
29
22
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
23
|
+
* const Form = {
|
|
24
|
+
* exampleInput: () =>
|
|
25
|
+
* PageElement.located(By.id('example'))
|
|
26
|
+
* .describedAs('example input')
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
35
29
|
*
|
|
36
|
-
*
|
|
37
|
-
* Ensure.that(Value.of(Form.exampleInput), equals('')),
|
|
38
|
-
* );
|
|
30
|
+
* ## Clearing the value of an input field
|
|
39
31
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
45
|
-
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { actorCalled } from '@serenity-js/core'
|
|
34
|
+
* import { Clear, Enter, Value } from '@serenity-js/web'
|
|
35
|
+
* import { Ensure, equals } from '@serenity-js/assertions'
|
|
46
36
|
*
|
|
47
|
-
*
|
|
37
|
+
* await actorCalled('Inés')
|
|
38
|
+
* .whoCan(BrowseTheWeb.using(browser))
|
|
39
|
+
* .attemptsTo(
|
|
40
|
+
* Enter.theValue('Hello world!').into(Form.exampleInput()),
|
|
41
|
+
* Ensure.that(Value.of(Form.exampleInput()), equals('Hello world!')),
|
|
42
|
+
*
|
|
43
|
+
* Clear.theValueOf(Form.exampleInput()),
|
|
44
|
+
* Ensure.that(Value.of(Form.exampleInput()), equals('')),
|
|
45
|
+
* )
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* ## Learn more
|
|
49
|
+
*
|
|
50
|
+
* - {@apilink BrowseTheWeb}
|
|
51
|
+
* - {@apilink Enter}
|
|
52
|
+
* - {@apilink Value}
|
|
53
|
+
* - {@apilink PageElement}
|
|
54
|
+
*
|
|
55
|
+
* @group Activities
|
|
48
56
|
*/
|
|
49
57
|
class Clear extends PageElementInteraction_1.PageElementInteraction {
|
|
50
58
|
/**
|
|
51
|
-
* @
|
|
52
|
-
*
|
|
53
|
-
|
|
54
|
-
constructor(field) {
|
|
55
|
-
super((0, io_1.formatted) `#actor clears the value of ${field}`);
|
|
56
|
-
this.field = field;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* @desc
|
|
60
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
61
|
-
*
|
|
62
|
-
* @param {Answerable<PageElement>} field
|
|
63
|
-
* The field to be cleared
|
|
59
|
+
* Instantiates an {@apilink Interaction|interaction}
|
|
60
|
+
* that instructs the {@apilink Actor|actor}
|
|
61
|
+
* to clear the value of an input `field`,
|
|
64
62
|
*
|
|
65
|
-
* @
|
|
63
|
+
* @param field
|
|
64
|
+
* The field which value should be cleared
|
|
66
65
|
*/
|
|
67
66
|
static theValueOf(field) {
|
|
68
67
|
return new Clear(field);
|
|
69
68
|
}
|
|
69
|
+
constructor(field) {
|
|
70
|
+
super((0, core_1.d) `#actor clears the value of ${field}`);
|
|
71
|
+
this.field = field;
|
|
72
|
+
}
|
|
70
73
|
/**
|
|
71
|
-
* @
|
|
72
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
73
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
74
|
-
*
|
|
75
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
76
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
77
|
-
*
|
|
78
|
-
* @returns {PromiseLike<void>}
|
|
79
|
-
*
|
|
80
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
81
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
82
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
74
|
+
* @inheritDoc
|
|
83
75
|
*/
|
|
84
76
|
async performAs(actor) {
|
|
85
77
|
const element = await this.resolve(actor, this.field);
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
throw new core_1.LogicError(this.capitaliseFirstLetter((0,
|
|
78
|
+
const isClearable = await this.isClearable(element);
|
|
79
|
+
if (!isClearable) {
|
|
80
|
+
throw new core_1.LogicError(this.capitaliseFirstLetter((0, core_1.d) `${this.field} doesn't seem like an element that could be cleared.`));
|
|
81
|
+
}
|
|
82
|
+
await element.clearValue();
|
|
83
|
+
}
|
|
84
|
+
async isClearable(element) {
|
|
85
|
+
const contentEditable = await element.attribute('contenteditable');
|
|
86
|
+
const hasContentEditableAttribute = contentEditable !== null && contentEditable !== undefined && contentEditable !== 'false'; // true or empty string mean content is editable
|
|
87
|
+
if (hasContentEditableAttribute) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const value = await element.value();
|
|
92
|
+
const hasValueAttribute = value !== null && value !== undefined;
|
|
93
|
+
return hasValueAttribute;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return false;
|
|
89
97
|
}
|
|
90
|
-
return element.clearValue();
|
|
91
98
|
}
|
|
92
99
|
capitaliseFirstLetter(text) {
|
|
93
100
|
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clear.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Clear.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"Clear.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Clear.ts"],"names":[],"mappings":";;;AAAA,4CAA4G;AAG5G,qEAAkE;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAa,KAAM,SAAQ,+CAAsB;IAE7C;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CAAC,KAA8B;QAC5C,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,YAAuC,KAA8B;QACjE,KAAK,CAAC,IAAA,QAAC,EAAA,8BAA+B,KAAM,EAAE,CAAC,CAAC;QADb,UAAK,GAAL,KAAK,CAAyB;IAErE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,KAAuC;QACnD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAEtD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAEpD,IAAI,CAAC,WAAW,EAAE;YACd,MAAM,IAAI,iBAAU,CAChB,IAAI,CAAC,qBAAqB,CAAC,IAAA,QAAC,EAAA,GAAI,IAAI,CAAC,KAAM,sDAAsD,CAAC,CACrG,CAAC;SACL;QAED,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;IAC/B,CAAC;IAEO,KAAK,CAAC,WAAW,CAAC,OAAoB;QAC1C,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QACnE,MAAM,2BAA2B,GAAG,eAAe,KAAK,IAAI,IAAI,eAAe,KAAK,SAAS,IAAI,eAAe,KAAK,OAAO,CAAC,CAAE,gDAAgD;QAE/K,IAAI,2BAA2B,EAAE;YAC7B,OAAO,IAAI,CAAC;SACf;QAED,IAAI;YACA,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;YACpC,MAAM,iBAAiB,GAAG,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;YAEhE,OAAO,iBAAiB,CAAC;SAC5B;QACD,MAAM;YACF,OAAO,KAAK,CAAC;SAChB;IACL,CAAC;IAEO,qBAAqB,CAAC,IAAY;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;CACJ;AAzDD,sBAyDC"}
|