use of io.appium.java_client.TouchAction in project java-client by appium.
the class AndroidTouchTest method multiTouchTest.
@Test
public void multiTouchTest() {
Activity activity = new Activity("io.appium.android.apis", ".view.Buttons1");
driver.startActivity(activity);
TouchAction press = new TouchAction(driver).press(element(driver.findElementById("io.appium.android.apis:id/button_toggle"))).waitAction(waitOptions(ofSeconds(1))).release();
new MultiTouchAction(driver).add(press).perform();
assertEquals("ON", driver.findElementById("io.appium.android.apis:id/button_toggle").getText());
}
use of io.appium.java_client.TouchAction in project java-client by appium.
the class IOSTouchTest method tapTest.
@Test
public void tapTest() {
IOSElement intA = driver.findElementById("IntegerA");
IOSElement intB = driver.findElementById("IntegerB");
intA.clear();
intB.clear();
intA.sendKeys("2");
intB.sendKeys("4");
MobileElement e = driver.findElementByAccessibilityId("ComputeSumButton");
new TouchAction(driver).tap(tapOptions().withElement(element(e))).perform();
assertEquals(driver.findElementByXPath("//*[@name = \"Answer\"]").getText(), "6");
}
use of io.appium.java_client.TouchAction in project java-client by appium.
the class AndroidTouchTest method dragNDropByElementTest.
@Test
public void dragNDropByElementTest() {
Activity activity = new Activity("io.appium.android.apis", ".view.DragAndDropDemo");
driver.startActivity(activity);
WebElement dragDot1 = driver.findElement(By.id("io.appium.android.apis:id/drag_dot_1"));
WebElement dragDot3 = driver.findElement(By.id("io.appium.android.apis:id/drag_dot_3"));
WebElement dragText = driver.findElement(By.id("io.appium.android.apis:id/drag_text"));
assertEquals("Drag text not empty", "", dragText.getText());
TouchAction dragNDrop = new TouchAction(driver).longPress(element(dragDot1)).moveTo(element(dragDot3)).release();
dragNDrop.perform();
assertNotEquals("Drag text empty", "", dragText.getText());
}
use of io.appium.java_client.TouchAction in project java-client by appium.
the class AndroidTouchTest method dragNDropByElementAndDurationTest.
@Test
public void dragNDropByElementAndDurationTest() {
Activity activity = new Activity("io.appium.android.apis", ".view.DragAndDropDemo");
driver.startActivity(activity);
WebElement dragDot1 = driver.findElement(By.id("io.appium.android.apis:id/drag_dot_1"));
WebElement dragDot3 = driver.findElement(By.id("io.appium.android.apis:id/drag_dot_3"));
WebElement dragText = driver.findElement(By.id("io.appium.android.apis:id/drag_text"));
assertEquals("Drag text not empty", "", dragText.getText());
TouchAction dragNDrop = new TouchAction(driver).longPress(longPressOptions().withElement(element(dragDot1)).withDuration(ofSeconds(2))).moveTo(element(dragDot3)).release();
dragNDrop.perform();
assertNotEquals("Drag text empty", "", dragText.getText());
}
use of io.appium.java_client.TouchAction in project java-client by appium.
the class AndroidTouchTest method dragNDropByCoordinatesAndDurationTest.
@Test
public void dragNDropByCoordinatesAndDurationTest() {
Activity activity = new Activity("io.appium.android.apis", ".view.DragAndDropDemo");
driver.startActivity(activity);
AndroidElement dragDot1 = driver.findElement(By.id("io.appium.android.apis:id/drag_dot_1"));
AndroidElement dragDot3 = driver.findElement(By.id("io.appium.android.apis:id/drag_dot_3"));
WebElement dragText = driver.findElement(By.id("io.appium.android.apis:id/drag_text"));
assertEquals("Drag text not empty", "", dragText.getText());
Point center1 = dragDot1.getCenter();
Point center2 = dragDot3.getCenter();
TouchAction dragNDrop = new TouchAction(driver).longPress(longPressOptions().withPosition(point(center1.x, center1.y)).withDuration(ofSeconds(2))).moveTo(point(center2.x, center2.y)).release();
dragNDrop.perform();
assertNotEquals("Drag text empty", "", dragText.getText());
}
Aggregations