Skip to content

Commit

Permalink
Merge pull request #21 from alfa-laboratory/swipe_refact
Browse files Browse the repository at this point in the history
refactoring swipes
  • Loading branch information
JasperJhons committed Oct 17, 2017
2 parents 02cdc97 + 2919d64 commit 0fd7da8
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 0fd7da8

Please sign in to comment.