|
@@ -18,10 +18,6 @@
|
|
|
|
|
|
package com.owncloud.android.uiautomator;
|
|
|
|
|
|
-import org.junit.Before;
|
|
|
-import org.junit.Test;
|
|
|
-import org.junit.runner.RunWith;
|
|
|
-
|
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
import android.content.pm.PackageManager;
|
|
@@ -36,6 +32,9 @@ import android.support.test.uiautomator.UiObjectNotFoundException;
|
|
|
import android.support.test.uiautomator.UiSelector;
|
|
|
import android.support.test.uiautomator.Until;
|
|
|
|
|
|
+import org.junit.Before;
|
|
|
+import org.junit.Test;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
|
|
|
import static org.hamcrest.CoreMatchers.notNullValue;
|
|
|
import static org.junit.Assert.assertThat;
|
|
@@ -59,7 +58,6 @@ public class InitialTest {
|
|
|
public void initializeDevice() {
|
|
|
// Initialize UiDevice instance
|
|
|
mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Test
|
|
@@ -114,7 +112,6 @@ public class InitialTest {
|
|
|
context.startActivity(intent);
|
|
|
|
|
|
clickByText(SETTINGS_DATA_USAGE_OPTION);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -134,24 +131,26 @@ public class InitialTest {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Helper to click on objects that match the content-description text
|
|
|
+ * Helper to click on objects that match the content-description text.
|
|
|
*
|
|
|
- * @param text
|
|
|
+ * @param description the description
|
|
|
* @throws UiObjectNotFoundException
|
|
|
*/
|
|
|
- private void clickByDescription(String text) throws UiObjectNotFoundException {
|
|
|
- UiObject obj = new UiObject(new UiSelector().description(text));
|
|
|
+ private void clickByDescription(String description) throws UiObjectNotFoundException {
|
|
|
+ UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
|
|
|
+ UiObject obj = device.findObject(new UiSelector().description(description));
|
|
|
obj.clickAndWaitForNewWindow();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Helper to click on object that match the text value
|
|
|
+ * Helper to click on object that match the text value.
|
|
|
*
|
|
|
- * @param text
|
|
|
+ * @param text the text
|
|
|
* @throws UiObjectNotFoundException
|
|
|
*/
|
|
|
private void clickByText(String text) throws UiObjectNotFoundException {
|
|
|
- UiObject obj = new UiObject(new UiSelector().text(text));
|
|
|
+ UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
|
|
|
+ UiObject obj = device.findObject(new UiSelector().text(text));
|
|
|
obj.clickAndWaitForNewWindow();
|
|
|
}
|
|
|
}
|