File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
as/src/androidTest/java/com/trikset/gamepad Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 2929import static androidx .test .espresso .matcher .ViewMatchers .withContentDescription ;
3030import static androidx .test .espresso .matcher .ViewMatchers .withId ;
3131import static androidx .test .espresso .matcher .ViewMatchers .withText ;
32+ import static androidx .test .platform .app .InstrumentationRegistry .getInstrumentation ;
3233import static org .hamcrest .Matchers .allOf ;
3334import static org .hamcrest .Matchers .is ;
3435import static org .junit .Assert .assertEquals ;
3839public class SettingsTests {
3940
4041 @ Rule
41- public ActivityTestRule <MainActivity > mActivityTestRule = new ActivityTestRule <>(MainActivity .class );
42+ public ActivityTestRule <MainActivity > mActivityTestRule =
43+ new ActivityTestRule <MainActivity >(MainActivity .class ) {
44+ @ Override
45+ protected void beforeActivityLaunched () {
46+ SharedPreferences preferences =
47+ PreferenceManager .getDefaultSharedPreferences (getInstrumentation ().getTargetContext ());
48+ preferences .edit ().clear ().commit ();
49+ }
50+ };
4251
4352 @ Test
4453 public void settingsShouldWorkCorrectly () {
You can’t perform that action at this time.
0 commit comments