|
4 | 4 | import static androidx.test.uiautomator.Until.hasObject; |
5 | 5 |
|
6 | 6 | import android.content.Intent; |
| 7 | +import android.content.pm.PackageManager; |
7 | 8 | import android.util.Log; |
8 | 9 | import android.webkit.WebView; |
9 | 10 | import android.widget.Button; |
@@ -46,6 +47,16 @@ public void before() { |
46 | 47 | @Test |
47 | 48 | public void test_00_configureNextcloudAccount() throws UiObjectNotFoundException, InterruptedException { |
48 | 49 | Log.i(TAG, "Configure Nextcloud account"); |
| 50 | + |
| 51 | + final var context = getInstrumentation().getContext(); |
| 52 | + final var packageManager = context.getPackageManager(); |
| 53 | + try { |
| 54 | + packageManager.getPackageInfo(APP_NEXTCLOUD, 0); |
| 55 | + Log.i(TAG, "Nextcloud APK is installed (checking on runtime)"); |
| 56 | + } catch (PackageManager.NameNotFoundException e) { |
| 57 | + Log.e(TAG, "Nextcloud APK is NOT installed (checking on runtime"); |
| 58 | + } |
| 59 | + |
49 | 60 | launch(APP_NEXTCLOUD); |
50 | 61 |
|
51 | 62 | final var loginButton = mDevice.findObject(new UiSelector().textContains("Log in")); |
@@ -82,7 +93,7 @@ public void test_00_configureNextcloudAccount() throws UiObjectNotFoundException |
82 | 93 | // Log.d(TAG, "Scroll to bottom of WebView…"); |
83 | 94 | // mDevice.findObject(By.clazz(WebView.class)).swipe(Direction.UP, 1f); |
84 | 95 | // Log.d(TAG, "Finished scrolling"); |
85 | | - webViewLoginButton.dragTo(0,0, 40); |
| 96 | + webViewLoginButton.dragTo(0, 0, 40); |
86 | 97 |
|
87 | 98 | webViewLoginButton.click(); |
88 | 99 |
|
|
0 commit comments