replace strings by refrences

This commit is contained in:
siddharth2010 2018-06-29 01:23:31 +05:30 committed by Isaac Hutt
parent d1e91dca4a
commit cde713dd0f

View File

@ -39,6 +39,7 @@ import static org.kiwix.kiwixmobile.utils.StandardActions.enterSettings;
@LargeTest @LargeTest
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class IntroActivityTest { public class IntroActivityTest {
@Rule @Rule
public BaristaRule<IntroActivity> activityTestRule = BaristaRule.create(IntroActivity.class); public BaristaRule<IntroActivity> activityTestRule = BaristaRule.create(IntroActivity.class);
@Rule @Rule
@ -47,12 +48,28 @@ public class IntroActivityTest {
public GrantPermissionRule writePermissionRule = GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE); public GrantPermissionRule writePermissionRule = GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE);
@Test @Test
public void FinalSimple() { public void testUIHierarchy(){
activityTestRule.launchActivity();
BaristaSleepInteractions.sleep(TEST_PAUSE_MS);
ViewInteraction customViewPager = onView(withId(R.id.view_pager));
// Verify that the sliding view is working properly
customViewPager.perform(swipeLeft());
onView(allOf(withId(R.id.heading), withText(R.string.save_books_offline), isDisplayed()))
.check(matches(notNullValue()));
onView(allOf(withId(R.id.subheading), withText(R.string.download_books_message), isDisplayed()))
.check(matches(notNullValue()));
BaristaSleepInteractions.sleep(TEST_PAUSE_MS);
customViewPager.perform(swipeRight());
onView(allOf(withId(R.id.heading), withText(R.string.welcome_to_the_family), isDisplayed()))
.check(matches(notNullValue()));
onView(allOf(withId(R.id.subheading), withText(R.string.human_kind_knowledge), isDisplayed()))
.check(matches(notNullValue()));
} }
@Test @Test
public void navigateHelp() { public void testIntentCreated() {
activityTestRule.launchActivity(); activityTestRule.launchActivity();
BaristaSleepInteractions.sleep(TEST_PAUSE_MS); BaristaSleepInteractions.sleep(TEST_PAUSE_MS);
Intents.init(); Intents.init();
@ -65,25 +82,4 @@ public class IntroActivityTest {
// Test the intent generated for MainActivity // Test the intent generated for MainActivity
intended(hasComponent(MainActivity.class.getName())); intended(hasComponent(MainActivity.class.getName()));
} }
@Test
public void test2(){
activityTestRule.launchActivity();
BaristaSleepInteractions.sleep(TEST_PAUSE_MS);
ViewInteraction customViewPager = onView(withId(R.id.view_pager));
// Verify that the sliding view is working properly
customViewPager.perform(swipeLeft());
onView(allOf(withId(R.id.heading), withText("Save books offline"), isDisplayed()))
.check(matches(notNullValue()));
onView(allOf(withId(R.id.subheading), withText("Download books and read wherever you are."), isDisplayed()))
.check(matches(notNullValue()));
BaristaSleepInteractions.sleep(TEST_PAUSE_MS);
customViewPager.perform(swipeRight());
onView(allOf(withId(R.id.heading), withText("Welcome to the family"), isDisplayed()))
.check(matches(notNullValue()));
onView(allOf(withId(R.id.subheading), withText("Human kind's knowledge, on your phone."), isDisplayed()))
.check(matches(notNullValue()));
}
} }