mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-07 09:38:52 -06:00
@@ -31,9 +31,8 @@ import org.isoron.uhabits.core.ui.screens.habits.list.*;
|
||||
import org.isoron.uhabits.core.utils.*;
|
||||
import org.junit.*;
|
||||
|
||||
import static androidx.test.InstrumentationRegistry.getContext;
|
||||
import static androidx.test.InstrumentationRegistry.getTargetContext;
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
import static androidx.test.core.app.ApplicationProvider.*;
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.*;
|
||||
import static androidx.test.uiautomator.UiDevice.*;
|
||||
|
||||
public class BaseUserInterfaceTest
|
||||
@@ -59,18 +58,18 @@ public class BaseUserInterfaceTest
|
||||
intent.setComponent(new ComponentName(PKG, cls.getCanonicalName()));
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
getContext().startActivity(intent);
|
||||
getApplicationContext().startActivity(intent);
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
device = getInstance(getInstrumentation());
|
||||
TestButler.setup(getTargetContext());
|
||||
TestButler.verifyAnimationsDisabled(getTargetContext());
|
||||
TestButler.setup(getApplicationContext());
|
||||
TestButler.verifyAnimationsDisabled(getApplicationContext());
|
||||
|
||||
HabitsApplication app =
|
||||
(HabitsApplication) getTargetContext().getApplicationContext();
|
||||
(HabitsApplication) getApplicationContext().getApplicationContext();
|
||||
component = app.getComponent();
|
||||
habitList = component.getHabitList();
|
||||
prefs = component.getPreferences();
|
||||
@@ -83,7 +82,7 @@ public class BaseUserInterfaceTest
|
||||
public void tearDown() throws Exception
|
||||
{
|
||||
for (int i = 0; i < 10; i++) device.pressBack();
|
||||
TestButler.teardown(getTargetContext());
|
||||
TestButler.teardown(getApplicationContext());
|
||||
}
|
||||
|
||||
private void resetState() throws Exception
|
||||
|
||||
@@ -19,16 +19,15 @@
|
||||
|
||||
package org.isoron.uhabits.acceptance.steps;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.*;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.annotation.*;
|
||||
import androidx.recyclerview.widget.*;
|
||||
import androidx.test.espresso.*;
|
||||
import androidx.test.espresso.contrib.*;
|
||||
import androidx.test.uiautomator.*;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.*;
|
||||
import org.isoron.uhabits.*;
|
||||
import org.isoron.uhabits.R;
|
||||
import org.isoron.uhabits.activities.habits.list.*;
|
||||
@@ -39,8 +38,8 @@ import static androidx.test.espresso.action.ViewActions.*;
|
||||
import static androidx.test.espresso.assertion.PositionAssertions.*;
|
||||
import static androidx.test.espresso.assertion.ViewAssertions.*;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.*;
|
||||
import static junit.framework.Assert.*;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class CommonSteps extends BaseUserInterfaceTest
|
||||
{
|
||||
@@ -125,7 +124,7 @@ public class CommonSteps extends BaseUserInterfaceTest
|
||||
verifyDisplaysText(text[0]);
|
||||
for(int i = 1; i < text.length; i++) {
|
||||
verifyDisplaysText(text[i]);
|
||||
onView(withText(text[i])).check(isBelow(withText(text[i-1])));
|
||||
onView(withText(text[i])).check(isCompletelyBelow(withText(text[i-1])));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ package org.isoron.uhabits.acceptance.steps;
|
||||
import androidx.test.uiautomator.*;
|
||||
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
import static junit.framework.Assert.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.isoron.uhabits.BaseUserInterfaceTest.*;
|
||||
|
||||
public class WidgetSteps {
|
||||
|
||||
Reference in New Issue
Block a user