use of io.appium.java_client.touch.offset.ElementOption in project java-client by appium.
the class TouchOptionsTests method invalidOptionsArgumentsShouldFailOnAltering.
@Test
public void invalidOptionsArgumentsShouldFailOnAltering() {
final List<Runnable> invalidOptions = new ArrayList<>();
invalidOptions.add(() -> waitOptions(ofMillis(-1)));
invalidOptions.add(() -> new ElementOption().withCoordinates(0, 0).withElement(null));
invalidOptions.add(() -> new WaitOptions().withDuration(null));
invalidOptions.add(() -> tapOptions().withTapsCount(-1));
invalidOptions.add(() -> longPressOptions().withDuration(null));
invalidOptions.add(() -> longPressOptions().withDuration(ofMillis(-1)));
for (Runnable item : invalidOptions) {
assertThat(item, failsWith(RuntimeException.class));
}
}
use of io.appium.java_client.touch.offset.ElementOption in project java-client by appium.
the class TouchOptionsTests method invalidEmptyElementOptionsShouldFailOnBuild.
@Test(expected = IllegalArgumentException.class)
public void invalidEmptyElementOptionsShouldFailOnBuild() {
new ElementOption().build();
fail("The exception throwing was expected");
}
use of io.appium.java_client.touch.offset.ElementOption in project java-client by appium.
the class IOSTouchTest method swipeTest.
@Test
public void swipeTest() {
MobileElement slider = driver.findElementByClassName("UIASlider");
Dimension size = slider.getSize();
ElementOption press = element(slider, size.width / 2 + 2, size.height / 2);
ElementOption move = element(slider, 1, size.height / 2);
TouchAction swipe = new TouchAction(driver).press(press).waitAction(waitOptions(ofSeconds(2))).moveTo(move).release();
swipe.perform();
assertEquals("0%", slider.getAttribute("value"));
}
Aggregations