File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
src/androidTestUnbrandedDebug/java/org/medicmobile/webapp/mobile Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -509,4 +509,5 @@ dependencies {
509509 androidTestImplementation ' androidx.test:rules:1.6.1'
510510 androidTestImplementation ' androidx.test:core:1.6.1'
511511 androidTestImplementation ' org.hamcrest:hamcrest-library:2.2'
512+ androidTestImplementation ' androidx.test.uiautomator:uiautomator:2.3.0'
512513}
Original file line number Diff line number Diff line change 3434import androidx .test .ext .junit .runners .AndroidJUnit4 ;
3535import androidx .test .filters .LargeTest ;
3636
37+ import androidx .test .uiautomator .UiDevice ;
38+ import androidx .test .uiautomator .UiObject ;
39+ import androidx .test .uiautomator .UiSelector ;
40+ import androidx .test .platform .app .InstrumentationRegistry ;
41+
3742import org .junit .FixMethodOrder ;
3843import org .junit .Rule ;
3944import org .junit .Test ;
@@ -100,6 +105,8 @@ public void testLoginScreen() throws Exception {
100105
101106 Thread .sleep (7000 ); //TODO: use better ways to handle delays
102107
108+ allowNotificationPermission ();
109+
103110 ViewInteraction webView = onView (
104111 allOf (withId (R .id .wbvMain ),
105112 withParent (allOf (withId (R .id .lytWebView ),
@@ -210,4 +217,12 @@ private String getLanguage(String code) {
210217 Locale aLocale = new Locale (code );
211218 return aLocale .getDisplayName ();
212219 }
220+
221+ private void allowNotificationPermission () throws Exception {
222+ UiDevice device = UiDevice .getInstance (InstrumentationRegistry .getInstrumentation ());
223+ UiObject allowButton = device .findObject (new UiSelector ().text ("Allow" ));
224+ if (allowButton .exists () && allowButton .isEnabled ()) {
225+ allowButton .click ();
226+ }
227+ }
213228}
You can’t perform that action at this time.
0 commit comments