@serenity-js/web 3.0.0-rc.9 → 3.0.1
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 +337 -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,108 +0,0 @@
|
|
|
1
|
-
import { Answerable, AnswersQuestions, Expectation, ExpectationMet, ExpectationNotMet } from '@serenity-js/core';
|
|
2
|
-
|
|
3
|
-
import { PageElement } from '../screenplay';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @desc
|
|
7
|
-
* A convenience method to create a custom {@link PageElement}-related {@link @serenity-js/core/lib/screenplay/questions~Expectation}
|
|
8
|
-
*
|
|
9
|
-
* @example <caption>Defining an expectation</caption>
|
|
10
|
-
* import { Expectation } from '@serenity-js/core';
|
|
11
|
-
* import { ElementExpectation, PageElement } from '@serenity-js/web';
|
|
12
|
-
*
|
|
13
|
-
* export function isPresent(): Expectation<boolean, PageElement> {
|
|
14
|
-
* return ElementExpectation.forElementTo('become present', actual => actual.isPresent());
|
|
15
|
-
* }
|
|
16
|
-
*
|
|
17
|
-
* @example <caption>Using an expectation in an assertion</caption>
|
|
18
|
-
* import { Ensure } from '@serenity-js/assertions';
|
|
19
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
20
|
-
* import { By, PageElement } from '@serenity-js/web';
|
|
21
|
-
*
|
|
22
|
-
* const submitButton = () =>
|
|
23
|
-
* PageElement.located(By.css('.submit')).describedAs('submit button');
|
|
24
|
-
*
|
|
25
|
-
* actorCalled('Izzy').attemptsTo(
|
|
26
|
-
* Ensure.that(submitButton(), isPresent())
|
|
27
|
-
* );
|
|
28
|
-
*
|
|
29
|
-
* @example <caption>Using an expectation in a synchronisation statement</caption>
|
|
30
|
-
* import { actorCalled, Duration } from '@serenity-js/core';
|
|
31
|
-
* import { By, PageElement, Wait } from '@serenity-js/web';
|
|
32
|
-
*
|
|
33
|
-
* const submitButton = () =>
|
|
34
|
-
* PageElement.located(By.css('.submit')).describedAs('submit button');
|
|
35
|
-
*
|
|
36
|
-
* actorCalled('Izzy').attemptsTo(
|
|
37
|
-
* Wait.upTo(Duration.ofSeconds(2)).until(submitButton(), isPresent())
|
|
38
|
-
* );
|
|
39
|
-
*
|
|
40
|
-
* @public
|
|
41
|
-
* @extends {@serenity-js/core/lib/screenplay/questions~Expectation}
|
|
42
|
-
*/
|
|
43
|
-
export class ElementExpectation extends Expectation<PageElement> {
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @desc
|
|
47
|
-
* Creates an {@link @serenity-js/core/lib/screenplay/questions~Expectation}
|
|
48
|
-
*
|
|
49
|
-
* @example <caption>Defining an expectation</caption>
|
|
50
|
-
* import { Expectation } from '@serenity-js/core';
|
|
51
|
-
* import { ElementExpectation, PageElement } from '@serenity-js/web';
|
|
52
|
-
*
|
|
53
|
-
* export function isPresent(): Expectation<boolean, PageElement> {
|
|
54
|
-
* return ElementExpectation.forElementTo('become present', actual => actual.isPresent());
|
|
55
|
-
* }
|
|
56
|
-
*
|
|
57
|
-
* @param {string} description
|
|
58
|
-
* A description of the expectation.
|
|
59
|
-
* Please note that Serenity/JS will use it to describe your expectation in sentences like these:
|
|
60
|
-
* - `actor ensures that <something> does <description>`
|
|
61
|
-
* - `actor ensures that <something> does not <description>`
|
|
62
|
-
* - `actor waits until <something> does <description>`
|
|
63
|
-
* - `actor waits until <something> does not <description>`
|
|
64
|
-
*
|
|
65
|
-
* To work with the above templates, the description should be similar to
|
|
66
|
-
* - `become present`,
|
|
67
|
-
* - `become active`,
|
|
68
|
-
* - `equal X`,
|
|
69
|
-
* - `has value greater than Y`.
|
|
70
|
-
*
|
|
71
|
-
* Descriptions like "is present", "is active", "equals X", "is greater than Y" WILL NOT work well.
|
|
72
|
-
*
|
|
73
|
-
* @param {function(actual: PageElement): Promise<boolean>} fn
|
|
74
|
-
* An asynchronous callback function that receives a {@link PageElement} and returns a {@link Promise}
|
|
75
|
-
* that should resolve to `true` when the expectation is met, and `false` otherwise.
|
|
76
|
-
*
|
|
77
|
-
* @returns {ElementExpectation<any, PageElement>}
|
|
78
|
-
*/
|
|
79
|
-
static forElementTo(description: string, fn: (actual: PageElement) => Promise<boolean>): Expectation<PageElement> {
|
|
80
|
-
return new ElementExpectation(description, fn);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* @param {string} description
|
|
85
|
-
* @param {function(actual: PageElement): Promise<boolean>} fn
|
|
86
|
-
*/
|
|
87
|
-
constructor(
|
|
88
|
-
description: string,
|
|
89
|
-
private readonly fn: (actual: PageElement) => Promise<boolean>,
|
|
90
|
-
) {
|
|
91
|
-
super(
|
|
92
|
-
description,
|
|
93
|
-
async (actor: AnswersQuestions, actual: Answerable<PageElement>) => {
|
|
94
|
-
const pageElement = await actor.answer(actual);
|
|
95
|
-
|
|
96
|
-
try {
|
|
97
|
-
const result = await fn(pageElement);
|
|
98
|
-
|
|
99
|
-
return result
|
|
100
|
-
? new ExpectationMet(this.toString(), undefined, pageElement)
|
|
101
|
-
: new ExpectationNotMet(this.toString(), undefined, pageElement);
|
|
102
|
-
} catch(error) {
|
|
103
|
-
return new ExpectationNotMet(`${ description } (${ error.message })`, undefined, pageElement);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
}
|
package/src/input/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Key';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Answerable, Interaction } from '@serenity-js/core';
|
|
2
|
-
|
|
3
|
-
import { PageElement } from '../models';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @desc
|
|
7
|
-
* Fluent interface to make the instantiation of
|
|
8
|
-
* the {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
9
|
-
* to {@link Enter} more readable.
|
|
10
|
-
*
|
|
11
|
-
* @see {@link Enter}
|
|
12
|
-
*
|
|
13
|
-
* @interface
|
|
14
|
-
*/
|
|
15
|
-
export interface EnterBuilder {
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @desc
|
|
19
|
-
* Instantiates an {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
20
|
-
* to {@link Enter}.
|
|
21
|
-
*
|
|
22
|
-
* @param {Answerable<PageElement>} field
|
|
23
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
24
|
-
*
|
|
25
|
-
* @see {@link Target}
|
|
26
|
-
*/
|
|
27
|
-
into: (field: Answerable<PageElement> /* | Question<AlertPromise> | AlertPromise */) => Interaction;
|
|
28
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Answerable } from '@serenity-js/core';
|
|
2
|
-
import { Interaction } from '@serenity-js/core/lib/screenplay';
|
|
3
|
-
|
|
4
|
-
import { PageElement } from '../models';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* Fluent interface to make the instantiation of
|
|
9
|
-
* the {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
10
|
-
* to {@link Press} more readable.
|
|
11
|
-
*
|
|
12
|
-
* @see {@link Press}
|
|
13
|
-
*
|
|
14
|
-
* @interface
|
|
15
|
-
*/
|
|
16
|
-
export interface PressBuilder {
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @desc
|
|
20
|
-
* Instantiates an {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
21
|
-
* to {@link Press}.
|
|
22
|
-
*
|
|
23
|
-
* @param {Answerable<PageElement>} field
|
|
24
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
25
|
-
*
|
|
26
|
-
* @see {@link Target}
|
|
27
|
-
*/
|
|
28
|
-
in: (field: Answerable<PageElement> /* | Question<AlertPromise> | AlertPromise */) => Interaction;
|
|
29
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Answerable } from '@serenity-js/core';
|
|
2
|
-
import { Interaction } from '@serenity-js/core/lib/screenplay';
|
|
3
|
-
|
|
4
|
-
import { PageElement } from '../models';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* Configures the {@link Target} representing
|
|
9
|
-
* a [HTML `<select>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select)
|
|
10
|
-
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
11
|
-
* to interact with.
|
|
12
|
-
*
|
|
13
|
-
* @interface
|
|
14
|
-
*/
|
|
15
|
-
export interface SelectBuilder {
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @desc
|
|
19
|
-
* Configures the {@link Target} representing
|
|
20
|
-
* a [HTML `<select>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select)
|
|
21
|
-
* for the {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
22
|
-
* to interact with
|
|
23
|
-
*
|
|
24
|
-
* @param {Answerable<PageElement>} pageElement
|
|
25
|
-
*
|
|
26
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
27
|
-
*
|
|
28
|
-
* @see {@link Select}
|
|
29
|
-
* @see {@link Select.option}
|
|
30
|
-
* @see {@link Select.options}
|
|
31
|
-
* @see {@link Select.value}
|
|
32
|
-
* @see {@link Select.values}
|
|
33
|
-
* @see {@link Target}
|
|
34
|
-
*/
|
|
35
|
-
from: (pageElement: Answerable<PageElement>) => Interaction;
|
|
36
|
-
}
|
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
import { Answerable, AnswersQuestions, AssertionError, Duration, Expectation, ExpectationMet, ExpectationOutcome, Interaction, UsesAbilities } from '@serenity-js/core';
|
|
2
|
-
import { formatted } from '@serenity-js/core/lib/io';
|
|
3
|
-
|
|
4
|
-
import { BrowseTheWeb } from '../abilities';
|
|
5
|
-
import { WaitBuilder } from './WaitBuilder';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @desc
|
|
9
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
10
|
-
* wait before proceeding either for a set {@link @serenity-js/core/lib/model~Duration}
|
|
11
|
-
* or until a given {@link @serenity-js/core/lib/screenplay/questions~Expectation} is met.
|
|
12
|
-
*
|
|
13
|
-
* Under the hood, `Wait` uses WebdriverIO ["explicit waiting"](https://webdriver.io/docs/autowait/)
|
|
14
|
-
* mechanism.
|
|
15
|
-
*
|
|
16
|
-
* @example <caption>Example widget</caption>
|
|
17
|
-
* <!--
|
|
18
|
-
* After about 1 second, the text will change from 'Loading...' to 'Ready!'
|
|
19
|
-
* -->
|
|
20
|
-
* <h1 id="status">Loading...</h1>
|
|
21
|
-
* <script>
|
|
22
|
-
* (function () {
|
|
23
|
-
* setTimeout(function () {
|
|
24
|
-
* document.getElementById('status').textContent = 'Ready!'
|
|
25
|
-
* }, 1000);
|
|
26
|
-
* })();
|
|
27
|
-
* </script>
|
|
28
|
-
*
|
|
29
|
-
* @example <caption>Lean Page Object describing the widget</caption>
|
|
30
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
31
|
-
*
|
|
32
|
-
* class App {
|
|
33
|
-
* static status = Target.the('status widget')
|
|
34
|
-
* .located(by.id('status'));
|
|
35
|
-
* }
|
|
36
|
-
*
|
|
37
|
-
* @example <caption>Waiting for a set amount of time</caption>
|
|
38
|
-
* import { actorCalled, Duration } from '@serenity-js/core';
|
|
39
|
-
* import { BrowseTheWeb, Wait } from '@serenity-js/webdriverio';
|
|
40
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
41
|
-
*
|
|
42
|
-
* actorCalled('Wendy')
|
|
43
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
44
|
-
* .attemptsTo(
|
|
45
|
-
* Wait.for(Duration.ofSeconds(1.5)),
|
|
46
|
-
* Ensure.that(App.status, equals('Ready!')),
|
|
47
|
-
* );
|
|
48
|
-
*
|
|
49
|
-
* // Please note that while the above implementation works,
|
|
50
|
-
* // this approach is inefficient because at best
|
|
51
|
-
* // the actor might wait too long and at worst the test
|
|
52
|
-
* // might become "flaky" if any external interference
|
|
53
|
-
* // (like network glitches, animations taking a bit too long etc.)
|
|
54
|
-
* // makes the actor wait not long enough.
|
|
55
|
-
*
|
|
56
|
-
* @example <caption>Waiting until a condition is met</caption>
|
|
57
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
58
|
-
* import { BrowseTheWeb, Wait, Text } from '@serenity-js/webdriverio';
|
|
59
|
-
* import { equals } from '@serenity-js/assertions';
|
|
60
|
-
*
|
|
61
|
-
* actorCalled('Wendy')
|
|
62
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
63
|
-
* .attemptsTo(
|
|
64
|
-
* Wait.until(Text.of(App.status), equals('Ready!')),
|
|
65
|
-
* // app is ready, proceed with the scenario
|
|
66
|
-
* );
|
|
67
|
-
*
|
|
68
|
-
* // Wait.until makes the Actor keep asking a Question,
|
|
69
|
-
* // in this case Text.of(App.status), until the answer meets
|
|
70
|
-
* // the expectation, or a timeout expires (default: 5s).
|
|
71
|
-
* //
|
|
72
|
-
* // Please note that both Ensure and Wait can be used with
|
|
73
|
-
* // the same expectations, like `equals`.
|
|
74
|
-
*
|
|
75
|
-
* @example <caption>Changing the default timeout</caption>
|
|
76
|
-
* import { actorCalled, Duration } from '@serenity-js/core';
|
|
77
|
-
* import { BrowseTheWeb, Wait, Text } from '@serenity-js/webdriverio';
|
|
78
|
-
* import { equals } from '@serenity-js/assertions';
|
|
79
|
-
*
|
|
80
|
-
* actorCalled('Wendy')
|
|
81
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
82
|
-
* .attemptsTo(
|
|
83
|
-
* Wait.upTo(Duration.ofSeconds(3))
|
|
84
|
-
* .until(Text.of(App.status), equals('Ready!')),
|
|
85
|
-
* // app is ready, proceed with the scenario
|
|
86
|
-
* );
|
|
87
|
-
*
|
|
88
|
-
* @see {@link BrowseTheWeb}
|
|
89
|
-
* @see {@link Target}
|
|
90
|
-
* @see {@link Text}
|
|
91
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
92
|
-
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
93
|
-
* @see {@link @serenity-js/core/lib/model~Duration}
|
|
94
|
-
*
|
|
95
|
-
* @see {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
96
|
-
*/
|
|
97
|
-
export class Wait {
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* @desc
|
|
101
|
-
* Default timeout of 5 seconds used with {@link Wait.until}.
|
|
102
|
-
*
|
|
103
|
-
* @type {@serenity-js/core~Duration}
|
|
104
|
-
*/
|
|
105
|
-
static readonly Default_Timeout = Duration.ofSeconds(5);
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @desc
|
|
109
|
-
* Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
110
|
-
* configured to wait for a set duration.
|
|
111
|
-
*
|
|
112
|
-
* @param {Answerable<Duration>} duration
|
|
113
|
-
* A set duration the {@link @serenity-js/core/lib/screenplay/actor~Actor} should wait for
|
|
114
|
-
* before proceeding
|
|
115
|
-
*
|
|
116
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
117
|
-
*/
|
|
118
|
-
static for(duration: Answerable<Duration>): Interaction {
|
|
119
|
-
return new WaitFor(duration);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* @desc
|
|
124
|
-
* Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
125
|
-
* configured to wait until the answer to the question (`actual`) meets the `expectation`,
|
|
126
|
-
* or a custom timeout expires.
|
|
127
|
-
*
|
|
128
|
-
* @param {Duration} duration
|
|
129
|
-
* Custom timeout to override {@link Wait.Default_Timeout}
|
|
130
|
-
*
|
|
131
|
-
* @returns {WaitBuilder}
|
|
132
|
-
*/
|
|
133
|
-
static upTo(duration: Duration): WaitBuilder {
|
|
134
|
-
return {
|
|
135
|
-
until: <Actual>(actual: Answerable<Actual>, expectation: Expectation<Actual>): Interaction =>
|
|
136
|
-
new WaitUntil(actual, expectation, duration),
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* @desc
|
|
142
|
-
* Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
143
|
-
* configured to wait until the answer to the question (`actual`) meets the `expectation`,
|
|
144
|
-
* or a {@link Wait.Default_Timeout} expires.
|
|
145
|
-
*
|
|
146
|
-
* @param {Answerable<Actual>} actual
|
|
147
|
-
* A {@link @serenity-js/core/lib/screenplay~Question}
|
|
148
|
-
* that the {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
149
|
-
* will keep asking until the answer meets
|
|
150
|
-
* the {@link @serenity-js/core/lib/screenplay/questions~Expectation} provided
|
|
151
|
-
*
|
|
152
|
-
* @param {@serenity-js/core/lib/screenplay/questions~<any,Actual>} expectation
|
|
153
|
-
* An {@link @serenity-js/core/lib/screenplay/questions~Expectation} to be met before proceeding
|
|
154
|
-
*
|
|
155
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
156
|
-
*/
|
|
157
|
-
static until<Actual>(actual: Answerable<Actual>, expectation: Expectation<Actual>): Interaction {
|
|
158
|
-
return new WaitUntil(actual, expectation, Wait.Default_Timeout);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* @package
|
|
164
|
-
*/
|
|
165
|
-
class WaitFor extends Interaction {
|
|
166
|
-
constructor(private readonly duration: Answerable<Duration>) {
|
|
167
|
-
super();
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* @desc
|
|
172
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
173
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
174
|
-
*
|
|
175
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
176
|
-
* @returns {Promise<void>}
|
|
177
|
-
*
|
|
178
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
179
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
180
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
181
|
-
*/
|
|
182
|
-
async performAs(actor: UsesAbilities & AnswersQuestions): Promise<void> {
|
|
183
|
-
return actor.answer(this.duration)
|
|
184
|
-
.then(duration => BrowseTheWeb.as(actor).waitFor(duration));
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* @desc
|
|
189
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
190
|
-
*
|
|
191
|
-
* @returns {string}
|
|
192
|
-
*/
|
|
193
|
-
toString(): string {
|
|
194
|
-
return formatted`#actor waits for ${ this.duration }`;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* @package
|
|
200
|
-
*/
|
|
201
|
-
class WaitUntil<Actual> extends Interaction {
|
|
202
|
-
constructor(
|
|
203
|
-
private readonly actual: Answerable<Actual>,
|
|
204
|
-
private readonly expectation: Expectation<Actual>,
|
|
205
|
-
private readonly timeout: Duration,
|
|
206
|
-
) {
|
|
207
|
-
super();
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* @desc
|
|
212
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
213
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
214
|
-
*
|
|
215
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
216
|
-
* @returns {Promise<void>}
|
|
217
|
-
*
|
|
218
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
219
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
220
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
221
|
-
*/
|
|
222
|
-
performAs(actor: UsesAbilities & AnswersQuestions): PromiseLike<void> {
|
|
223
|
-
const
|
|
224
|
-
actual = this.actual,
|
|
225
|
-
expectation = this.expectation;
|
|
226
|
-
|
|
227
|
-
let expectationOutcome: ExpectationOutcome<any, Actual>;
|
|
228
|
-
|
|
229
|
-
return BrowseTheWeb.as(actor)
|
|
230
|
-
.waitUntil(
|
|
231
|
-
async function () {
|
|
232
|
-
expectationOutcome = await actor.answer(expectation.isMetFor(actual));
|
|
233
|
-
return expectationOutcome instanceof ExpectationMet;
|
|
234
|
-
},
|
|
235
|
-
this.timeout
|
|
236
|
-
)
|
|
237
|
-
.catch(error => {
|
|
238
|
-
if (expectationOutcome) {
|
|
239
|
-
throw new AssertionError(
|
|
240
|
-
`Waited ${ this.timeout.toString() } for ${ formatted `${ this.actual }` } to ${ this.expectation.toString() }`,
|
|
241
|
-
expectationOutcome.expected,
|
|
242
|
-
expectationOutcome.actual,
|
|
243
|
-
error,
|
|
244
|
-
);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
throw error;
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* @desc
|
|
253
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
254
|
-
*
|
|
255
|
-
* @returns {string}
|
|
256
|
-
*/
|
|
257
|
-
toString(): string {
|
|
258
|
-
return formatted`#actor waits up to ${ this.timeout } until ${ this.actual } does ${ this.expectation }`;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Answerable, Expectation, Interaction } from '@serenity-js/core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* Fluent interface to make the instantiation of
|
|
6
|
-
* the {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
7
|
-
* to {@link Wait} more readable.
|
|
8
|
-
*
|
|
9
|
-
* @see {@link Wait}
|
|
10
|
-
*
|
|
11
|
-
* @interface
|
|
12
|
-
*/
|
|
13
|
-
export interface WaitBuilder {
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @desc
|
|
17
|
-
* Instantiates an {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
18
|
-
* to {@link Wait}.
|
|
19
|
-
*
|
|
20
|
-
* @param {Answerable<Actual>} actual
|
|
21
|
-
* A {@link @serenity-js/core/lib/screenplay~Question}
|
|
22
|
-
* that the {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
23
|
-
* will keep asking until the answer meets
|
|
24
|
-
* the {@link @serenity-js/core/lib/screenplay/questions~Expectation} provided
|
|
25
|
-
*
|
|
26
|
-
* @param {@serenity-js/core/lib/screenplay/questions~Expectation<any,Actual>} expectation
|
|
27
|
-
* An {@link @serenity-js/assertions~Expectation} to be met before proceeding
|
|
28
|
-
*
|
|
29
|
-
* @returns {Interaction}
|
|
30
|
-
*
|
|
31
|
-
* @see {@link Target}
|
|
32
|
-
*/
|
|
33
|
-
until: <Actual>(actual: Answerable<Actual>, expectation: Expectation<Actual>) => Interaction;
|
|
34
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Optional, Question, QuestionAdapter } from '@serenity-js/core';
|
|
2
|
-
|
|
3
|
-
import { BrowseTheWeb } from '../abilities';
|
|
4
|
-
|
|
5
|
-
export abstract class ModalDialog implements Optional {
|
|
6
|
-
static window(): QuestionAdapter<ModalDialog> {
|
|
7
|
-
return Question.about<ModalDialog>('modal dialog', actor => {
|
|
8
|
-
return BrowseTheWeb.as(actor).modalDialog();
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
abstract accept(): Promise<void>;
|
|
13
|
-
abstract dismiss(): Promise<void>;
|
|
14
|
-
|
|
15
|
-
abstract text(): Promise<string>;
|
|
16
|
-
abstract enterValue(value: string | number | Array<string | number>): Promise<void>;
|
|
17
|
-
|
|
18
|
-
abstract isPresent(): Promise<boolean>;
|
|
19
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Answerable, AnswersQuestions, LogicError, Question } from '@serenity-js/core';
|
|
2
|
-
import { formatted } from '@serenity-js/core/lib/io';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @desc
|
|
6
|
-
* A base class for questions about {@link PageElement}s.
|
|
7
|
-
*
|
|
8
|
-
* @extends {@serenity-js/core/lib/screenplay~Question}
|
|
9
|
-
*/
|
|
10
|
-
// todo: remove
|
|
11
|
-
export abstract class ElementQuestion<T>
|
|
12
|
-
extends Question<T>
|
|
13
|
-
{
|
|
14
|
-
constructor(protected subject: string) {
|
|
15
|
-
super();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @desc
|
|
20
|
-
* Changes the description of this question's subject.
|
|
21
|
-
*
|
|
22
|
-
* @param {string} subject
|
|
23
|
-
* @returns {Question<T>}
|
|
24
|
-
*/
|
|
25
|
-
describedAs(subject: string): this {
|
|
26
|
-
this.subject = subject;
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
toString(): string {
|
|
31
|
-
return this.subject;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @desc
|
|
36
|
-
* Returns the resolved {@link PageElement}, or throws a {@link @serenity-js/core/lib/errors~LogicError}
|
|
37
|
-
* if the element is `undefined`.
|
|
38
|
-
*
|
|
39
|
-
* @param {@serenity-js/core/lib/screenplay/actor~AnswersQuestions} actor
|
|
40
|
-
* @param {@serenity-js/core/lib/screenplay~Answerable<Element|ElementList>} element
|
|
41
|
-
*
|
|
42
|
-
* @returns {Promise<PageElement|PageElements>}
|
|
43
|
-
*
|
|
44
|
-
* @protected
|
|
45
|
-
*/
|
|
46
|
-
protected async resolve<T>(
|
|
47
|
-
actor: AnswersQuestions,
|
|
48
|
-
element: Answerable<T>,
|
|
49
|
-
): Promise<T> {
|
|
50
|
-
const resolved = await actor.answer(element);
|
|
51
|
-
|
|
52
|
-
if (! resolved) {
|
|
53
|
-
throw new LogicError(formatted `Couldn't find ${ element }`);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return resolved;
|
|
57
|
-
}
|
|
58
|
-
}
|
package/tsconfig.eslint.json
DELETED
|
File without changes
|