Skip to content

Commit

Permalink
fixup! Ensure that activities are fully deleted between tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amberin committed Mar 17, 2024
1 parent 72d5041 commit 07f4818
Showing 1 changed file with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public void testEditChangeState() {
@Test
public void testToggleState() {
testUtils.setupBook("book-one", "* Note");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

searchForText("Note");
onNoteInSearch(0).perform(longClick());
Expand Down Expand Up @@ -277,7 +277,7 @@ public void testSearchExpressionsDefaultPriority() {
"** [#C] Note D.\n" +
"*** TODO Note E.");
testUtils.setupBook("book-two", "* Note #1.\n");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

searchForText("p.b");
onView(withId(R.id.fragment_query_search_view_flipper)).check(matches(isDisplayed()));
Expand All @@ -301,7 +301,7 @@ public void testMultipleNotState() {
"*** DONE Note #5.\n" +
"CLOSED: [2014-06-03 Tue 13:34]\n" +
"");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

searchForText(".i.todo .i.done");
onView(withId(R.id.fragment_query_search_view_flipper)).check(matches(isDisplayed()));
Expand All @@ -316,7 +316,7 @@ public void testMultipleNotState() {
public void testNotesWithSameScheduledTimeString() throws IOException {
testUtils.setupBook("notebook-1", "* Note A\nSCHEDULED: <2014-01-01>");
testUtils.setupBook("notebook-2", "* Note B\nSCHEDULED: <2014-01-01>");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

searchForText("s.today");
onView(withId(R.id.fragment_query_search_view_flipper)).check(matches(isDisplayed()));
Expand All @@ -327,7 +327,7 @@ public void testNotesWithSameScheduledTimeString() throws IOException {
public void testNotesWithSameDeadlineTimeString() throws IOException {
testUtils.setupBook("notebook-1", "* Note A\nDEADLINE: <2014-01-01>");
testUtils.setupBook("notebook-2", "* Note B\nDEADLINE: <2014-01-01>");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

searchForText("d.today");
onView(withId(R.id.fragment_query_search_view_flipper)).check(matches(isDisplayed()));
Expand All @@ -337,7 +337,7 @@ public void testNotesWithSameDeadlineTimeString() throws IOException {
@Test
public void testClosedTimeSearch() {
testUtils.setupBook("notebook-1", "* Note A\nCLOSED: [2014-01-01]");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

searchForText("c.ge.-2d");
onView(withId(R.id.fragment_query_search_view_flipper)).check(matches(isDisplayed()));
Expand All @@ -353,7 +353,7 @@ public void testInheritedTagSearchWhenMultipleAncestorsMatch() {
"*** Note C\n" +
"*** Note D\n" +
"");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook-1"), isDisplayed())).perform(click());
searchForText("t.tag");
Expand All @@ -369,7 +369,7 @@ public void testInheritedAndOwnTag() {
"*** Note C\n" +
"*** Note D\n" +
"");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook-1"), isDisplayed())).perform(click());
searchForText("t.tag1 t.tag2");
Expand All @@ -388,7 +388,7 @@ public void testInheritedTagsAfterMovingNote() {
"*** Note C :tag3:\n" +
"*** Note D :tag3:\n" +
"");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook-1"), isDisplayed())).perform(click());

Expand Down Expand Up @@ -416,7 +416,7 @@ public void testInheritedTagsAfterDemotingSubtree() {
"** Note C :tag3:\n" +
"** Note D :tag3:\n" +
"");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook-1"), isDisplayed())).perform(click());

Expand Down Expand Up @@ -444,7 +444,7 @@ public void testInheritedTagsAfterCutAndPasting() {
"** Note C :tag3:\n" +
"** Note D :tag3:\n" +
"");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook-1"), isDisplayed())).perform(click());

Expand Down Expand Up @@ -477,7 +477,7 @@ public void testSearchOrderScheduled() {
"*** Note C\n" +
"*** Note D\n" +
"");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook-1"), isDisplayed())).perform(click());
searchForText("note o.scheduled");
Expand All @@ -498,7 +498,7 @@ public void testOrderScheduledWithAndWithoutTimePart() {
"*** DONE Note D\n" +
"SCHEDULED: <2014-01-03>\n" +
"");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook-1"), isDisplayed())).perform(click());
searchForText("s.today .i.done o.s");
Expand All @@ -520,7 +520,7 @@ public void testOrderDeadlineWithAndWithoutTimePartDesc() {
"*** DONE Note D\n" +
"DEADLINE: <2014-01-03>\n" +
"");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook-1"), isDisplayed())).perform(click());
searchForText("d.today .i.done .o.d");
Expand Down Expand Up @@ -567,7 +567,7 @@ public void testSearchForNonExistentTagShouldReturnAllNotes() {
"** Note B :b:\n" +
"*** Note C\n" +
"* Note D\n");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook"), isDisplayed())).perform(click());
searchForText(".t.c");
Expand All @@ -582,7 +582,7 @@ public void testNotTagShouldReturnSomeNotes() {
"** Note B :b:\n" +
"*** Note C\n" +
"* Note D\n");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook"), isDisplayed())).perform(click());
searchForText(".t.b");
Expand All @@ -599,7 +599,7 @@ public void testSearchForTagOrTag() {
"** Note B :b:\n" +
"*** Note C\n" +
"* Note D\n");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook"), isDisplayed())).perform(click());
searchForText("tn.a or tn.b");
Expand All @@ -616,7 +616,7 @@ public void testSortByPriority() {
"** [#A] Note B :b:\n" +
"*** [#C] Note C\n" +
"* Note D\n");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook"), isDisplayed())).perform(click());
searchForText("o.p");
Expand All @@ -634,7 +634,7 @@ public void testSortByPriorityDesc() {
"** [#A] Note B :b:\n" +
"*** [#C] Note C\n" +
"* Note D\n");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook"), isDisplayed())).perform(click());
searchForText(".o.p");
Expand All @@ -653,7 +653,7 @@ public void testSearchNoteStateType() {
"** NEXT Note B :b:\n" +
"* DONE Note C\n" +
"* Note D\n");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook"), isDisplayed())).perform(click());
searchForText(".it.todo");
Expand All @@ -671,7 +671,7 @@ public void testSearchStateType() {
"** NEXT Note B :b:\n" +
"* DONE Note C\n" +
"* Note D\n");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook"), isDisplayed())).perform(click());
searchForText("it.todo");
Expand All @@ -689,7 +689,7 @@ public void testSearchNoState() {
"** NEXT Note B :b:\n" +
"* DONE Note C\n" +
"* Note D\n");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook"), isDisplayed())).perform(click());
searchForText("it.none");
Expand All @@ -706,7 +706,7 @@ public void testSearchWithState() {
"** NEXT Note B :b:\n" +
"* DONE Note C\n" +
"* Note D\n");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook"), isDisplayed())).perform(click());
searchForText(".it.none");
Expand All @@ -725,7 +725,7 @@ public void testContentOfFoldedNoteDisplayed() {
"** Note B\n" +
"Content for Note B\n" +
"* Note C\n");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onView(allOf(withText("notebook"), isDisplayed())).perform(click());
onNoteInBook(1, R.id.item_head_fold_button).perform(click());
Expand All @@ -739,7 +739,7 @@ public void testContentOfFoldedNoteDisplayed() {
@Test
public void testDeSelectRemovedNoteInSearch() {
testUtils.setupBook("notebook", "* TODO Note A\n* TODO Note B");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

searchForText("i.todo");

Expand All @@ -764,7 +764,7 @@ public void testDeSelectRemovedNoteInSearch() {

@Test
public void testNoNotesFoundMessageIsDisplayedInSearch() {
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);
searchForText("Note");
onView(withText(R.string.no_notes_found_after_search)).check(matches(isDisplayed()));
}
Expand All @@ -773,7 +773,7 @@ public void testNoNotesFoundMessageIsDisplayedInSearch() {
@Test
public void testPreselectedStateOfSelectedNote() {
testUtils.setupBook("notebook", "* TODO Note A\n* TODO Note B");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

searchForText("i.todo");

Expand All @@ -787,23 +787,23 @@ public void testPreselectedStateOfSelectedNote() {
@Test
public void testSearchAndClickOnNoteWithTwoDifferentEvents() {
testUtils.setupBook("notebook", "* Note\n<2000-01-01>\n<2000-01-02>");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);
searchForText("e.lt.now");
onNoteInSearch(0).perform(click());
}

@Test
public void testInactiveScheduled() {
testUtils.setupBook("notebook-1", "* Note A\nSCHEDULED: [2020-07-01]");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);
searchForText("s.le.today");
onNotesInSearch().check(matches(recyclerViewItemCount(0)));
}

@Test
public void testInactiveDeadline() {
testUtils.setupBook("notebook-1", "* Note A\nDEADLINE: [2020-07-01]");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);
searchForText("d.le.today");
onNotesInSearch().check(matches(recyclerViewItemCount(0)));
}
Expand All @@ -820,7 +820,7 @@ public void testScheduledTimestamp() {

testUtils.setupBook("notebook-1", "* Note A\nSCHEDULED: " + inOneHour);

ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);

onBook(0).perform(click());

Expand All @@ -839,7 +839,7 @@ public void testScheduledTimestamp() {
@Test
public void testNotScheduled() {
testUtils.setupBook("notebook-1", "* Note A");
ActivityScenario.launch(MainActivity.class);
scenario = ActivityScenario.launch(MainActivity.class);
searchForText("s.no");
onNotesInSearch().check(matches(recyclerViewItemCount(1)));
}
Expand Down

0 comments on commit 07f4818

Please sign in to comment.