mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Make all tests pass on Android 7.1.1 (Nougat)
This commit is contained in:
@@ -78,6 +78,7 @@ public class BaseUserInterfaceTest
|
|||||||
@After
|
@After
|
||||||
public void tearDown() throws Exception
|
public void tearDown() throws Exception
|
||||||
{
|
{
|
||||||
|
for (int i = 0; i < 10; i++) device.pressBack();
|
||||||
TestButler.teardown(getTargetContext());
|
TestButler.teardown(getTargetContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,12 +53,14 @@ public class LinksTest extends BaseUserInterfaceTest
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldLinkToHelp() throws Exception
|
public void shouldLinkToHelp() throws Exception {
|
||||||
{
|
|
||||||
launchApp();
|
launchApp();
|
||||||
clickMenu(HELP);
|
clickMenu(HELP);
|
||||||
verifyOpensWebsite("loophabits.org/faq.html");
|
verifyOpensWebsite("loophabits.org/faq.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldLinkToHelpFromSettings() throws Exception {
|
||||||
launchApp();
|
launchApp();
|
||||||
clickMenu(SETTINGS);
|
clickMenu(SETTINGS);
|
||||||
clickText("Help & FAQ");
|
clickText("Help & FAQ");
|
||||||
|
|||||||
@@ -139,13 +139,13 @@ public class CommonSteps extends BaseUserInterfaceTest
|
|||||||
|
|
||||||
public static void verifyOpensWebsite(String url) throws Exception
|
public static void verifyOpensWebsite(String url) throws Exception
|
||||||
{
|
{
|
||||||
|
String browser_pkg = "org.chromium.webview_shell";
|
||||||
if(SDK_INT <= 23) {
|
if(SDK_INT <= 23) {
|
||||||
assertTrue(device.wait(Until.hasObject(By.pkg("com.android.browser")), 5000));
|
browser_pkg = "com.android.browser";
|
||||||
} else {
|
|
||||||
assertTrue(device.wait(Until.hasObject(By.pkg("com.android.chrome")), 5000));
|
|
||||||
}
|
}
|
||||||
|
assertTrue(device.wait(Until.hasObject(By.pkg(browser_pkg)), 5000));
|
||||||
device.waitForIdle();
|
device.waitForIdle();
|
||||||
assertTrue(device.findObject(new UiSelector().text(url)).exists());
|
assertTrue(device.findObject(new UiSelector().textContains(url)).exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Screen
|
public enum Screen
|
||||||
|
|||||||
@@ -32,7 +32,11 @@ public class WidgetSteps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void clickText(String s) throws Exception {
|
public static void clickText(String s) throws Exception {
|
||||||
device.findObject(new UiSelector().text(s)).click();
|
UiObject object = device.findObject(new UiSelector().text(s));
|
||||||
|
if (!object.waitForExists(1000)) {
|
||||||
|
object = device.findObject(new UiSelector().text(s.toUpperCase()));
|
||||||
|
}
|
||||||
|
object.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dragCheckmarkWidgetToHomeScreen() throws Exception {
|
public static void dragCheckmarkWidgetToHomeScreen() throws Exception {
|
||||||
@@ -61,7 +65,11 @@ public class WidgetSteps {
|
|||||||
device.pressHome();
|
device.pressHome();
|
||||||
device.waitForIdle();
|
device.waitForIdle();
|
||||||
device.drag(w / 2, h / 2, w / 2, h / 2, 8);
|
device.drag(w / 2, h / 2, w / 2, h / 2, 8);
|
||||||
device.findObject(new UiSelector().text("Widgets")).click();
|
UiObject button = device.findObject(new UiSelector().text("WIDGETS"));
|
||||||
|
if(!button.waitForExists(1000)) {
|
||||||
|
button = device.findObject(new UiSelector().text("Widgets"));
|
||||||
|
}
|
||||||
|
button.click();
|
||||||
new UiScrollable(new UiSelector().resourceId(list_id))
|
new UiScrollable(new UiSelector().resourceId(list_id))
|
||||||
.scrollIntoView(new UiSelector().text("Checkmark"));
|
.scrollIntoView(new UiSelector().text("Checkmark"));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user