Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 973427b1 authored by Diksha Gohlyan's avatar Diksha Gohlyan
Browse files

Make search tests not flaky

Test: atest DocumentsUIGoogleTests
Bug: 156759046

Change-Id: I37f1e6ca8a99befceb6db19d3c089ece784ba516
parent cd73fc80
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -412,12 +412,16 @@ public final class SearchViewManagerTest {
        mSearchViewManager.onClick(null);
        mSearchChipViewManager.mCheckedChipItems = getFakeSearchChipDataList();

        final long startTime = LocalDate.now().minusDays(7).atStartOfDay(ZoneId.systemDefault())
                .toInstant().toEpochMilli();

        final Bundle queryArgs = mSearchViewManager.buildQueryArgs();
        assertFalse(queryArgs.isEmpty());

        final long endTime  = LocalDate.now().minusDays(7).atStartOfDay(ZoneId.systemDefault())
                .toInstant().toEpochMilli();
        final long weekAgoTime = queryArgs.getLong(QUERY_ARG_LAST_MODIFIED_AFTER);
        assertEquals(LocalDate.now().minusDays(7).atStartOfDay(ZoneId.systemDefault())
                .toInstant().toEpochMilli(), weekAgoTime);
        assertTrue(weekAgoTime == endTime || weekAgoTime == startTime);
    }

    @Test