|
12 | 12 | import org.openqa.selenium.WebElement;
|
13 | 13 |
|
14 | 14 | import java.io.IOException;
|
| 15 | +import java.time.Duration; |
15 | 16 |
|
| 17 | +import static java.lang.Boolean.parseBoolean; |
16 | 18 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
17 | 19 | import static org.junit.jupiter.api.Assertions.assertFalse;
|
18 | 20 | import static org.junit.jupiter.api.Assertions.assertTrue;
|
@@ -52,18 +54,37 @@ void testScrollTillVisibleCommand() {
|
52 | 54 | openScreen("Vertical Swiping");
|
53 | 55 |
|
54 | 56 | WebElement firstElement = driver.scrollTillVisible(new ScrollParameter(AppiumBy.flutterText("Java")));
|
55 |
| - assertTrue(Boolean.parseBoolean(firstElement.getAttribute("displayed"))); |
| 57 | + assertTrue(parseBoolean(firstElement.getAttribute("displayed"))); |
56 | 58 |
|
57 | 59 | WebElement lastElement = driver.scrollTillVisible(new ScrollParameter(AppiumBy.flutterText("Protractor")));
|
58 |
| - assertTrue(Boolean.parseBoolean(lastElement.getAttribute("displayed"))); |
59 |
| - assertFalse(Boolean.parseBoolean(firstElement.getAttribute("displayed"))); |
| 60 | + assertTrue(parseBoolean(lastElement.getAttribute("displayed"))); |
| 61 | + assertFalse(parseBoolean(firstElement.getAttribute("displayed"))); |
60 | 62 |
|
61 | 63 | firstElement = driver.scrollTillVisible(
|
62 | 64 | new ScrollParameter(AppiumBy.flutterText("Java"),
|
63 | 65 | ScrollParameter.ScrollDirection.UP)
|
64 | 66 | );
|
65 |
| - assertTrue(Boolean.parseBoolean(firstElement.getAttribute("displayed"))); |
66 |
| - assertFalse(Boolean.parseBoolean(lastElement.getAttribute("displayed"))); |
| 67 | + assertTrue(parseBoolean(firstElement.getAttribute("displayed"))); |
| 68 | + assertFalse(parseBoolean(lastElement.getAttribute("displayed"))); |
| 69 | + } |
| 70 | + |
| 71 | + @Test |
| 72 | + void testScrollTillVisibleWithScrollParametersCommand() { |
| 73 | + WebElement loginButton = driver.findElement(BaseFlutterTest.LOGIN_BUTTON); |
| 74 | + loginButton.click(); |
| 75 | + openScreen("Vertical Swiping"); |
| 76 | + |
| 77 | + ScrollParameter scrollParameter = new ScrollParameter(AppiumBy.flutterText("Playwright")); |
| 78 | + scrollParameter |
| 79 | + .setScrollView(AppiumBy.flutterType("Scrollable")) |
| 80 | + .setMaxScrolls(30) |
| 81 | + .setDelta(30) |
| 82 | + // Drag duration currently works when the value is greater than 33 secs |
| 83 | + .setDragDuration(Duration.ofMillis(35000)) |
| 84 | + .setSettleBetweenScrollsTimeout(5000); |
| 85 | + |
| 86 | + WebElement element = driver.scrollTillVisible(scrollParameter); |
| 87 | + assertTrue(parseBoolean(element.getAttribute("displayed"))); |
67 | 88 | }
|
68 | 89 |
|
69 | 90 | @Test
|
|
0 commit comments