Fixes:#4073 Old UI tests related with nav menu and user icon are deleted. (#4213)

This commit is contained in:
Roshan Prakash Raut 2021-02-16 16:01:52 +05:30 committed by GitHub
parent 2695bbaf4b
commit a8bbd416da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 69 deletions

View file

@ -29,7 +29,6 @@ class AchievementsActivityTest {
@Test
fun testAchievements() {
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open())
onView(withId(R.id.user_icon)).perform(click())
Intents.intended(hasComponent(ProfileActivity::class.java.name))
}

View file

@ -45,7 +45,6 @@ class LeaderboardActivityTest {
@Test
fun testScrollToRankFromAbove() {
Espresso.onView(ViewMatchers.withId(R.id.drawer_layout)).perform(DrawerActions.open())
Espresso.onView(ViewMatchers.withId(R.id.user_icon)).perform(ViewActions.click())
Espresso.onView(ViewMatchers.withId(R.id.tab_layout)).perform(ViewActions.click())
Espresso.onView(ViewMatchers.withId(R.id.tab_layout)).perform(selectTabAtPosition(1))
@ -58,7 +57,6 @@ class LeaderboardActivityTest {
@Test
fun testScrollToRankFromBelow() {
Espresso.onView(ViewMatchers.withId(R.id.drawer_layout)).perform(DrawerActions.open())
Espresso.onView(ViewMatchers.withId(R.id.user_icon)).perform(ViewActions.click())
Espresso.onView(ViewMatchers.withId(R.id.tab_layout)).perform(ViewActions.click())
Espresso.onView(ViewMatchers.withId(R.id.tab_layout)).perform(selectTabAtPosition(1))

View file

@ -1,66 +0,0 @@
package fr.free.nrw.commons
import androidx.test.espresso.Espresso
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.contrib.DrawerActions
import androidx.test.espresso.contrib.NavigationViewActions
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.filters.LargeTest
import androidx.test.rule.ActivityTestRule
import androidx.test.runner.AndroidJUnit4
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@LargeTest
@RunWith(AndroidJUnit4::class)
class NavigationBaseActivityTest {
@get:Rule
var activityRule: ActivityTestRule<*> = ActivityTestRule(AboutActivity::class.java)
/**
* Goes through all the activities in the app and checks we don't crash
* NB: This is not realistic if we're not logged in; we can access 'home', 'notifications', 'settings' and 'achievements' which we wouldn't otherwise be able to.
*/
@Test
fun goThroughNavigationBaseActivityActivities() {
// Home
openNavigationDrawerAndNavigateTo(R.id.action_home)
// Explore
openNavigationDrawerAndNavigateTo(R.id.action_explore)
// Bookmarks
openNavigationDrawerAndNavigateTo(R.id.action_bookmarks)
// Reviews
openNavigationDrawerAndNavigateTo(R.id.action_review)
// Settings
openNavigationDrawerAndNavigateTo(R.id.action_settings)
// About
openNavigationDrawerAndNavigateTo(R.id.action_about)
// Tutorial
openNavigationDrawerAndNavigateTo(R.id.action_introduction)
Espresso.pressBack()
// Achievements
openNavigationDrawerAndNavigateTo(R.id.action_login)
// Feedback
openNavigationDrawerAndNavigateTo(R.id.action_feedback)
}
private fun openNavigationDrawerAndNavigateTo(menuItemId: Int) {
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open())
UITestHelper.sleep(500)
onView(withId(R.id.navigation_view)).perform(NavigationViewActions.navigateTo(menuItemId))
}
@Test
fun orientationChange() {
UITestHelper.changeOrientation(activityRule)
}
}