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