File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
app/src/androidTest/java/fr/free/nrw/commons Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ class UploadCancelledTest {
4040 var mGrantPermissionRule: GrantPermissionRule =
4141 GrantPermissionRule .grant(
4242 " android.permission.WRITE_EXTERNAL_STORAGE" ,
43+ " android.permission.ACCESS_FINE_LOCATION" ,
4344 )
4445
4546 private val device: UiDevice =
@@ -138,8 +139,23 @@ class UploadCancelledTest {
138139 )
139140 linearLayout3.perform(click())
140141
141- // Wait for the upload screen to load
142- UITestHelper .sleep(3000 )
142+ // Wait for the upload screen to load and handle any permission dialogs
143+ UITestHelper .sleep(2000 )
144+
145+ // Try to handle permission dialog if it appears (for location or camera)
146+ try {
147+ val allowButton = device.findObject(
148+ androidx.test.uiautomator.UiSelector ()
149+ .textMatches(" (?i)(allow|permit|ok)" )
150+ .className(" android.widget.Button" )
151+ )
152+ if (allowButton.exists()) {
153+ allowButton.click()
154+ UITestHelper .sleep(1000 )
155+ }
156+ } catch (e: Exception ) {
157+ // No permission dialog, continue
158+ }
143159
144160 val pasteSensitiveTextInputEditText =
145161 onView(
You can’t perform that action at this time.
0 commit comments