From dbfc7c6cf2b28b80b300a1919e91af2384c55fa2 Mon Sep 17 00:00:00 2001 From: Wasiq Bhamla Date: Sat, 28 Dec 2024 19:24:14 +0300 Subject: [PATCH] feat(java): :zap: updated mouse related actions (#959) --- .../boykaframework/actions/CommonActions.java | 2 +- .../actions/elements/ClickableActions.java | 110 +++++++++------- .../actions/elements/MouseActionBuilder.java | 118 ++++++++++++++++++ .../elements/IClickableActions.java | 15 +++ .../elements/IClickableActionsListener.java | 23 ++++ package.json | 2 +- pnpm-lock.yaml | 111 +++++++++------- .../api/actions/elements/clickable-actions.md | 30 +++++ 8 files changed, 317 insertions(+), 94 deletions(-) create mode 100644 core-java/src/main/java/io/github/boykaframework/actions/elements/MouseActionBuilder.java diff --git a/core-java/src/main/java/io/github/boykaframework/actions/CommonActions.java b/core-java/src/main/java/io/github/boykaframework/actions/CommonActions.java index 79d6f570f..1355ae808 100644 --- a/core-java/src/main/java/io/github/boykaframework/actions/CommonActions.java +++ b/core-java/src/main/java/io/github/boykaframework/actions/CommonActions.java @@ -179,7 +179,7 @@ public static void performMobileGestures (final Collection sequences) private static void highlight (final String color, final WebElement element) { if (getSession ().getWebSetting () .isHighlight ()) { - final var style = element.getAttribute ("style"); + final var style = element.getDomAttribute ("style"); getSession ().setSharedData (HIGHLIGHT_STYLE, style); withDriver ().executeScript ("arguments[0].setAttribute('style', arguments[1] + arguments[2]);", element, style, format ("color: {0}; border: 3px solid {0};", color)); diff --git a/core-java/src/main/java/io/github/boykaframework/actions/elements/ClickableActions.java b/core-java/src/main/java/io/github/boykaframework/actions/elements/ClickableActions.java index 953ea5f9f..ff142bdc9 100644 --- a/core-java/src/main/java/io/github/boykaframework/actions/elements/ClickableActions.java +++ b/core-java/src/main/java/io/github/boykaframework/actions/elements/ClickableActions.java @@ -18,23 +18,18 @@ import static io.github.boykaframework.actions.CommonActions.pause; import static io.github.boykaframework.actions.CommonActions.performElementAction; -import static io.github.boykaframework.actions.elements.ElementFinder.find; -import static io.github.boykaframework.enums.ApplicationType.WEB; +import static io.github.boykaframework.actions.CommonActions.performMobileGestures; import static io.github.boykaframework.enums.ListenerType.CLICKABLE_ACTION; -import static io.github.boykaframework.enums.PlatformType.IOS; -import static io.github.boykaframework.enums.WaitStrategy.CLICKABLE; import static io.github.boykaframework.manager.ParallelSession.getSession; -import static io.github.boykaframework.utils.Validator.validateDelay; +import static java.util.Collections.singletonList; import static java.util.Optional.ofNullable; import static org.apache.logging.log4j.LogManager.getLogger; import io.github.boykaframework.actions.interfaces.elements.IClickableActions; import io.github.boykaframework.actions.interfaces.listeners.elements.IClickableActionsListener; import io.github.boykaframework.builders.Locator; -import io.github.boykaframework.enums.PlatformType; import org.apache.logging.log4j.Logger; import org.openqa.selenium.WebElement; -import org.openqa.selenium.interactions.Actions; /** * Handles all mouse related actions @@ -68,16 +63,11 @@ public void click () { LOGGER.traceEntry (); LOGGER.info ("Clicking on element: {}", this.locator.getName ()); ofNullable (this.listener).ifPresent (l -> l.onClick (this.locator)); - final var session = getSession (); - if (session.getPlatformType () == PlatformType.WEB || (session.getMobileSetting () - .getDevice () - .getApplication () - .getType () == WEB && session.getPlatformType () == IOS)) { - pause (this.delaySetting.getBeforeClick ()); - performElementAction (WebElement::click, this.locator); - } else { - tap (); - } + pause (this.delaySetting.getBeforeClick ()); + MouseActionBuilder.builder () + .sourceLocator (this.locator) + .build () + .click (); LOGGER.traceExit (); } @@ -86,12 +76,10 @@ public void clickAndHold () { LOGGER.traceEntry (); LOGGER.info ("Click and hold on element: {}", this.locator.getName ()); ofNullable (this.listener).ifPresent (l -> l.onClickAndHold (this.locator)); - performElementAction ((driver, element) -> { - final var actions = new Actions (driver); - actions.pause (validateDelay (this.delaySetting.getBeforeClick ())) - .clickAndHold (element) - .perform (); - }, this.locator); + MouseActionBuilder.builder () + .sourceLocator (this.locator) + .build () + .clickAndHold (); LOGGER.traceExit (); } @@ -100,12 +88,10 @@ public void doubleClick () { LOGGER.traceEntry (); LOGGER.info ("Double Click on element: {}", this.locator.getName ()); ofNullable (this.listener).ifPresent (l -> l.onDoubleClick (this.locator)); - performElementAction ((driver, element) -> { - final var actions = new Actions (driver); - actions.pause (validateDelay (this.delaySetting.getBeforeClick ())) - .doubleClick (element) - .perform (); - }, this.locator); + MouseActionBuilder.builder () + .sourceLocator (this.locator) + .build () + .doubleClick (); LOGGER.traceExit (); } @@ -114,12 +100,10 @@ public void dragTo (final Locator destination) { LOGGER.traceEntry (); LOGGER.info ("Drag and Drop on element: {} , {}", this.locator.getName (), destination.getName ()); ofNullable (this.listener).ifPresent (l -> l.onDragTo (this.locator, destination)); - performElementAction ((driver, element) -> { - final var actions = new Actions (driver); - actions.pause (validateDelay (this.delaySetting.getBeforeMouseMove ())) - .dragAndDrop (element, find (destination, CLICKABLE)) - .perform (); - }, this.locator); + MouseActionBuilder.builder () + .sourceLocator (this.locator) + .build () + .dragAndDrop (destination); LOGGER.traceExit (); } @@ -128,12 +112,34 @@ public void hover () { LOGGER.traceEntry (); LOGGER.info ("Hover on element: {}", this.locator.getName ()); ofNullable (this.listener).ifPresent (l -> l.onHover (this.locator)); - performElementAction ((driver, element) -> { - final var actions = new Actions (driver); - actions.pause (validateDelay (this.delaySetting.getBeforeMouseMove ())) - .moveToElement (element) - .perform (); - }, this.locator); + MouseActionBuilder.builder () + .sourceLocator (this.locator) + .build () + .moveTo (); + LOGGER.traceExit (); + } + + @Override + public void pressBackButton () { + LOGGER.traceEntry (); + LOGGER.info ("Pressing the Mouse Back button..."); + ofNullable (this.listener).ifPresent (IClickableActionsListener::onPressBackButton); + final var sequence = MouseActionBuilder.builder () + .build () + .backButtonClick (); + performMobileGestures (singletonList (sequence)); + LOGGER.traceExit (); + } + + @Override + public void pressForwardButton () { + LOGGER.traceEntry (); + LOGGER.info ("Pressing the Mouse Forward button..."); + ofNullable (this.listener).ifPresent (IClickableActionsListener::onPressForwardButton); + final var sequence = MouseActionBuilder.builder () + .build () + .forwardButtonClick (); + performMobileGestures (singletonList (sequence)); LOGGER.traceExit (); } @@ -142,12 +148,22 @@ public void rightClick () { LOGGER.traceEntry (); LOGGER.info ("Right Click on element: {}", this.locator.getName ()); ofNullable (this.listener).ifPresent (l -> l.onRightClick (this.locator)); - performElementAction ((driver, element) -> { - final var actions = new Actions (driver); - actions.pause (validateDelay (this.delaySetting.getBeforeClick ())) - .contextClick (element) - .perform (); - }, this.locator); + MouseActionBuilder.builder () + .sourceLocator (this.locator) + .build () + .rightClick (); + LOGGER.traceExit (); + } + + @Override + public void scrollToElement () { + LOGGER.traceEntry (); + LOGGER.info ("Scrolling to element: {}", this.locator.getName ()); + ofNullable (this.listener).ifPresent (l -> l.onScrollToElement (this.locator)); + MouseActionBuilder.builder () + .sourceLocator (this.locator) + .build () + .scrollTo (); LOGGER.traceExit (); } diff --git a/core-java/src/main/java/io/github/boykaframework/actions/elements/MouseActionBuilder.java b/core-java/src/main/java/io/github/boykaframework/actions/elements/MouseActionBuilder.java new file mode 100644 index 000000000..59eeb5839 --- /dev/null +++ b/core-java/src/main/java/io/github/boykaframework/actions/elements/MouseActionBuilder.java @@ -0,0 +1,118 @@ +/* + * MIT License + * + * Copyright (c) 2024, Boyka Framework + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + */ + +package io.github.boykaframework.actions.elements; + +import static io.github.boykaframework.actions.CommonActions.performDriverAction; +import static io.github.boykaframework.actions.CommonActions.performElementAction; +import static io.github.boykaframework.actions.elements.ElementFinder.find; +import static io.github.boykaframework.enums.Message.ELEMENT_CANNOT_BE_NULL; +import static io.github.boykaframework.enums.WaitStrategy.CLICKABLE; +import static io.github.boykaframework.manager.ParallelSession.getSession; +import static io.github.boykaframework.utils.Validator.requireNonNull; +import static java.time.Duration.ofMillis; +import static java.util.Objects.isNull; +import static org.openqa.selenium.interactions.PointerInput.Kind.MOUSE; +import static org.openqa.selenium.interactions.PointerInput.MouseButton.BACK; +import static org.openqa.selenium.interactions.PointerInput.MouseButton.FORWARD; + +import java.util.function.BiFunction; + +import io.github.boykaframework.builders.Locator; +import lombok.Builder; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.interactions.Pause; +import org.openqa.selenium.interactions.PointerInput; +import org.openqa.selenium.interactions.Sequence; + +/** + * Handle all the mouse specific actions. + * + * @author Wasiq Bhamla + * @since 27-Dec-2024 + */ +@Builder +public class MouseActionBuilder { + private Locator sourceLocator; + + Sequence backButtonClick () { + return mouseAction (BACK); + } + + void click () { + performElementAction ((d, e) -> new Actions (d).click (e) + .perform (), this.sourceLocator); + } + + void clickAndHold () { + performElementAction ((d, e) -> new Actions (d).clickAndHold (e) + .perform (), this.sourceLocator); + } + + void doubleClick () { + performElementAction ((d, e) -> new Actions (d).doubleClick (e) + .perform (), this.sourceLocator); + } + + void dragAndDrop (final Locator targetLocator) { + final var targetElement = find (requireNonNull (targetLocator, ELEMENT_CANNOT_BE_NULL), CLICKABLE); + performElementAction ((d, e) -> new Actions (d).dragAndDrop (e, targetElement) + .perform (), this.sourceLocator); + } + + Sequence forwardButtonClick () { + return mouseAction (FORWARD); + } + + void moveTo () { + performElementAction ((d, e) -> new Actions (d).moveToElement (e) + .perform (), this.sourceLocator); + } + + void rightClick () { + if (isNull (this.sourceLocator)) { + performDriverAction ((d) -> new Actions (d).contextClick () + .perform ()); + } else { + performElementAction ((d, e) -> new Actions (d).contextClick (e) + .perform (), this.sourceLocator); + } + } + + void scrollTo () { + performElementAction ((d, e) -> new Actions (d).scrollToElement (e) + .perform (), this.sourceLocator); + } + + private Sequence composeMouseSequence (final BiFunction steps) { + final var mouse = new PointerInput (MOUSE, "Default Mouse"); + final var sequence = new Sequence (mouse, 0); + return steps.apply (mouse, sequence); + } + + private Sequence mouseAction (final PointerInput.MouseButton button) { + final var delaySetting = getSession ().getSetting () + .getUi () + .getDelay (); + + return composeMouseSequence ((mouse, steps) -> { + steps.addAction (mouse.createPointerDown (button.asArg ())); + steps.addAction (new Pause (mouse, ofMillis (delaySetting.getBeforeSwipe ()))); + steps.addAction (mouse.createPointerUp (button.asArg ())); + return steps; + }); + } +} diff --git a/core-java/src/main/java/io/github/boykaframework/actions/interfaces/elements/IClickableActions.java b/core-java/src/main/java/io/github/boykaframework/actions/interfaces/elements/IClickableActions.java index afea5cbae..63ac7066a 100644 --- a/core-java/src/main/java/io/github/boykaframework/actions/interfaces/elements/IClickableActions.java +++ b/core-java/src/main/java/io/github/boykaframework/actions/interfaces/elements/IClickableActions.java @@ -43,11 +43,26 @@ public interface IClickableActions extends IFingersActions { */ void hover (); + /** + * Presses the back button on Mouse. + */ + void pressBackButton (); + + /** + * Presses the forward button on Mouse. + */ + void pressForwardButton (); + /** * RightClick on element */ void rightClick (); + /** + * Scroll to element. + */ + void scrollToElement (); + /** * Submit the element. */ diff --git a/core-java/src/main/java/io/github/boykaframework/actions/interfaces/listeners/elements/IClickableActionsListener.java b/core-java/src/main/java/io/github/boykaframework/actions/interfaces/listeners/elements/IClickableActionsListener.java index ef86fc60e..1850665cf 100644 --- a/core-java/src/main/java/io/github/boykaframework/actions/interfaces/listeners/elements/IClickableActionsListener.java +++ b/core-java/src/main/java/io/github/boykaframework/actions/interfaces/listeners/elements/IClickableActionsListener.java @@ -72,6 +72,20 @@ default void onHover (final Locator locator) { // not implemented. } + /** + * Handles the pressBackButton method. + */ + default void onPressBackButton () { + // not implemented. + } + + /** + * Handles the pressForwardButton method. + */ + default void onPressForwardButton () { + // not implemented. + } + /** * Handle right click method. * @@ -81,6 +95,15 @@ default void onRightClick (final Locator locator) { // not implemented. } + /** + * Scroll to the element. + * + * @param locator locator of the element. + */ + default void onScrollToElement (final Locator locator) { + // not implemented. + } + /** * Handle submit method. * diff --git a/package.json b/package.json index 64520fca6..4d5ca4354 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "lerna": "8.1.9", "lerna-changelog": "^2.2.0", "lerna-version": "^6.6.2", - "lint-staged": "^15.2.11", + "lint-staged": "^15.3.0", "lodash": "^4.17.21", "nx": "^20.3.0", "prettier": "^3.4.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 675f85e89..3db6ba061 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -81,8 +81,8 @@ importers: specifier: ^6.6.2 version: 6.6.2(encoding@0.1.13) lint-staged: - specifier: ^15.2.11 - version: 15.2.11 + specifier: ^15.3.0 + version: 15.3.0 lodash: specifier: ^4.17.21 version: 4.17.21 @@ -1477,8 +1477,8 @@ packages: '@iarna/toml@2.2.5': resolution: {integrity: sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==} - '@inquirer/figures@1.0.7': - resolution: {integrity: sha512-m+Trk77mp54Zma6xLkLuY+mvanPxlE4A7yNKs2HBiyZ4UkVs28Mv5c/pgWrHeInx+USHeX/WEPzjrWrcJiQgjw==} + '@inquirer/figures@1.0.9': + resolution: {integrity: sha512-BXvGj0ehzrngHTPTDqUoDT3NXL8U0RxUk2zJm2A66RhCEIWdtU1v6GuUqNAgArW4PQ9CinqIWyHdQgdwOj06zQ==} engines: {node: '>=18'} '@isaacs/cliui@8.0.2': @@ -1945,8 +1945,8 @@ packages: '@octokit/types@10.0.0': resolution: {integrity: sha512-Vm8IddVmhCgU1fxC1eyinpwqzXPEYu0NrYzD3YZjlGjyftdLBTeqNblRC0jmJmgxbJIsQlyogVeGnrNaaMVzIg==} - '@octokit/types@13.6.1': - resolution: {integrity: sha512-PHZE9Z+kWXb23Ndik8MKPirBPziOc0D2/3KH1P+6jK5nGWe96kadZuE4jev2/Jq7FvIfTlT2Ltg8Fv2x1v0a5g==} + '@octokit/types@13.6.2': + resolution: {integrity: sha512-WpbZfZUcZU77DrSW4wbsSgTPfKcp286q3ItaIgvSbBpZJlu6mnYXAkjZz6LVZPXkEvLIM8McanyZejKTYUHipA==} '@octokit/types@6.41.0': resolution: {integrity: sha512-eJ2jbzjdijiL3B4PrSQaSjuF2sPEQPVCPzBvTHJD9Nz+9dw2SGH4K4xeQJ77YfTq5bRQ+bD8wT11JbeDPmxmGg==} @@ -2727,6 +2727,10 @@ packages: resolution: {integrity: sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==} engines: {node: '>= 0.4'} + array.prototype.flat@1.3.3: + resolution: {integrity: sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg==} + engines: {node: '>= 0.4'} + array.prototype.flatmap@1.3.2: resolution: {integrity: sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==} engines: {node: '>= 0.4'} @@ -3004,10 +3008,6 @@ packages: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} - chalk@5.3.0: - resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==} - engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} - chalk@5.4.0: resolution: {integrity: sha512-ZkD35Mx92acjB2yNJgziGqT9oKHEOxjTBTDRpOsRWtdecL/0jM3z5kM/CTzHWvHIen1GvkM85p6TuFfDGfc8/Q==} engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} @@ -5074,6 +5074,10 @@ packages: resolution: {integrity: sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==} engines: {node: '>= 0.4'} + is-core-module@2.16.1: + resolution: {integrity: sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==} + engines: {node: '>= 0.4'} + is-data-view@1.0.1: resolution: {integrity: sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==} engines: {node: '>= 0.4'} @@ -5506,8 +5510,8 @@ packages: resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==} engines: {node: '>=6'} - ky@1.7.2: - resolution: {integrity: sha512-OzIvbHKKDpi60TnF9t7UUVAF1B4mcqc02z5PIvrm08Wyb+yOcz63GRvEuVxNT18a9E1SrNouhB4W2NNLeD7Ykg==} + ky@1.7.4: + resolution: {integrity: sha512-zYEr/gh7uLW2l4su11bmQ2M9xLgQLjyvx58UyNM/6nuqyWFHPX5ktMjvpev3F8QWdjSsHUpnWew4PBCswBNuMQ==} engines: {node: '>=18'} latest-version@7.0.0: @@ -5579,8 +5583,8 @@ packages: resolution: {integrity: sha512-wM1+Z03eypVAVUCE7QdSqpVIvelbOakn1M0bPDoA4SGWPx3sNDVUiMo3L6To6WWGClB7VyXnhQ4Sn7gxiJbE6A==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - lint-staged@15.2.11: - resolution: {integrity: sha512-Ev6ivCTYRTGs9ychvpVw35m/bcNDuBN+mnTeObCL5h+boS5WzBEC6LHI4I9F/++sZm1m+J2LEiy0gxL/R9TBqQ==} + lint-staged@15.3.0: + resolution: {integrity: sha512-vHFahytLoF2enJklgtOtCtIjZrKD/LoxlaUusd5nh7dWv/dkKQJY74ndFSzxCdv7g0ueGg1ORgTSt4Y9LPZn9A==} engines: {node: '>=18.12.0'} hasBin: true @@ -7623,6 +7627,10 @@ packages: resolution: {integrity: sha512-o/3ikDxtXaA59BmZuZrJZDJv8NMDGSj+6j6XaeBmHw8eY1i1qd9+6H+LjVvQXx3HN6aRCGa1cUdJ9RaJZUugnQ==} engines: {node: '>=14'} + registry-auth-token@5.0.3: + resolution: {integrity: sha512-1bpc9IyC+e+CNFRaWyn77tk4xGG4PPUyfakSmA6F6cvUDjrm58dfyJ3II+9yb10EDkHoy1LaPSmHaWLOH3m6HA==} + engines: {node: '>=14'} + registry-url@6.0.1: resolution: {integrity: sha512-+crtS5QjFRqFCoQmvGduwYWEBng99ZvmFvF+cUJkGYF1L1BfU8C6Zp9T7f5vPAwyLkUExpvK+ANVZmGU49qi4Q==} engines: {node: '>=12'} @@ -8480,8 +8488,8 @@ packages: resolution: {integrity: sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==} engines: {node: '>=12.20'} - type-fest@4.26.1: - resolution: {integrity: sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg==} + type-fest@4.31.0: + resolution: {integrity: sha512-yCxltHW07Nkhv/1F6wWBr8kz+5BGMfP+RbRSYFnegVb0qV/UMT0G0ElBloPVerqn4M2ZV80Ir1FtCcYv1cT6vQ==} engines: {node: '>=16'} type-is@1.6.18: @@ -11235,7 +11243,7 @@ snapshots: '@iarna/toml@2.2.5': {} - '@inquirer/figures@1.0.7': {} + '@inquirer/figures@1.0.9': {} '@isaacs/cliui@8.0.2': dependencies: @@ -11903,7 +11911,7 @@ snapshots: '@octokit/graphql': 7.1.0 '@octokit/request': 8.4.0 '@octokit/request-error': 5.1.0 - '@octokit/types': 13.6.1 + '@octokit/types': 13.6.2 before-after-hook: 2.2.3 universal-user-agent: 6.0.1 @@ -11915,7 +11923,7 @@ snapshots: '@octokit/endpoint@9.0.5': dependencies: - '@octokit/types': 13.6.1 + '@octokit/types': 13.6.2 universal-user-agent: 6.0.1 '@octokit/graphql@5.0.6(encoding@0.1.13)': @@ -11929,7 +11937,7 @@ snapshots: '@octokit/graphql@7.1.0': dependencies: '@octokit/request': 8.4.0 - '@octokit/types': 13.6.1 + '@octokit/types': 13.6.2 universal-user-agent: 6.0.1 '@octokit/openapi-types@12.11.0': {} @@ -11945,7 +11953,7 @@ snapshots: '@octokit/plugin-paginate-rest@11.3.1(@octokit/core@5.2.0)': dependencies: '@octokit/core': 5.2.0 - '@octokit/types': 13.6.1 + '@octokit/types': 13.6.2 '@octokit/plugin-paginate-rest@3.1.0(@octokit/core@4.2.4(encoding@0.1.13))': dependencies: @@ -11969,7 +11977,7 @@ snapshots: '@octokit/plugin-rest-endpoint-methods@13.2.2(@octokit/core@5.2.0)': dependencies: '@octokit/core': 5.2.0 - '@octokit/types': 13.6.1 + '@octokit/types': 13.6.2 '@octokit/plugin-rest-endpoint-methods@6.8.1(@octokit/core@4.2.4(encoding@0.1.13))': dependencies: @@ -11990,7 +11998,7 @@ snapshots: '@octokit/request-error@5.1.0': dependencies: - '@octokit/types': 13.6.1 + '@octokit/types': 13.6.2 deprecation: 2.3.1 once: 1.4.0 @@ -12009,7 +12017,7 @@ snapshots: dependencies: '@octokit/endpoint': 9.0.5 '@octokit/request-error': 5.1.0 - '@octokit/types': 13.6.1 + '@octokit/types': 13.6.2 universal-user-agent: 6.0.1 '@octokit/rest@19.0.11(encoding@0.1.13)': @@ -12043,7 +12051,7 @@ snapshots: dependencies: '@octokit/openapi-types': 18.1.1 - '@octokit/types@13.6.1': + '@octokit/types@13.6.2': dependencies: '@octokit/openapi-types': 22.2.0 @@ -12942,9 +12950,9 @@ snapshots: array.prototype.findlast@1.2.5: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.23.7 es-errors: 1.3.0 es-object-atoms: 1.0.0 es-shim-unscopables: 1.0.2 @@ -12965,6 +12973,13 @@ snapshots: es-abstract: 1.23.3 es-shim-unscopables: 1.0.2 + array.prototype.flat@1.3.3: + dependencies: + call-bind: 1.0.8 + define-properties: 1.2.1 + es-abstract: 1.23.7 + es-shim-unscopables: 1.0.2 + array.prototype.flatmap@1.3.2: dependencies: call-bind: 1.0.7 @@ -12981,9 +12996,9 @@ snapshots: array.prototype.tosorted@1.1.4: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.23.7 es-errors: 1.3.0 es-shim-unscopables: 1.0.2 @@ -13172,7 +13187,7 @@ snapshots: chalk: 5.4.1 cli-boxes: 3.0.0 string-width: 7.2.0 - type-fest: 4.26.1 + type-fest: 4.31.0 widest-line: 5.0.0 wrap-ansi: 9.0.0 @@ -13376,8 +13391,6 @@ snapshots: ansi-styles: 4.3.0 supports-color: 7.2.0 - chalk@5.3.0: {} - chalk@5.4.0: {} chalk@5.4.1: {} @@ -14220,7 +14233,7 @@ snapshots: dot-prop@9.0.0: dependencies: - type-fest: 4.26.1 + type-fest: 4.31.0 dotenv-expand@11.0.7: dependencies: @@ -15809,7 +15822,7 @@ snapshots: inquirer@9.3.2: dependencies: - '@inquirer/figures': 1.0.7 + '@inquirer/figures': 1.0.9 ansi-escapes: 4.3.2 cli-width: 4.1.0 external-editor: 3.1.0 @@ -15913,6 +15926,10 @@ snapshots: dependencies: hasown: 2.0.2 + is-core-module@2.16.1: + dependencies: + hasown: 2.0.2 + is-data-view@1.0.1: dependencies: is-typed-array: 1.1.13 @@ -16266,8 +16283,8 @@ snapshots: jsx-ast-utils@3.3.5: dependencies: array-includes: 3.1.8 - array.prototype.flat: 1.3.2 - object.assign: 4.1.5 + array.prototype.flat: 1.3.3 + object.assign: 4.1.7 object.values: 1.2.1 just-diff-apply@5.5.0: {} @@ -16284,7 +16301,7 @@ snapshots: kleur@4.1.5: {} - ky@1.7.2: {} + ky@1.7.4: {} latest-version@7.0.0: dependencies: @@ -16560,9 +16577,9 @@ snapshots: lines-and-columns@2.0.4: {} - lint-staged@15.2.11: + lint-staged@15.3.0: dependencies: - chalk: 5.3.0 + chalk: 5.4.1 commander: 12.1.0 debug: 4.4.0 execa: 8.0.1 @@ -18064,7 +18081,7 @@ snapshots: object.entries@1.1.8: dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 es-object-atoms: 1.0.0 @@ -18282,8 +18299,8 @@ snapshots: package-json@10.0.1: dependencies: - ky: 1.7.2 - registry-auth-token: 5.0.2 + ky: 1.7.4 + registry-auth-token: 5.0.3 registry-url: 6.0.1 semver: 7.6.3 @@ -19355,6 +19372,10 @@ snapshots: dependencies: '@pnpm/npm-conf': 2.3.1 + registry-auth-token@5.0.3: + dependencies: + '@pnpm/npm-conf': 2.3.1 + registry-url@6.0.1: dependencies: rc: 1.2.8 @@ -19524,7 +19545,7 @@ snapshots: resolve@2.0.0-next.5: dependencies: - is-core-module: 2.15.1 + is-core-module: 2.16.1 path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 @@ -20044,7 +20065,7 @@ snapshots: string.prototype.repeat@1.0.0: dependencies: define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.23.7 string.prototype.trim@1.2.10: dependencies: @@ -20373,7 +20394,7 @@ snapshots: type-fest@2.19.0: {} - type-fest@4.26.1: {} + type-fest@4.31.0: {} type-is@1.6.18: dependencies: diff --git a/website/docs/api/actions/elements/clickable-actions.md b/website/docs/api/actions/elements/clickable-actions.md index 4908a61ad..fcde0feaf 100644 --- a/website/docs/api/actions/elements/clickable-actions.md +++ b/website/docs/api/actions/elements/clickable-actions.md @@ -77,6 +77,36 @@ import static io.github.boykaframework.actions.elements.ClickableActions.withMou withMouse (locator).hover (); ``` +### `pressBackButton` {#press-back-button} + +This method is used to press the back button of mouse on the device. + +```java +import static io.github.boykaframework.actions.elements.ClickableActions.withMouse; +. . . +withMouse ().pressBackButton (); +``` + +### `pressForwardButton` {#press-forward-button} + +This method is used to press the forward button of mouse on the device. + +```java +import static io.github.boykaframework.actions.elements.ClickableActions.withMouse; +. . . +withMouse ().pressForwardButton (); +``` + +### `scrollToElement` {#scroll-to-element} + +This method is used to scroll the given element into view. + +```java +import static io.github.boykaframework.actions.elements.ClickableActions.withMouse; +. . . +withMouse (locator).scrollToElement (); +``` + ### `submit` This method is used to submit the given element.