@serenity-js/web 3.0.0-rc.9 → 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 +329 -74
- 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,67 +1,45 @@
|
|
|
1
1
|
import { Answerable, AnswersQuestions, CollectsArtifacts, Interaction, UsesAbilities } from '@serenity-js/core';
|
|
2
2
|
/**
|
|
3
|
-
* @
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* and reported by [Serenity BDD reporter](/modules/serenity-bdd).
|
|
3
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
4
|
+
* to take a screenshot and emit an {@apilink Artifact},
|
|
5
|
+
* which can then be persisted by {@apilink ArtifactArchiver}
|
|
6
|
+
* and reported by [Serenity BDD reporter](/api/serenity-bdd).
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
11
|
-
* import { BrowseTheWeb, Navigate, TakeScreenshot } from '@serenity-js/protractor';
|
|
12
|
-
* import { protractor } from 'protractor';
|
|
8
|
+
* #### Taking a screenshot
|
|
13
9
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* Navigate.to('/app'),
|
|
18
|
-
* TakeScreenshot.of('my app'),
|
|
19
|
-
* );
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
12
|
+
* import { Navigate, TakeScreenshot } from '@serenity-js/protractor';
|
|
20
13
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
14
|
+
* await actorCalled('Tania')
|
|
15
|
+
* .attemptsTo(
|
|
16
|
+
* Navigate.to('/app'),
|
|
17
|
+
* TakeScreenshot.of('my app'),
|
|
18
|
+
* )
|
|
19
|
+
* ```
|
|
25
20
|
*
|
|
26
|
-
*
|
|
21
|
+
* ## Learn more
|
|
22
|
+
*
|
|
23
|
+
* - {@apilink BrowseTheWeb}
|
|
24
|
+
* - {@apilink CollectsArtifacts}
|
|
25
|
+
* - {@apilink Artifact}
|
|
26
|
+
* - {@apilink ArtifactArchiver}
|
|
27
|
+
*
|
|
28
|
+
* @group Activities
|
|
27
29
|
*/
|
|
28
30
|
export declare class TakeScreenshot extends Interaction {
|
|
29
31
|
private readonly name;
|
|
30
32
|
/**
|
|
31
|
-
* @
|
|
32
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
33
|
-
*
|
|
34
|
-
* @param {Answerable<string>} name
|
|
35
|
-
* The name to associate the screenshot with
|
|
33
|
+
* Instantiates this {@apilink Interaction}.
|
|
36
34
|
*
|
|
37
|
-
* @
|
|
35
|
+
* @param name
|
|
36
|
+
* The name to give the emitted {@apilink Artifact}
|
|
38
37
|
*/
|
|
39
38
|
static of(name: Answerable<string>): Interaction;
|
|
39
|
+
protected constructor(name: Answerable<string>);
|
|
40
40
|
/**
|
|
41
|
-
* @
|
|
42
|
-
* The name to associate the screenshot with
|
|
43
|
-
*/
|
|
44
|
-
constructor(name: Answerable<string>);
|
|
45
|
-
/**
|
|
46
|
-
* @desc
|
|
47
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
48
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
49
|
-
*
|
|
50
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
51
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
52
|
-
*
|
|
53
|
-
* @returns {PromiseLike<void>}
|
|
54
|
-
*
|
|
55
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
56
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
57
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
41
|
+
* @inheritDoc
|
|
58
42
|
*/
|
|
59
43
|
performAs(actor: UsesAbilities & AnswersQuestions & CollectsArtifacts): Promise<void>;
|
|
60
|
-
/**
|
|
61
|
-
* @desc
|
|
62
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
63
|
-
*
|
|
64
|
-
* @returns {string}
|
|
65
|
-
*/
|
|
66
|
-
toString(): string;
|
|
67
44
|
}
|
|
45
|
+
//# sourceMappingURL=TakeScreenshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TakeScreenshot.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/TakeScreenshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAK,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKnH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAYrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAV3C;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,WAAW;IAIhD,SAAS,aAA8B,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;IAI/D;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAU9F"}
|
|
@@ -2,84 +2,59 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TakeScreenshot = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
5
|
const model_1 = require("@serenity-js/core/lib/model");
|
|
7
6
|
const abilities_1 = require("../abilities");
|
|
8
7
|
/**
|
|
9
|
-
* @
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* and reported by [Serenity BDD reporter](/modules/serenity-bdd).
|
|
8
|
+
* Instructs an {@apilink Actor|actor} who has the {@apilink Ability|ability} to {@apilink BrowseTheWeb}
|
|
9
|
+
* to take a screenshot and emit an {@apilink Artifact},
|
|
10
|
+
* which can then be persisted by {@apilink ArtifactArchiver}
|
|
11
|
+
* and reported by [Serenity BDD reporter](/api/serenity-bdd).
|
|
14
12
|
*
|
|
15
|
-
*
|
|
16
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
17
|
-
* import { BrowseTheWeb, Navigate, TakeScreenshot } from '@serenity-js/protractor';
|
|
18
|
-
* import { protractor } from 'protractor';
|
|
13
|
+
* #### Taking a screenshot
|
|
19
14
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* Navigate.to('/app'),
|
|
24
|
-
* TakeScreenshot.of('my app'),
|
|
25
|
-
* );
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
17
|
+
* import { Navigate, TakeScreenshot } from '@serenity-js/protractor';
|
|
26
18
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
19
|
+
* await actorCalled('Tania')
|
|
20
|
+
* .attemptsTo(
|
|
21
|
+
* Navigate.to('/app'),
|
|
22
|
+
* TakeScreenshot.of('my app'),
|
|
23
|
+
* )
|
|
24
|
+
* ```
|
|
31
25
|
*
|
|
32
|
-
*
|
|
26
|
+
* ## Learn more
|
|
27
|
+
*
|
|
28
|
+
* - {@apilink BrowseTheWeb}
|
|
29
|
+
* - {@apilink CollectsArtifacts}
|
|
30
|
+
* - {@apilink Artifact}
|
|
31
|
+
* - {@apilink ArtifactArchiver}
|
|
32
|
+
*
|
|
33
|
+
* @group Activities
|
|
33
34
|
*/
|
|
34
35
|
class TakeScreenshot extends core_1.Interaction {
|
|
35
36
|
/**
|
|
36
|
-
* @
|
|
37
|
-
* The name to associate the screenshot with
|
|
38
|
-
*/
|
|
39
|
-
constructor(name) {
|
|
40
|
-
super();
|
|
41
|
-
this.name = name;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* @desc
|
|
45
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
37
|
+
* Instantiates this {@apilink Interaction}.
|
|
46
38
|
*
|
|
47
|
-
* @param
|
|
48
|
-
* The name to
|
|
49
|
-
*
|
|
50
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
39
|
+
* @param name
|
|
40
|
+
* The name to give the emitted {@apilink Artifact}
|
|
51
41
|
*/
|
|
52
42
|
static of(name) {
|
|
53
43
|
return new TakeScreenshot(name);
|
|
54
44
|
}
|
|
45
|
+
constructor(name) {
|
|
46
|
+
super((0, core_1.d) `#actor takes a screenshot of ${name}`);
|
|
47
|
+
this.name = name;
|
|
48
|
+
}
|
|
55
49
|
/**
|
|
56
|
-
* @
|
|
57
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
58
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
59
|
-
*
|
|
60
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
61
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
62
|
-
*
|
|
63
|
-
* @returns {PromiseLike<void>}
|
|
64
|
-
*
|
|
65
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
66
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
67
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
50
|
+
* @inheritDoc
|
|
68
51
|
*/
|
|
69
52
|
async performAs(actor) {
|
|
70
|
-
const
|
|
53
|
+
const page = await abilities_1.BrowseTheWeb.as(actor).currentPage();
|
|
54
|
+
const screenshot = await page.takeScreenshot();
|
|
71
55
|
const name = await actor.answer(this.name);
|
|
72
56
|
actor.collect(model_1.Photo.fromBase64(screenshot), new model_1.Name(name));
|
|
73
57
|
}
|
|
74
|
-
/**
|
|
75
|
-
* @desc
|
|
76
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
77
|
-
*
|
|
78
|
-
* @returns {string}
|
|
79
|
-
*/
|
|
80
|
-
toString() {
|
|
81
|
-
return (0, io_1.formatted) `#actor takes a screenshot of ${this.name}`;
|
|
82
|
-
}
|
|
83
58
|
}
|
|
84
59
|
exports.TakeScreenshot = TakeScreenshot;
|
|
85
60
|
//# sourceMappingURL=TakeScreenshot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TakeScreenshot.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/TakeScreenshot.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"TakeScreenshot.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/TakeScreenshot.ts"],"names":[],"mappings":";;;AAAA,4CAAmH;AACnH,uDAA0D;AAE1D,4CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAa,cAAe,SAAQ,kBAAW;IAE3C;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,IAAwB;QAC9B,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,YAAuC,IAAwB;QAC3D,KAAK,CAAC,IAAA,QAAC,EAAA,gCAAiC,IAAK,EAAE,CAAC,CAAC;QADd,SAAI,GAAJ,IAAI,CAAoB;IAE/D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,KAA2D;QACvE,MAAM,IAAI,GAAY,MAAM,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QACjE,MAAM,UAAU,GAAM,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAClD,MAAM,IAAI,GAAY,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEpD,KAAK,CAAC,OAAO,CACT,aAAK,CAAC,UAAU,CAAC,UAAU,CAAC,EAC5B,IAAI,YAAI,CAAC,IAAI,CAAC,CACjB,CAAC;IACN,CAAC;CACJ;AA7BD,wCA6BC"}
|
|
@@ -5,12 +5,11 @@ export * from './Enter';
|
|
|
5
5
|
export * from './ExecuteScript';
|
|
6
6
|
export * from './Hover';
|
|
7
7
|
export * from './Navigate';
|
|
8
|
+
export * from './PageElementInteraction';
|
|
8
9
|
export * from './Press';
|
|
9
|
-
export * from './PressBuilder';
|
|
10
10
|
export * from './RightClick';
|
|
11
11
|
export * from './Scroll';
|
|
12
12
|
export * from './Select';
|
|
13
|
-
export * from './SelectBuilder';
|
|
14
13
|
export * from './Switch';
|
|
15
14
|
export * from './TakeScreenshot';
|
|
16
|
-
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,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];
|
|
@@ -17,13 +21,11 @@ __exportStar(require("./Enter"), exports);
|
|
|
17
21
|
__exportStar(require("./ExecuteScript"), exports);
|
|
18
22
|
__exportStar(require("./Hover"), exports);
|
|
19
23
|
__exportStar(require("./Navigate"), exports);
|
|
24
|
+
__exportStar(require("./PageElementInteraction"), exports);
|
|
20
25
|
__exportStar(require("./Press"), exports);
|
|
21
|
-
__exportStar(require("./PressBuilder"), exports);
|
|
22
26
|
__exportStar(require("./RightClick"), exports);
|
|
23
27
|
__exportStar(require("./Scroll"), exports);
|
|
24
28
|
__exportStar(require("./Select"), exports);
|
|
25
|
-
__exportStar(require("./SelectBuilder"), exports);
|
|
26
29
|
__exportStar(require("./Switch"), exports);
|
|
27
30
|
__exportStar(require("./TakeScreenshot"), exports);
|
|
28
|
-
__exportStar(require("./Wait"), exports);
|
|
29
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,0CAAwB;AACxB,gDAA8B;AAC9B,0CAAwB;AACxB,kDAAgC;AAChC,0CAAwB;AACxB,6CAA2B;AAC3B,2DAAyC;AACzC,0CAAwB;AACxB,+CAA6B;AAC7B,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,mDAAiC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic meta-data about the browser used in the test
|
|
3
|
+
*
|
|
4
|
+
* ## Learn more
|
|
5
|
+
*
|
|
6
|
+
* - {@apilink BrowseTheWeb.browserCapabilities}
|
|
7
|
+
*
|
|
8
|
+
* @group Models
|
|
9
|
+
*/
|
|
10
|
+
export interface BrowserCapabilities {
|
|
11
|
+
/**
|
|
12
|
+
* Name of the operating system platform the test is executed on, like `darwin`, `linux` or `windows`.
|
|
13
|
+
*/
|
|
14
|
+
platformName?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Name of the Web browser the test is executed in, like `chrome`, `firefox` or `safari`.
|
|
17
|
+
*/
|
|
18
|
+
browserName?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Version number of the browser the test is executed in.
|
|
21
|
+
*/
|
|
22
|
+
browserVersion?: string;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=BrowserCapabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowserCapabilities.d.ts","sourceRoot":"","sources":["../../../src/screenplay/models/BrowserCapabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAEhC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowserCapabilities.js","sourceRoot":"","sources":["../../../src/screenplay/models/BrowserCapabilities.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { CorrelationId } from '@serenity-js/core/lib/model';
|
|
2
|
+
import { Page } from './Page';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the pages open in the current browsing context.
|
|
5
|
+
*
|
|
6
|
+
* You'll need to use this class directly only if you're planning to integrate Serenity/JS
|
|
7
|
+
* with a new Web integration tool.
|
|
8
|
+
*
|
|
9
|
+
* @group Models
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class BrowsingSession<Page_Type extends Page> {
|
|
12
|
+
protected currentBrowserPage: Page_Type;
|
|
13
|
+
protected readonly pages: Map<CorrelationId, Page_Type>;
|
|
14
|
+
closePagesOtherThan(pageOfInterest: Page_Type): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Opens a new browser page and associates it with a {@apilink Page} object.
|
|
17
|
+
*/
|
|
18
|
+
protected abstract registerCurrentPage(): Promise<Page_Type>;
|
|
19
|
+
/**
|
|
20
|
+
* Returns a {@apilink Page} representing the currently active top-level browsing context.
|
|
21
|
+
*/
|
|
22
|
+
currentPage(): Promise<Page_Type>;
|
|
23
|
+
/**
|
|
24
|
+
* Registers specified {@apilink Page|pages} to be managed by this {@apilink BrowsingSession}.
|
|
25
|
+
*
|
|
26
|
+
* @param pages
|
|
27
|
+
*/
|
|
28
|
+
register(...pages: Page_Type[]): void;
|
|
29
|
+
/**
|
|
30
|
+
* Informs this {@apilink BrowsingSession} that it should no longer manage {@apilink Page|pages}
|
|
31
|
+
* identified by the given `pageIds`.
|
|
32
|
+
*
|
|
33
|
+
* @param pageIds
|
|
34
|
+
*/
|
|
35
|
+
deregister(...pageIds: CorrelationId[]): void;
|
|
36
|
+
/**
|
|
37
|
+
* Returns a {@apilink Page|pages} representing all the available
|
|
38
|
+
* top-level browsing context, e.g. all the open browser tabs.
|
|
39
|
+
*/
|
|
40
|
+
allPages(): Promise<Array<Page_Type>>;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the ids of any {@apilink Page|pages} this {@apilink BrowsingSession} is aware of.
|
|
43
|
+
*/
|
|
44
|
+
registeredPageIds(): Array<CorrelationId>;
|
|
45
|
+
/**
|
|
46
|
+
* Informs the {@apilink BrowsingSession} that the "current page" has changed to `page`.
|
|
47
|
+
*
|
|
48
|
+
* Please note that different Web integration tools have a different definition of what a "current page" is.
|
|
49
|
+
* For example, Selenium or WebdriverIO use a single "focused" window that a developer
|
|
50
|
+
* needs to explicitly "switch to" in their tests in order to interact with it.
|
|
51
|
+
* This is similar to how a regular user would interact with Web pages;
|
|
52
|
+
* switching from one tab to another, but not interacting with more than one
|
|
53
|
+
* window/tab simultaneously.
|
|
54
|
+
*
|
|
55
|
+
* Playwright and Puppeteer, on the other hand, don't have a concept of the "current" page at all, since they
|
|
56
|
+
* allow the developer to interact with multiple open tabs/windows at the same time.
|
|
57
|
+
*
|
|
58
|
+
* Web integration-specific implementations of this class should override this method to define
|
|
59
|
+
* how the concept of the "current page" should be interpreted by Serenity/JS.
|
|
60
|
+
*
|
|
61
|
+
* @param page
|
|
62
|
+
*/
|
|
63
|
+
changeCurrentPageTo(page: Page_Type): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Closes all the pages available in this browsing context
|
|
66
|
+
*/
|
|
67
|
+
closeAllPages(): Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=BrowsingSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowsingSession.d.ts","sourceRoot":"","sources":["../../../src/screenplay/models/BrowsingSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B;;;;;;;GAOG;AACH,8BAAsB,eAAe,CAAC,SAAS,SAAS,IAAI;IACxD,SAAS,CAAC,kBAAkB,EAAE,SAAS,CAAC;IACxC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,aAAa,EAAE,SAAS,CAAC,CAAuC;IAExF,mBAAmB,CAAC,cAAc,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAWnE;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,mBAAmB,IAAI,OAAO,CAAC,SAAS,CAAC;IAE5D;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,SAAS,CAAC;IAQvC;;;;OAIG;IACH,QAAQ,CAAC,GAAG,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI;IAMrC;;;;;OAKG;IACH,UAAU,CAAC,GAAG,OAAO,EAAE,aAAa,EAAE,GAAG,IAAI;IAM7C;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAI3C;;OAEG;IACH,iBAAiB,IAAI,KAAK,CAAC,aAAa,CAAC;IAIzC;;;;;;;;;;;;;;;;;OAiBG;IACG,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzD;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;CAQvC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrowsingSession = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Represents the pages open in the current browsing context.
|
|
6
|
+
*
|
|
7
|
+
* You'll need to use this class directly only if you're planning to integrate Serenity/JS
|
|
8
|
+
* with a new Web integration tool.
|
|
9
|
+
*
|
|
10
|
+
* @group Models
|
|
11
|
+
*/
|
|
12
|
+
class BrowsingSession {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.pages = new Map();
|
|
15
|
+
}
|
|
16
|
+
async closePagesOtherThan(pageOfInterest) {
|
|
17
|
+
for (const page of await this.allPages()) {
|
|
18
|
+
if (!page.id.equals(pageOfInterest.id)) {
|
|
19
|
+
await page.close();
|
|
20
|
+
this.pages.delete(page.id);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
await this.changeCurrentPageTo(pageOfInterest);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns a {@apilink Page} representing the currently active top-level browsing context.
|
|
27
|
+
*/
|
|
28
|
+
async currentPage() {
|
|
29
|
+
if (!this.currentBrowserPage || !await this.currentBrowserPage.isPresent()) {
|
|
30
|
+
this.currentBrowserPage = await this.registerCurrentPage();
|
|
31
|
+
}
|
|
32
|
+
return this.currentBrowserPage;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Registers specified {@apilink Page|pages} to be managed by this {@apilink BrowsingSession}.
|
|
36
|
+
*
|
|
37
|
+
* @param pages
|
|
38
|
+
*/
|
|
39
|
+
register(...pages) {
|
|
40
|
+
for (const page of pages) {
|
|
41
|
+
this.pages.set(page.id, page);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Informs this {@apilink BrowsingSession} that it should no longer manage {@apilink Page|pages}
|
|
46
|
+
* identified by the given `pageIds`.
|
|
47
|
+
*
|
|
48
|
+
* @param pageIds
|
|
49
|
+
*/
|
|
50
|
+
deregister(...pageIds) {
|
|
51
|
+
for (const pageId of pageIds) {
|
|
52
|
+
this.pages.delete(pageId);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Returns a {@apilink Page|pages} representing all the available
|
|
57
|
+
* top-level browsing context, e.g. all the open browser tabs.
|
|
58
|
+
*/
|
|
59
|
+
async allPages() {
|
|
60
|
+
return Array.from(this.pages.values());
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Returns the ids of any {@apilink Page|pages} this {@apilink BrowsingSession} is aware of.
|
|
64
|
+
*/
|
|
65
|
+
registeredPageIds() {
|
|
66
|
+
return Array.from(this.pages.keys());
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Informs the {@apilink BrowsingSession} that the "current page" has changed to `page`.
|
|
70
|
+
*
|
|
71
|
+
* Please note that different Web integration tools have a different definition of what a "current page" is.
|
|
72
|
+
* For example, Selenium or WebdriverIO use a single "focused" window that a developer
|
|
73
|
+
* needs to explicitly "switch to" in their tests in order to interact with it.
|
|
74
|
+
* This is similar to how a regular user would interact with Web pages;
|
|
75
|
+
* switching from one tab to another, but not interacting with more than one
|
|
76
|
+
* window/tab simultaneously.
|
|
77
|
+
*
|
|
78
|
+
* Playwright and Puppeteer, on the other hand, don't have a concept of the "current" page at all, since they
|
|
79
|
+
* allow the developer to interact with multiple open tabs/windows at the same time.
|
|
80
|
+
*
|
|
81
|
+
* Web integration-specific implementations of this class should override this method to define
|
|
82
|
+
* how the concept of the "current page" should be interpreted by Serenity/JS.
|
|
83
|
+
*
|
|
84
|
+
* @param page
|
|
85
|
+
*/
|
|
86
|
+
async changeCurrentPageTo(page) {
|
|
87
|
+
this.currentBrowserPage = page;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Closes all the pages available in this browsing context
|
|
91
|
+
*/
|
|
92
|
+
async closeAllPages() {
|
|
93
|
+
for (const page of this.pages.values()) {
|
|
94
|
+
await page.close();
|
|
95
|
+
}
|
|
96
|
+
this.pages.clear();
|
|
97
|
+
this.currentBrowserPage = undefined;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.BrowsingSession = BrowsingSession;
|
|
101
|
+
//# sourceMappingURL=BrowsingSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowsingSession.js","sourceRoot":"","sources":["../../../src/screenplay/models/BrowsingSession.ts"],"names":[],"mappings":";;;AAIA;;;;;;;GAOG;AACH,MAAsB,eAAe;IAArC;QAEuB,UAAK,GAAkC,IAAI,GAAG,EAA4B,CAAC;IAoGlG,CAAC;IAlGG,KAAK,CAAC,mBAAmB,CAAC,cAAyB;QAC/C,KAAK,MAAM,IAAI,IAAI,MAAM,IAAI,CAAC,QAAQ,EAAE,EAAE;YACtC,IAAI,CAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE;gBACrC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;gBACnB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;aAC9B;SACJ;QAED,MAAM,IAAI,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;IACnD,CAAC;IAOD;;OAEG;IACH,KAAK,CAAC,WAAW;QACb,IAAI,CAAE,IAAI,CAAC,kBAAkB,IAAI,CAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,EAAE;YAC1E,IAAI,CAAC,kBAAkB,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;SAC9D;QAED,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,GAAG,KAAkB;QAC1B,KAAI,MAAM,IAAI,IAAI,KAAK,EAAE;YACrB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;SACjC;IACL,CAAC;IAED;;;;;OAKG;IACH,UAAU,CAAC,GAAG,OAAwB;QAClC,KAAI,MAAM,MAAM,IAAI,OAAO,EAAE;YACzB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SAC7B;IACL,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAQ;QACV,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAgB,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,iBAAiB;QACb,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,mBAAmB,CAAC,IAAe;QACrC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa;QACf,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE;YACpC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;SACtB;QAED,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;IACxC,CAAC;CACJ;AAtGD,0CAsGC"}
|