mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Fix large tests for API 28
This commit is contained in:
@@ -37,7 +37,7 @@ class BackupTest : BaseUserInterfaceTest() {
|
||||
|
||||
longClickText("Wake up early")
|
||||
ListHabitsSteps.clickMenu(ListHabitsSteps.MenuItem.DELETE)
|
||||
clickYes()
|
||||
clickText("Yes")
|
||||
verifyDoesNotDisplayText("Wake up early")
|
||||
|
||||
importBackupFromDownloadFolder()
|
||||
|
||||
@@ -89,7 +89,7 @@ public class HabitsTest extends BaseUserInterfaceTest
|
||||
verifyShowsScreen(LIST_HABITS);
|
||||
longClickText("Track time");
|
||||
clickMenu(DELETE);
|
||||
clickYes();
|
||||
clickText("Yes");
|
||||
verifyDoesNotDisplayText("Track time");
|
||||
}
|
||||
|
||||
@@ -197,12 +197,4 @@ public class HabitsTest extends BaseUserInterfaceTest
|
||||
verifyDisplaysText("Track time");
|
||||
verifyDisplaysText("Wake up early");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldHideNotesCard() throws Exception
|
||||
{
|
||||
launchApp();
|
||||
clickText(EMPTY_DESCRIPTION_HABIT_NAME);
|
||||
verifyShowsScreen(SHOW_HABIT, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,23 +42,23 @@ public class LinksTest extends BaseUserInterfaceTest
|
||||
launchApp();
|
||||
clickMenu(ABOUT);
|
||||
clickText("View source code at GitHub");
|
||||
verifyOpensWebsite("https://github.com/iSoron/uhabits");
|
||||
verifyOpensWebsite("github.com");
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void shouldLinkToTranslationWebsite() throws Exception
|
||||
// {
|
||||
// launchApp();
|
||||
// clickMenu(ABOUT);
|
||||
// clickText("Help translate this app");
|
||||
// verifyOpensWebsite("translate.loophabits.org");
|
||||
// }
|
||||
@Test
|
||||
public void shouldLinkToTranslationWebsite() throws Exception
|
||||
{
|
||||
launchApp();
|
||||
clickMenu(ABOUT);
|
||||
clickText("Help translate this app");
|
||||
verifyOpensWebsite("translate.loophabits.org");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldLinkToHelp() throws Exception {
|
||||
launchApp();
|
||||
clickMenu(HELP);
|
||||
verifyOpensWebsite("loophabits.org/faq.html");
|
||||
verifyOpensWebsite("github.com");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -66,6 +66,6 @@ public class LinksTest extends BaseUserInterfaceTest
|
||||
launchApp();
|
||||
clickMenu(SETTINGS);
|
||||
clickText("Help & FAQ");
|
||||
verifyOpensWebsite("loophabits.org/faq.html");
|
||||
verifyOpensWebsite("github.com");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,9 @@ public class WidgetTest extends BaseUserInterfaceTest
|
||||
public void shouldCreateAndToggleCheckmarkWidget() throws Exception
|
||||
{
|
||||
dragCheckmarkWidgetToHomeScreen();
|
||||
Thread.sleep(3000);
|
||||
clickText("Wake up early");
|
||||
clickText("Save");
|
||||
verifyCheckmarkWidgetIsShown();
|
||||
clickCheckmarkWidget();
|
||||
|
||||
@@ -45,7 +47,6 @@ public class WidgetTest extends BaseUserInterfaceTest
|
||||
|
||||
pressHome();
|
||||
clickCheckmarkWidget();
|
||||
clickCheckmarkWidget();
|
||||
|
||||
launchApp();
|
||||
clickText("Wake up early");
|
||||
|
||||
@@ -49,17 +49,11 @@ fun copyBackupToDownloadFolder() {
|
||||
fun importBackupFromDownloadFolder() {
|
||||
clickMenu(SETTINGS)
|
||||
clickText("Import data")
|
||||
device.click(100, 180) // Click menu button
|
||||
device.findObject(UiSelector().textContains("Download")).click()
|
||||
device.findObject(UiSelector().textContains("Loop")).click()
|
||||
}
|
||||
|
||||
fun clearAppData() {
|
||||
openLauncher()
|
||||
device.findObject(UiSelector().textContains("Habits")).longClick()
|
||||
device.findObject(UiSelector().textContains("App info")).click()
|
||||
device.findObject(UiSelector().textContains("Storage")).click()
|
||||
device.findObject(UiSelector().textContains("Clear storage")).click()
|
||||
}
|
||||
|
||||
fun openLauncher() {
|
||||
device.pressHome()
|
||||
device.waitForIdle()
|
||||
|
||||
@@ -43,11 +43,6 @@ import static org.junit.Assert.*;
|
||||
|
||||
public class CommonSteps extends BaseUserInterfaceTest
|
||||
{
|
||||
public static void clickYes()
|
||||
{
|
||||
clickText("Yes");
|
||||
}
|
||||
|
||||
public static void pressBack()
|
||||
{
|
||||
device.pressBack();
|
||||
@@ -154,11 +149,7 @@ public class CommonSteps extends BaseUserInterfaceTest
|
||||
LIST_HABITS, SHOW_HABIT, EDIT_HABIT, SELECT_HABIT_TYPE
|
||||
}
|
||||
|
||||
public static void verifyShowsScreen(Screen screen) {
|
||||
verifyShowsScreen(screen, true);
|
||||
}
|
||||
|
||||
public static void verifyShowsScreen(Screen screen, boolean notesCardVisibleExpected)
|
||||
public static void verifyShowsScreen(Screen screen)
|
||||
{
|
||||
switch(screen)
|
||||
{
|
||||
@@ -168,10 +159,7 @@ public class CommonSteps extends BaseUserInterfaceTest
|
||||
break;
|
||||
|
||||
case SHOW_HABIT:
|
||||
Matcher<View> noteCardViewMatcher = notesCardVisibleExpected ? isDisplayed() :
|
||||
withEffectiveVisibility(Visibility.GONE);
|
||||
onView(withId(R.id.subtitleCard)).check(matches(isDisplayed()));
|
||||
onView(withId(R.id.notesCard)).check(matches(noteCardViewMatcher));
|
||||
break;
|
||||
|
||||
case EDIT_HABIT:
|
||||
|
||||
@@ -48,7 +48,7 @@ public class WidgetSteps {
|
||||
int height = device.getDisplayHeight();
|
||||
int width = device.getDisplayWidth();
|
||||
device.findObject(new UiSelector().text("Checkmark"))
|
||||
.dragTo(width / 2, height / 2, 8);
|
||||
.dragTo(width / 2, height / 2, 40);
|
||||
}
|
||||
|
||||
private static void openWidgetScreen() throws Exception {
|
||||
|
||||
@@ -41,7 +41,7 @@ class ListHabitsRegressionTest : BaseUserInterfaceTest() {
|
||||
verifyShowsScreen(LIST_HABITS)
|
||||
longClickText("Track time")
|
||||
clickMenu(DELETE)
|
||||
clickYes()
|
||||
clickText("Yes")
|
||||
|
||||
clickMenu(ADD)
|
||||
verifyShowsScreen(SELECT_HABIT_TYPE)
|
||||
|
||||
Reference in New Issue
Block a user