@@ -2,6 +2,7 @@ package org.oppia.android.app.onboarding
2
2
3
3
import android.app.Application
4
4
import android.content.Context
5
+ import android.content.Intent
5
6
import androidx.appcompat.app.AppCompatActivity
6
7
import androidx.lifecycle.Lifecycle
7
8
import androidx.test.core.app.ActivityScenario
@@ -11,6 +12,8 @@ import androidx.test.espresso.action.ViewActions.click
11
12
import androidx.test.espresso.action.ViewActions.closeSoftKeyboard
12
13
import androidx.test.espresso.assertion.ViewAssertions.matches
13
14
import androidx.test.espresso.intent.Intents
15
+ import androidx.test.espresso.intent.Intents.intended
16
+ import androidx.test.espresso.intent.matcher.IntentMatchers.hasAction
14
17
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
15
18
import androidx.test.espresso.matcher.ViewMatchers.isRoot
16
19
import androidx.test.espresso.matcher.ViewMatchers.withId
@@ -358,6 +361,29 @@ class CreateProfileFragmentTest {
358
361
}
359
362
}
360
363
364
+ @Test
365
+ fun testFragment_tapToAddPictureClicked_hasGalleryIntent () {
366
+ launchNewLearnerProfileActivity().use {
367
+ onView(withText(R .string.create_profile_activity_profile_picture_prompt))
368
+ .perform(click())
369
+ testCoroutineDispatchers.runCurrent()
370
+ intended(hasAction(Intent .ACTION_PICK ))
371
+ }
372
+ }
373
+
374
+ @Config(qualifiers = " land" )
375
+ @Test
376
+ fun testProfileProgressFragment_imageSelectAvatar_configChange_checkGalleryIntent () {
377
+ launchNewLearnerProfileActivity().use {
378
+ onView(isRoot()).perform(orientationLandscape())
379
+ testCoroutineDispatchers.runCurrent()
380
+ onView(withText(R .string.create_profile_activity_profile_picture_prompt))
381
+ .perform(click())
382
+ testCoroutineDispatchers.runCurrent()
383
+ intended(hasAction(Intent .ACTION_PICK ))
384
+ }
385
+ }
386
+
361
387
private fun launchNewLearnerProfileActivity ():
362
388
ActivityScenario <CreateProfileActivity >? {
363
389
val scenario = ActivityScenario .launch<CreateProfileActivity >(
0 commit comments