mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Changes pulled in from whym/apps-android-commons.
This commit is contained in:
parent
a91d32f22a
commit
2e4b25aa99
1 changed files with 8 additions and 20 deletions
|
|
@ -9,9 +9,8 @@ import android.support.test.espresso.matcher.ViewMatchers;
|
||||||
import android.support.test.filters.LargeTest;
|
import android.support.test.filters.LargeTest;
|
||||||
import android.support.test.rule.ActivityTestRule;
|
import android.support.test.rule.ActivityTestRule;
|
||||||
import android.support.test.runner.AndroidJUnit4;
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import org.hamcrest.Matcher;
|
import org.hamcrest.Matchers;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
@ -20,9 +19,6 @@ import java.util.Map;
|
||||||
|
|
||||||
import fr.free.nrw.commons.settings.SettingsActivity;
|
import fr.free.nrw.commons.settings.SettingsActivity;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.allOf;
|
|
||||||
import static org.hamcrest.Matchers.anything;
|
|
||||||
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class SettingsActivityTest {
|
public class SettingsActivityTest {
|
||||||
|
|
@ -65,8 +61,8 @@ public class SettingsActivityTest {
|
||||||
@Test
|
@Test
|
||||||
public void oneLicenseIsChecked() {
|
public void oneLicenseIsChecked() {
|
||||||
// click "License" (the first item)
|
// click "License" (the first item)
|
||||||
Espresso.onData(anything())
|
Espresso.onData(Matchers.anything())
|
||||||
.inAdapterView(findPreferenceList())
|
.inAdapterView(ViewMatchers.withId(android.R.id.list))
|
||||||
.atPosition(0)
|
.atPosition(0)
|
||||||
.perform(ViewActions.click());
|
.perform(ViewActions.click());
|
||||||
|
|
||||||
|
|
@ -78,8 +74,8 @@ public class SettingsActivityTest {
|
||||||
@Test
|
@Test
|
||||||
public void afterClickingCcby4ItWillStay() {
|
public void afterClickingCcby4ItWillStay() {
|
||||||
// click "License" (the first item)
|
// click "License" (the first item)
|
||||||
Espresso.onData(anything())
|
Espresso.onData(Matchers.anything())
|
||||||
.inAdapterView(findPreferenceList())
|
.inAdapterView(ViewMatchers.withId(android.R.id.list))
|
||||||
.atPosition(0)
|
.atPosition(0)
|
||||||
.perform(ViewActions.click());
|
.perform(ViewActions.click());
|
||||||
|
|
||||||
|
|
@ -89,8 +85,8 @@ public class SettingsActivityTest {
|
||||||
).perform(ViewActions.click());
|
).perform(ViewActions.click());
|
||||||
|
|
||||||
// click "License" (the first item)
|
// click "License" (the first item)
|
||||||
Espresso.onData(anything())
|
Espresso.onData(Matchers.anything())
|
||||||
.inAdapterView(findPreferenceList())
|
.inAdapterView(ViewMatchers.withId(android.R.id.list))
|
||||||
.atPosition(0)
|
.atPosition(0)
|
||||||
.perform(ViewActions.click());
|
.perform(ViewActions.click());
|
||||||
|
|
||||||
|
|
@ -100,12 +96,4 @@ public class SettingsActivityTest {
|
||||||
ViewMatchers.withText(R.string.license_name_cc_by_four)
|
ViewMatchers.withText(R.string.license_name_cc_by_four)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private static Matcher<View> findPreferenceList() {
|
|
||||||
return allOf(
|
|
||||||
ViewMatchers.isDescendantOfA(ViewMatchers.withId(R.id.settingsFragment)),
|
|
||||||
ViewMatchers.withResourceName("list"),
|
|
||||||
ViewMatchers.hasFocus()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue