Skip to content

Commit

Permalink
refactoring swipes
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperJhons committed Oct 17, 2017
1 parent 696e3c6 commit 2919d64
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/main/java/ru/colibri/ui/steps/general/SwipeSteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,23 @@
public class SwipeSteps extends AbsSteps {


protected void verticalSwipe(String elementName, int swipeLength) {
protected void verticalSwipe(String elementName, int swipeLength, int duration) {
WebElement webElement = getWebElementByName(elementName);
new TouchAction(driver).press(webElement).moveTo(0, swipeLength).release().perform();
new TouchAction(driver)
.press(webElement)
.waitAction(Duration.ofSeconds(duration))
.moveTo(0, swipeLength)
.release().perform();

}

protected void horizontalSwip(String elementName, int swipeLength, int duration) {
protected void horizontalSwipe(String elementName, int swipeLength, int duration) {
WebElement webElement = getWebElementByName(elementName);
new TouchAction(driver).press(webElement).waitAction(Duration.ofSeconds(duration)).
moveTo(swipeLength, 0).release().perform();
new TouchAction(driver)
.press(webElement)
.waitAction(Duration.ofSeconds(duration))
.moveTo(swipeLength, 0)
.release().perform();
}

}

0 comments on commit 2919d64

Please sign in to comment.