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

Commit 1c0b2326 authored by Tomasz Mikolajewski's avatar Tomasz Mikolajewski
Browse files

Fix flaky testLoadsHomebyDefault.

The test was resuming a previously opened activity, so naturally the
redirect to Home didn't happen.

This CL fixes the issue by closing the activity in TearDown().

Change-Id: I43e78a83c2b53c52745bc7eef515a8f759559e46
parent 4cf5a49e
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ public class FilesActivityUiTest extends InstrumentationTestCase {
    private ContentProviderClient mClient;
    private RootInfo mRoot_0;
    private RootInfo mRoot_1;
    private FilesActivity mActivity;

    public void setUp() throws Exception {
        // Initialize UiDevice instance.
@@ -76,7 +77,8 @@ public class FilesActivityUiTest extends InstrumentationTestCase {
        // Launch app.
        Intent intent = mContext.getPackageManager().getLaunchIntentForPackage(TARGET_PKG);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        mContext.startActivity(intent);
        mActivity = launchActivityWithIntent(TARGET_PKG, FilesActivity.class, intent);
        assertNotNull("Activity not started.", mActivity);

        // Wait for the app to appear.
        mDevice.wait(Until.hasObject(By.pkg(TARGET_PKG).depth(0)), TIMEOUT);
@@ -90,6 +92,12 @@ public class FilesActivityUiTest extends InstrumentationTestCase {
    @Override
    protected void tearDown() throws Exception {
        super.tearDown();

        if (mActivity != null) {
            mActivity.finish();
            mActivity = null;
        }

        Log.d(TAG, "Resetting storage from setUp");
        resetStorage();
        mClient.release();