mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Update tests
This commit is contained in:
@@ -76,7 +76,7 @@ build_apk() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
log_info "Building debug APK"
|
log_info "Building debug APK"
|
||||||
./gradlew assembleDebug || fail
|
./gradlew assembleDebug --stacktrace || fail
|
||||||
cp -v uhabits-android/build/outputs/apk/debug/uhabits-android-debug.apk build/loop-$VERSION-debug.apk
|
cp -v uhabits-android/build/outputs/apk/debug/uhabits-android-debug.apk build/loop-$VERSION-debug.apk
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,12 +54,15 @@ public class HabitsTest extends BaseUserInterfaceTest
|
|||||||
verifyShowsScreen(LIST_HABITS);
|
verifyShowsScreen(LIST_HABITS);
|
||||||
clickMenu(ADD);
|
clickMenu(ADD);
|
||||||
|
|
||||||
|
verifyShowsScreen(SELECT_HABIT_TYPE);
|
||||||
|
clickText("Yes or No");
|
||||||
|
|
||||||
verifyShowsScreen(EDIT_HABIT);
|
verifyShowsScreen(EDIT_HABIT);
|
||||||
String testName = "Hello world";
|
String testName = "Hello world";
|
||||||
typeName(testName);
|
typeName(testName);
|
||||||
typeQuestion("Did you say hello to the world today?");
|
typeQuestion("Did you say hello to the world today?");
|
||||||
typeDescription(description);
|
typeDescription(description);
|
||||||
pickFrequency("Every week");
|
pickFrequency();
|
||||||
pickColor(5);
|
pickColor(5);
|
||||||
clickSave();
|
clickSave();
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public class CommonSteps extends BaseUserInterfaceTest
|
|||||||
|
|
||||||
public enum Screen
|
public enum Screen
|
||||||
{
|
{
|
||||||
LIST_HABITS, SHOW_HABIT, EDIT_HABIT
|
LIST_HABITS, SHOW_HABIT, EDIT_HABIT, SELECT_HABIT_TYPE
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void verifyShowsScreen(Screen screen) {
|
public static void verifyShowsScreen(Screen screen) {
|
||||||
@@ -176,9 +176,15 @@ public class CommonSteps extends BaseUserInterfaceTest
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EDIT_HABIT:
|
case EDIT_HABIT:
|
||||||
onView(withId(R.id.tvQuestion)).check(matches(isDisplayed()));
|
onView(withId(R.id.questionInput)).check(matches(isDisplayed()));
|
||||||
onView(withId(R.id.tvDescription)).check(matches(isDisplayed()));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SELECT_HABIT_TYPE:
|
||||||
|
onView(withText(R.string.yes_or_no_example)).check(matches(isDisplayed()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,42 +36,42 @@ public class EditHabitSteps
|
|||||||
onView(withId(R.id.buttonSave)).perform(click());
|
onView(withId(R.id.buttonSave)).perform(click());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void pickFrequency(String freq)
|
public static void pickFrequency()
|
||||||
{
|
{
|
||||||
onView(withId(R.id.spinner)).perform(click());
|
onView(withId(R.id.frequencyPicker)).perform(click());
|
||||||
device.findObject(By.text(freq)).click();
|
onView(withText("SAVE")).perform(click());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void pickColor(int color)
|
public static void pickColor(int color)
|
||||||
{
|
{
|
||||||
onView(withId(R.id.buttonPickColor)).perform(click());
|
onView(withId(R.id.colorButton)).perform(click());
|
||||||
device.findObject(By.descStartsWith(String.format("Color %d", color))).click();
|
device.findObject(By.descStartsWith(String.format("Color %d", color))).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void typeName(String name)
|
public static void typeName(String name)
|
||||||
{
|
{
|
||||||
typeTextWithId(R.id.tvName, name);
|
typeTextWithId(R.id.nameInput, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void typeQuestion(String name)
|
public static void typeQuestion(String name)
|
||||||
{
|
{
|
||||||
typeTextWithId(R.id.tvQuestion, name);
|
typeTextWithId(R.id.questionInput, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void typeDescription(String description)
|
public static void typeDescription(String description)
|
||||||
{
|
{
|
||||||
typeTextWithId(R.id.tvDescription, description);
|
typeTextWithId(R.id.notesInput, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setReminder()
|
public static void setReminder()
|
||||||
{
|
{
|
||||||
onView(withId(R.id.tvReminderTime)).perform(click());
|
onView(withId(R.id.reminderTimePicker)).perform(click());
|
||||||
onView(withId(R.id.done_button)).perform(click());
|
onView(withId(R.id.done_button)).perform(click());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clickReminderDays()
|
public static void clickReminderDays()
|
||||||
{
|
{
|
||||||
onView(withId(R.id.tvReminderDays)).perform(click());
|
onView(withId(R.id.reminderDatePicker)).perform(click());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void unselectAllDays()
|
public static void unselectAllDays()
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public abstract class ListHabitsSteps
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ADD:
|
case ADD:
|
||||||
clickViewWithId(R.id.actionCreateBooleanHabit);
|
clickViewWithId(R.id.actionCreateHabit);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EDIT:
|
case EDIT:
|
||||||
|
|||||||
Reference in New Issue
Block a user