|
17 | 17 |
|
18 | 18 | package io.appium.java_client; |
19 | 19 |
|
| 20 | +import static org.junit.Assert.*; |
20 | 21 | import io.appium.java_client.remote.MobileCapabilityType; |
21 | 22 |
|
22 | 23 | import java.io.File; |
|
25 | 26 | import org.junit.After; |
26 | 27 | import org.junit.Before; |
27 | 28 | import org.junit.Test; |
| 29 | +import org.openqa.selenium.By; |
| 30 | +import org.openqa.selenium.WebElement; |
28 | 31 | import org.openqa.selenium.remote.DesiredCapabilities; |
29 | 32 |
|
30 | 33 | /** |
@@ -60,6 +63,25 @@ public void MultiGestureSingleActionTest() throws InterruptedException { |
60 | 63 | multiTouch.add(action0).perform(); |
61 | 64 | } |
62 | 65 |
|
| 66 | + @Test |
| 67 | + public void dragNDropTest() { |
| 68 | + driver.scrollToExact("Views").click(); |
| 69 | + driver.findElement(MobileBy.AndroidUIAutomator("description(\"Drag and Drop\")")).click(); |
| 70 | + WebElement actionBarTitle = driver.findElement(By.id("android:id/action_bar_title")); |
| 71 | + |
| 72 | + assertEquals("Wrong title.", "Views/Drag and Drop", actionBarTitle.getText()); |
| 73 | + WebElement dragDot1 = driver.findElement(By.id("com.example.android.apis:id/drag_dot_1")); |
| 74 | + WebElement dragDot3 = driver.findElement(By.id("com.example.android.apis:id/drag_dot_3")); |
| 75 | + |
| 76 | + WebElement dragText = driver.findElement(By.id("com.example.android.apis:id/drag_text")); |
| 77 | + assertEquals("Drag text not empty", "", dragText.getText()); |
| 78 | + |
| 79 | + TouchAction dragNDrop = new TouchAction(driver).longPress(dragDot1).moveTo(dragDot3).release(); |
| 80 | + dragNDrop.perform(); |
| 81 | + |
| 82 | + assertNotEquals("Drag text empty", "", dragText.getText()); |
| 83 | + } |
| 84 | + |
63 | 85 | @Test |
64 | 86 | public void TapSingleFingerTest() { |
65 | 87 | driver.tap(1,100,200,1000); |
|
0 commit comments