Search in sources :

Example 1 with ElementOption

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));
    }
}
Also used : ElementOption(io.appium.java_client.touch.offset.ElementOption) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 2 with ElementOption

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");
}
Also used : ElementOption(io.appium.java_client.touch.offset.ElementOption) Test(org.junit.Test)

Example 3 with ElementOption

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"));
}
Also used : ElementOption(io.appium.java_client.touch.offset.ElementOption) MobileElement(io.appium.java_client.MobileElement) Dimension(org.openqa.selenium.Dimension) TouchAction(io.appium.java_client.TouchAction) MultiTouchAction(io.appium.java_client.MultiTouchAction) Test(org.junit.Test)

Aggregations

ElementOption (io.appium.java_client.touch.offset.ElementOption)3 Test (org.junit.Test)3 MobileElement (io.appium.java_client.MobileElement)1 MultiTouchAction (io.appium.java_client.MultiTouchAction)1 TouchAction (io.appium.java_client.TouchAction)1 ArrayList (java.util.ArrayList)1 Dimension (org.openqa.selenium.Dimension)1