diff --git a/app/src/androidTest/java/com/h/pixeldroid/SwipeTest.kt b/app/src/androidTest/java/com/h/pixeldroid/SwipeTest.kt index a220ec6b..ac6450d6 100644 --- a/app/src/androidTest/java/com/h/pixeldroid/SwipeTest.kt +++ b/app/src/androidTest/java/com/h/pixeldroid/SwipeTest.kt @@ -1,17 +1,17 @@ package com.h.pixeldroid import android.content.Context -import android.content.Intent import androidx.test.core.app.ActivityScenario import androidx.test.espresso.Espresso.onView import androidx.test.espresso.action.ViewActions.swipeLeft +import androidx.test.espresso.action.ViewActions.swipeRight import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.matcher.ViewMatchers.isDisplayed import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.ext.junit.rules.ActivityScenarioRule import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation -import androidx.test.rule.ActivityTestRule +import com.google.android.material.tabs.TabLayout import org.junit.Before import org.junit.Rule import org.junit.Test @@ -31,10 +31,30 @@ class SwipeTest { ActivityScenario.launch(MainActivity::class.java) } - @Test - fun swipingRightOnHomepageShowsSettings() { - onView(withId(R.id.view_pager)).perform(swipeLeft()).perform(swipeLeft()).perform(swipeLeft()).perform(swipeLeft()) - onView(withId(R.id.nbFollowersTextView)).check(matches(isDisplayed())) + fun swipingLeftOnSearchShowsCameraFragment() { + onView(withId(R.id.main_activity_main_linear_layout)) + .perform(swipeLeft()) // go to search + .perform(swipeLeft()) + onView(withId(R.id.camera_fragment_main_linear_layout)).check(matches(isDisplayed())) + } + @Test + fun swipingRightOnNotificationsShowsCameraFragment() { + onView(withId(R.id.main_activity_main_linear_layout)) + .perform(swipeLeft()) + .perform(swipeLeft()) + .perform(swipeLeft()) // go to notifications + .perform(swipeRight()) + onView(withId(R.id.camera_fragment_main_linear_layout)).check(matches(isDisplayed())) + } + + @Test + fun swipingLeftShowsProfileFragment() { + onView(withId(R.id.view_pager)) + .perform(swipeLeft()) + .perform(swipeLeft()) + .perform(swipeLeft()) + .perform(swipeLeft()) + onView(withId(R.id.nbFollowersTextView)).check(matches(isDisplayed())) } } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a329b73d..3f184156 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,6 +3,7 @@ package="com.h.pixeldroid"> + diff --git a/app/src/main/res/layout/fragment_camera.xml b/app/src/main/res/layout/fragment_camera.xml new file mode 100644 index 00000000..25d776d7 --- /dev/null +++ b/app/src/main/res/layout/fragment_camera.xml @@ -0,0 +1,29 @@ + + + +