|
|
@ -19,69 +19,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
package org.isoron.uhabits.espresso;
|
|
|
|
package org.isoron.uhabits.espresso;
|
|
|
|
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.app.*;
|
|
|
|
import android.app.Instrumentation;
|
|
|
|
import android.content.*;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.support.test.*;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.support.test.espresso.*;
|
|
|
|
import android.support.test.InstrumentationRegistry;
|
|
|
|
import android.support.test.espresso.intent.rule.*;
|
|
|
|
import android.support.test.espresso.NoMatchingViewException;
|
|
|
|
import android.support.test.runner.*;
|
|
|
|
import android.support.test.espresso.intent.rule.IntentsTestRule;
|
|
|
|
import android.test.suitebuilder.annotation.*;
|
|
|
|
import android.support.test.runner.AndroidJUnit4;
|
|
|
|
|
|
|
|
import android.test.suitebuilder.annotation.LargeTest;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.hamcrest.*;
|
|
|
|
import org.hamcrest.*;
|
|
|
|
|
|
|
|
import org.isoron.uhabits.*;
|
|
|
|
import org.isoron.uhabits.R;
|
|
|
|
import org.isoron.uhabits.R;
|
|
|
|
import org.isoron.uhabits.models.sqlite.records.HabitRecord;
|
|
|
|
import org.isoron.uhabits.models.sqlite.records.*;
|
|
|
|
import org.isoron.uhabits.utils.DateUtils;
|
|
|
|
import org.isoron.uhabits.utils.*;
|
|
|
|
import org.isoron.uhabits.MainActivity;
|
|
|
|
import org.junit.*;
|
|
|
|
import org.junit.After;
|
|
|
|
import org.junit.runner.*;
|
|
|
|
import org.junit.Before;
|
|
|
|
|
|
|
|
import org.junit.Rule;
|
|
|
|
import java.util.*;
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
import static android.support.test.espresso.Espresso.*;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.LinkedList;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static android.support.test.espresso.Espresso.onData;
|
|
|
|
|
|
|
|
import static android.support.test.espresso.Espresso.onView;
|
|
|
|
|
|
|
|
import static android.support.test.espresso.Espresso.pressBack;
|
|
|
|
import static android.support.test.espresso.Espresso.pressBack;
|
|
|
|
import static android.support.test.espresso.action.ViewActions.click;
|
|
|
|
import static android.support.test.espresso.action.ViewActions.*;
|
|
|
|
import static android.support.test.espresso.action.ViewActions.longClick;
|
|
|
|
import static android.support.test.espresso.assertion.ViewAssertions.*;
|
|
|
|
import static android.support.test.espresso.action.ViewActions.scrollTo;
|
|
|
|
import static android.support.test.espresso.intent.Intents.*;
|
|
|
|
import static android.support.test.espresso.action.ViewActions.swipeLeft;
|
|
|
|
import static android.support.test.espresso.intent.matcher.IntentMatchers.*;
|
|
|
|
import static android.support.test.espresso.action.ViewActions.swipeRight;
|
|
|
|
import static android.support.test.espresso.matcher.ViewMatchers.*;
|
|
|
|
import static android.support.test.espresso.action.ViewActions.swipeUp;
|
|
|
|
import static org.hamcrest.Matchers.*;
|
|
|
|
import static android.support.test.espresso.assertion.ViewAssertions.matches;
|
|
|
|
import static org.isoron.uhabits.espresso.HabitViewActions.*;
|
|
|
|
import static android.support.test.espresso.intent.Intents.intended;
|
|
|
|
import static org.isoron.uhabits.espresso.MainActivityActions.*;
|
|
|
|
import static android.support.test.espresso.intent.Intents.intending;
|
|
|
|
import static org.isoron.uhabits.espresso.ShowHabitActivityActions.*;
|
|
|
|
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasAction;
|
|
|
|
|
|
|
|
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
|
|
|
|
|
|
|
|
import static android.support.test.espresso.matcher.ViewMatchers.isRoot;
|
|
|
|
|
|
|
|
import static android.support.test.espresso.matcher.ViewMatchers.withClassName;
|
|
|
|
|
|
|
|
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
|
|
|
|
|
|
|
import static org.hamcrest.Matchers.allOf;
|
|
|
|
|
|
|
|
import static org.hamcrest.Matchers.containsString;
|
|
|
|
|
|
|
|
import static org.hamcrest.Matchers.endsWith;
|
|
|
|
|
|
|
|
import static org.hamcrest.Matchers.equalTo;
|
|
|
|
|
|
|
|
import static org.hamcrest.Matchers.instanceOf;
|
|
|
|
|
|
|
|
import static org.hamcrest.Matchers.is;
|
|
|
|
|
|
|
|
import static org.hamcrest.Matchers.startsWith;
|
|
|
|
|
|
|
|
import static org.isoron.uhabits.espresso.HabitViewActions.clickAtRandomLocations;
|
|
|
|
|
|
|
|
import static org.isoron.uhabits.espresso.HabitViewActions.toggleAllCheckmarks;
|
|
|
|
|
|
|
|
import static org.isoron.uhabits.espresso.MainActivityActions.addHabit;
|
|
|
|
|
|
|
|
import static org.isoron.uhabits.espresso.MainActivityActions.assertHabitExists;
|
|
|
|
|
|
|
|
import static org.isoron.uhabits.espresso.MainActivityActions.assertHabitsDontExist;
|
|
|
|
|
|
|
|
import static org.isoron.uhabits.espresso.MainActivityActions.assertHabitsExist;
|
|
|
|
|
|
|
|
import static org.isoron.uhabits.espresso.MainActivityActions.clickMenuItem;
|
|
|
|
|
|
|
|
import static org.isoron.uhabits.espresso.MainActivityActions.clickSettingsItem;
|
|
|
|
|
|
|
|
import static org.isoron.uhabits.espresso.MainActivityActions.deleteHabit;
|
|
|
|
|
|
|
|
import static org.isoron.uhabits.espresso.MainActivityActions.deleteHabits;
|
|
|
|
|
|
|
|
import static org.isoron.uhabits.espresso.MainActivityActions.selectHabit;
|
|
|
|
|
|
|
|
import static org.isoron.uhabits.espresso.MainActivityActions.selectHabits;
|
|
|
|
|
|
|
|
import static org.isoron.uhabits.espresso.MainActivityActions.typeHabitData;
|
|
|
|
|
|
|
|
import static org.isoron.uhabits.espresso.ShowHabitActivityActions.openHistoryEditor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RunWith(AndroidJUnit4.class)
|
|
|
|
@RunWith(AndroidJUnit4.class)
|
|
|
|
@LargeTest
|
|
|
|
@LargeTest
|
|
|
@ -90,45 +56,38 @@ public class MainTest
|
|
|
|
private SystemHelper sys;
|
|
|
|
private SystemHelper sys;
|
|
|
|
|
|
|
|
|
|
|
|
@Rule
|
|
|
|
@Rule
|
|
|
|
public IntentsTestRule<MainActivity> activityRule = new IntentsTestRule<>(
|
|
|
|
public IntentsTestRule<MainActivity> activityRule =
|
|
|
|
MainActivity.class);
|
|
|
|
new IntentsTestRule<>(MainActivity.class);
|
|
|
|
|
|
|
|
|
|
|
|
private Context targetContext;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Before
|
|
|
|
@Before
|
|
|
|
public void setup()
|
|
|
|
public void setup()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Context context = InstrumentationRegistry.getInstrumentation().getContext();
|
|
|
|
Context context =
|
|
|
|
|
|
|
|
InstrumentationRegistry.getInstrumentation().getContext();
|
|
|
|
sys = new SystemHelper(context);
|
|
|
|
sys = new SystemHelper(context);
|
|
|
|
sys.disableAllAnimations();
|
|
|
|
sys.disableAllAnimations();
|
|
|
|
sys.acquireWakeLock();
|
|
|
|
sys.acquireWakeLock();
|
|
|
|
sys.unlockScreen();
|
|
|
|
sys.unlockScreen();
|
|
|
|
|
|
|
|
|
|
|
|
targetContext = InstrumentationRegistry.getTargetContext();
|
|
|
|
Instrumentation.ActivityResult okResult =
|
|
|
|
|
|
|
|
new Instrumentation.ActivityResult(Activity.RESULT_OK,
|
|
|
|
Instrumentation.ActivityResult okResult = new Instrumentation.ActivityResult(
|
|
|
|
new Intent());
|
|
|
|
Activity.RESULT_OK, new Intent());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
intending(hasAction(equalTo(Intent.ACTION_SEND))).respondWith(okResult);
|
|
|
|
intending(hasAction(equalTo(Intent.ACTION_SEND))).respondWith(okResult);
|
|
|
|
intending(hasAction(equalTo(Intent.ACTION_SENDTO))).respondWith(okResult);
|
|
|
|
intending(hasAction(equalTo(Intent.ACTION_SENDTO))).respondWith(
|
|
|
|
|
|
|
|
okResult);
|
|
|
|
intending(hasAction(equalTo(Intent.ACTION_VIEW))).respondWith(okResult);
|
|
|
|
intending(hasAction(equalTo(Intent.ACTION_VIEW))).respondWith(okResult);
|
|
|
|
|
|
|
|
|
|
|
|
skipTutorial();
|
|
|
|
skipTutorial();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@After
|
|
|
|
|
|
|
|
public void tearDown()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
sys.releaseWakeLock();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void skipTutorial()
|
|
|
|
public void skipTutorial()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
onView(allOf(withClassName(endsWith("AppCompatImageButton")),
|
|
|
|
onView(allOf(withClassName(endsWith("AppCompatImageButton")),
|
|
|
|
isDisplayed())).perform(click());
|
|
|
|
isDisplayed())).perform(click());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (NoMatchingViewException e)
|
|
|
|
catch (NoMatchingViewException e)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -136,44 +95,57 @@ public class MainTest
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@After
|
|
|
|
|
|
|
|
public void tearDown()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
sys.releaseWakeLock();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* User opens the app, creates some habits, selects them, archives them, select 'show archived'
|
|
|
|
* User opens menu, clicks about, sees about screen.
|
|
|
|
* on the menu, selects the previously archived habits and then deletes them.
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testArchiveHabits()
|
|
|
|
public void testAbout()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
List<String> names = new LinkedList<>();
|
|
|
|
clickMenuItem(R.string.about);
|
|
|
|
|
|
|
|
onView(isRoot()).perform(swipeUp());
|
|
|
|
for(int i = 0; i < 3; i++)
|
|
|
|
}
|
|
|
|
names.add(addHabit());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
selectHabits(names);
|
|
|
|
/**
|
|
|
|
|
|
|
|
* User creates a habit, toggles a bunch of checkmarks, clicks the habit to
|
|
|
|
|
|
|
|
* open the statistics screen, scrolls down to some views, then scrolls the
|
|
|
|
|
|
|
|
* views backwards and forwards in time.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void testAddHabitAndViewStats() throws InterruptedException
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
String name = addHabit(true);
|
|
|
|
|
|
|
|
|
|
|
|
clickMenuItem(R.string.archive);
|
|
|
|
onData(Matchers.allOf(is(instanceOf(HabitRecord.class)),
|
|
|
|
assertHabitsDontExist(names);
|
|
|
|
HabitMatchers.withName(name)))
|
|
|
|
|
|
|
|
.onChildView(withId(R.id.checkmarkPanel))
|
|
|
|
|
|
|
|
.perform(toggleAllCheckmarks());
|
|
|
|
|
|
|
|
|
|
|
|
clickMenuItem(R.string.show_archived);
|
|
|
|
Thread.sleep(1200);
|
|
|
|
|
|
|
|
|
|
|
|
assertHabitsExist(names);
|
|
|
|
onData(Matchers.allOf(is(instanceOf(HabitRecord.class)),
|
|
|
|
selectHabits(names);
|
|
|
|
HabitMatchers.withName(name)))
|
|
|
|
clickMenuItem(R.string.unarchive);
|
|
|
|
.onChildView(withId(R.id.label))
|
|
|
|
|
|
|
|
.perform(click());
|
|
|
|
|
|
|
|
|
|
|
|
clickMenuItem(R.string.show_archived);
|
|
|
|
onView(withId(R.id.scoreView)).perform(scrollTo(), swipeRight());
|
|
|
|
|
|
|
|
|
|
|
|
assertHabitsExist(names);
|
|
|
|
onView(withId(R.id.punchcardView)).perform(scrollTo(), swipeRight());
|
|
|
|
deleteHabits(names);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* User opens the app, clicks the add button, types some bogus information, tries to save,
|
|
|
|
* User opens the app, clicks the add button, types some bogus information,
|
|
|
|
* dialog displays an error.
|
|
|
|
* tries to save, dialog displays an error.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testAddInvalidHabit()
|
|
|
|
public void testAddInvalidHabit()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
onView(withId(R.id.action_add))
|
|
|
|
onView(withId(R.id.action_add)).perform(click());
|
|
|
|
.perform(click());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typeHabitData("", "", "15", "7");
|
|
|
|
typeHabitData("", "", "15", "7");
|
|
|
|
|
|
|
|
|
|
|
@ -182,55 +154,56 @@ public class MainTest
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* User creates a habit, toggles a bunch of checkmarks, clicks the habit to open the statistics
|
|
|
|
* User opens the app, creates some habits, selects them, archives them,
|
|
|
|
* screen, scrolls down to some views, then scrolls the views backwards and forwards in time.
|
|
|
|
* select 'show archived' on the menu, selects the previously archived
|
|
|
|
|
|
|
|
* habits and then deletes them.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testAddHabitAndViewStats() throws InterruptedException
|
|
|
|
public void testArchiveHabits()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
String name = addHabit(true);
|
|
|
|
List<String> names = new LinkedList<>();
|
|
|
|
|
|
|
|
|
|
|
|
onData(
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
Matchers.allOf(is(instanceOf(HabitRecord.class)), HabitMatchers.withName(name)))
|
|
|
|
names.add(addHabit());
|
|
|
|
.onChildView(withId(R.id.checkmarkPanel))
|
|
|
|
|
|
|
|
.perform(toggleAllCheckmarks());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thread.sleep(1200);
|
|
|
|
selectHabits(names);
|
|
|
|
|
|
|
|
|
|
|
|
onData(
|
|
|
|
clickMenuItem(R.string.archive);
|
|
|
|
Matchers.allOf(is(instanceOf(HabitRecord.class)), HabitMatchers.withName(name)))
|
|
|
|
assertHabitsDontExist(names);
|
|
|
|
.onChildView(withId(R.id.label))
|
|
|
|
|
|
|
|
.perform(click());
|
|
|
|
clickMenuItem(R.string.show_archived);
|
|
|
|
|
|
|
|
|
|
|
|
onView(withId(R.id.scoreView))
|
|
|
|
assertHabitsExist(names);
|
|
|
|
.perform(scrollTo(), swipeRight());
|
|
|
|
selectHabits(names);
|
|
|
|
|
|
|
|
clickMenuItem(R.string.unarchive);
|
|
|
|
|
|
|
|
|
|
|
|
onView(withId(R.id.punchcardView))
|
|
|
|
clickMenuItem(R.string.show_archived);
|
|
|
|
.perform(scrollTo(), swipeRight());
|
|
|
|
|
|
|
|
|
|
|
|
assertHabitsExist(names);
|
|
|
|
|
|
|
|
deleteHabits(names);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* User creates a habit, selects the habit, clicks edit button, changes some information about
|
|
|
|
* User creates a habit, selects the habit, clicks edit button, changes some
|
|
|
|
* the habit, click save button, sees changes on the main window, selects habit again,
|
|
|
|
* information about the habit, click save button, sees changes on the main
|
|
|
|
* changes color, then deletes the habit.
|
|
|
|
* window, selects habit again, changes color, then deletes the habit.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testEditHabit()
|
|
|
|
public void testEditHabit()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
String name = addHabit();
|
|
|
|
String name = addHabit();
|
|
|
|
|
|
|
|
|
|
|
|
onData(
|
|
|
|
onData(Matchers.allOf(is(instanceOf(HabitRecord.class)),
|
|
|
|
Matchers.allOf(is(instanceOf(HabitRecord.class)), HabitMatchers.withName(name)))
|
|
|
|
HabitMatchers.withName(name)))
|
|
|
|
.onChildView(withId(R.id.label))
|
|
|
|
.onChildView(withId(R.id.label))
|
|
|
|
.perform(longClick());
|
|
|
|
.perform(longClick());
|
|
|
|
|
|
|
|
|
|
|
|
clickMenuItem(R.string.edit);
|
|
|
|
clickMenuItem(R.string.edit);
|
|
|
|
|
|
|
|
|
|
|
|
String modifiedName = "Modified " + new Random().nextInt(10000);
|
|
|
|
String modifiedName = "Modified " + new Random().nextInt(10000);
|
|
|
|
typeHabitData(modifiedName, "", "1", "1");
|
|
|
|
typeHabitData(modifiedName, "", "1", "1");
|
|
|
|
|
|
|
|
|
|
|
|
onView(withId(R.id.buttonSave))
|
|
|
|
onView(withId(R.id.buttonSave)).perform(click());
|
|
|
|
.perform(click());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertHabitExists(modifiedName);
|
|
|
|
assertHabitExists(modifiedName);
|
|
|
|
|
|
|
|
|
|
|
@ -242,60 +215,45 @@ public class MainTest
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* User creates a habit, opens statistics page, clicks button to edit history, adds some
|
|
|
|
* User creates a habit, opens statistics page, clicks button to edit
|
|
|
|
* checkmarks, closes dialog, sees the modified history calendar.
|
|
|
|
* history, adds some checkmarks, closes dialog, sees the modified history
|
|
|
|
|
|
|
|
* calendar.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testEditHistory()
|
|
|
|
public void testEditHistory()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
String name = addHabit();
|
|
|
|
String name = addHabit();
|
|
|
|
|
|
|
|
|
|
|
|
onData(
|
|
|
|
onData(Matchers.allOf(is(instanceOf(HabitRecord.class)),
|
|
|
|
Matchers.allOf(is(instanceOf(HabitRecord.class)), HabitMatchers.withName(name)))
|
|
|
|
HabitMatchers.withName(name)))
|
|
|
|
.onChildView(withId(R.id.label))
|
|
|
|
.onChildView(withId(R.id.label))
|
|
|
|
.perform(click());
|
|
|
|
.perform(click());
|
|
|
|
|
|
|
|
|
|
|
|
openHistoryEditor();
|
|
|
|
openHistoryEditor();
|
|
|
|
onView(withClassName(endsWith("HabitHistoryView")))
|
|
|
|
onView(withClassName(endsWith("HabitHistoryView"))).perform(
|
|
|
|
.perform(clickAtRandomLocations(20));
|
|
|
|
clickAtRandomLocations(20));
|
|
|
|
|
|
|
|
|
|
|
|
pressBack();
|
|
|
|
pressBack();
|
|
|
|
onView(withId(R.id.historyView))
|
|
|
|
onView(withId(R.id.historyView)).perform(scrollTo(), swipeRight(),
|
|
|
|
.perform(scrollTo(), swipeRight(), swipeLeft());
|
|
|
|
swipeLeft());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* User opens menu, clicks settings, sees settings screen.
|
|
|
|
* User creates a habit, opens settings, clicks export as CSV, is asked what
|
|
|
|
|
|
|
|
* activity should handle the file.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testSettings()
|
|
|
|
public void testExportCSV()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
addHabit();
|
|
|
|
clickMenuItem(R.string.settings);
|
|
|
|
clickMenuItem(R.string.settings);
|
|
|
|
|
|
|
|
clickSettingsItem("Export as CSV");
|
|
|
|
|
|
|
|
intended(hasAction(Intent.ACTION_SEND));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* User opens menu, clicks about, sees about screen.
|
|
|
|
* User creates a habit, exports full backup, deletes the habit, restores
|
|
|
|
*/
|
|
|
|
* backup, sees that the previously created habit has appeared back.
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void testAbout()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
clickMenuItem(R.string.about);
|
|
|
|
|
|
|
|
onView(isRoot()).perform(swipeUp());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* User opens menu, clicks Help, sees website.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void testHelp()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
clickMenuItem(R.string.help);
|
|
|
|
|
|
|
|
intended(hasAction(Intent.ACTION_VIEW));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* User creates a habit, exports full backup, deletes the habit, restores backup, sees that the
|
|
|
|
|
|
|
|
* previously created habit has appeared back.
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testExportImportDB()
|
|
|
|
public void testExportImportDB()
|
|
|
@ -304,7 +262,8 @@ public class MainTest
|
|
|
|
|
|
|
|
|
|
|
|
clickMenuItem(R.string.settings);
|
|
|
|
clickMenuItem(R.string.settings);
|
|
|
|
|
|
|
|
|
|
|
|
String date = DateUtils.getBackupDateFormat().format(DateUtils.getLocalTime());
|
|
|
|
String date =
|
|
|
|
|
|
|
|
DateUtils.getBackupDateFormat().format(DateUtils.getLocalTime());
|
|
|
|
date = date.substring(0, date.length() - 2);
|
|
|
|
date = date.substring(0, date.length() - 2);
|
|
|
|
|
|
|
|
|
|
|
|
clickSettingsItem("Export full backup");
|
|
|
|
clickSettingsItem("Export full backup");
|
|
|
@ -315,36 +274,44 @@ public class MainTest
|
|
|
|
clickMenuItem(R.string.settings);
|
|
|
|
clickMenuItem(R.string.settings);
|
|
|
|
clickSettingsItem("Import data");
|
|
|
|
clickSettingsItem("Import data");
|
|
|
|
|
|
|
|
|
|
|
|
onData(allOf(is(instanceOf(String.class)), startsWith("Backups")))
|
|
|
|
onData(
|
|
|
|
.perform(click());
|
|
|
|
allOf(is(instanceOf(String.class)), startsWith("Backups"))).perform(
|
|
|
|
|
|
|
|
click());
|
|
|
|
|
|
|
|
|
|
|
|
onData(allOf(is(instanceOf(String.class)), containsString(date)))
|
|
|
|
onData(
|
|
|
|
.perform(click());
|
|
|
|
allOf(is(instanceOf(String.class)), containsString(date))).perform(
|
|
|
|
|
|
|
|
click());
|
|
|
|
|
|
|
|
|
|
|
|
selectHabit(name);
|
|
|
|
selectHabit(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* User creates a habit, opens settings, clicks export as CSV, is asked what activity should
|
|
|
|
* User opens the settings and generates a bug report.
|
|
|
|
* handle the file.
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testExportCSV()
|
|
|
|
public void testGenerateBugReport()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
addHabit();
|
|
|
|
|
|
|
|
clickMenuItem(R.string.settings);
|
|
|
|
clickMenuItem(R.string.settings);
|
|
|
|
clickSettingsItem("Export as CSV");
|
|
|
|
clickSettingsItem("Generate bug report");
|
|
|
|
intended(hasAction(Intent.ACTION_SEND));
|
|
|
|
intended(hasAction(Intent.ACTION_SEND));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* User opens the settings and generates a bug report.
|
|
|
|
* User opens menu, clicks Help, sees website.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testGenerateBugReport()
|
|
|
|
public void testHelp()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
clickMenuItem(R.string.help);
|
|
|
|
|
|
|
|
intended(hasAction(Intent.ACTION_VIEW));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* User opens menu, clicks settings, sees settings screen.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void testSettings()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
clickMenuItem(R.string.settings);
|
|
|
|
clickMenuItem(R.string.settings);
|
|
|
|
clickSettingsItem("Generate bug report");
|
|
|
|
|
|
|
|
intended(hasAction(Intent.ACTION_SEND));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|