android-espresso

E/TestRunner: android.database.sqlite.SQLiteException: no such table: Censored (code 1 SQLITE_ERROR)

浪子不回头ぞ 提交于 2020-01-17 14:08:10
问题 I have an Android app with over 50 Espresso test cases. Most of the time the tests work correctly, but during some runs, one test case (only one) fails with a missing database table. All the other test cases use this table correctly. Sometimes the error message is different, such as: android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 522 SQLITE_IOERR_SHORT_READ) Code samples available on request, but it's a massive app so I doubt I could fit it all into a post. Should I just

How to set image in imageview while testing with espresso?

我只是一个虾纸丫 提交于 2020-01-16 05:36:09
问题 I have used third party library in my sign up form for selecting image from gallery. My signup form works fine. Now I want to test it using espresso.The biggest problem that I am facing right now is how to set profile photo's imageview while testing ? 回答1: You should use espresso-intents to detect that intent from the camera roll and set a picture. Here you have the method I use: public static void simulatePictureFromCameraRoll(Uri pictureUri) throws Exception { Exception returnException =

Room not creating database in UI-Tests

风格不统一 提交于 2020-01-16 01:08:10
问题 I am using a Room database inside my project and it works in production including the UI-Tests (with Espresso) until Android 8. On Android 9 currently my UI-Tests fail because the Database is not created. I get the following error message inside my logcat android.database.sqlite.SQLiteException: no such table: table (code 1 SQLITE_ERROR): , while compiling: SELECT * FROM table WHERE type = ? This only happens on Android 9 devices. While debugging with Stetho i can't find the db file aswell.

Auto grant permissions for Espresso UI Testing

我是研究僧i 提交于 2020-01-15 03:22:07
问题 I'm trying to avoid having to manually grant permissions on every single UI test built with Espresso. I have tried: @Rule public GrantPermissionRule permissionRule = GrantPermissionRule.grant( android.Manifest.permission.INTERNET, android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION.....) and @Before public void grantPhonePermission() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {

“java.lang.RuntimeException: Could not launch intent” for UI with indeterminate ProgressBar

半世苍凉 提交于 2020-01-14 10:33:16
问题 Are there any known issues with displaying indeterminate ProgressBar s with the AndroidJUnitRunner? I'm hitting this error during tests: 05-26 15:22:48.504 1003-1016/? I/TestRunner﹕ java.lang.RuntimeException: Could not launch intent Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=com.cookbrite.dev/com.cookbrite.ui.HomeListActivity } within 45 seconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly

How to type text on a SearchView using espresso

こ雲淡風輕ζ 提交于 2020-01-13 19:19:29
问题 TypeText doesn't seem to work with SearchView . onView(withId(R.id.yt_search_box)) .perform(typeText("how is the weather?")); gives the error: Error performing 'type text(how is the weather?)' on view 'with id:../yt_search_box' 回答1: For anyone that bump into this problem too, the solution is to write a ViewAction for the type SearchView, since the typeText only supports TextEditView Here my solution: public static ViewAction typeSearchViewText(final String text){ return new ViewAction(){

Android Emulator from Command Line Has Weird Resolution

无人久伴 提交于 2020-01-13 12:46:26
问题 I'm creating an Android emulator for Espresso testing from a terminal via this command: ./avdmanager create avd -n TestEmulator1 -k "system-images;android-25;google_apis;x86_64" -c 2000M --tag "google_apis" --device "Nexus 5X" However when I run the emulator, the resolution is really off When I check it in the AVD Manager from Android Studio, it looks like the settings are correct. Is there something missing from my command that's causing this issue? It causes all of my tests to fail when run

Android Emulator from Command Line Has Weird Resolution

三世轮回 提交于 2020-01-13 12:45:21
问题 I'm creating an Android emulator for Espresso testing from a terminal via this command: ./avdmanager create avd -n TestEmulator1 -k "system-images;android-25;google_apis;x86_64" -c 2000M --tag "google_apis" --device "Nexus 5X" However when I run the emulator, the resolution is really off When I check it in the AVD Manager from Android Studio, it looks like the settings are correct. Is there something missing from my command that's causing this issue? It causes all of my tests to fail when run

Android Emulator from Command Line Has Weird Resolution

牧云@^-^@ 提交于 2020-01-13 12:45:06
问题 I'm creating an Android emulator for Espresso testing from a terminal via this command: ./avdmanager create avd -n TestEmulator1 -k "system-images;android-25;google_apis;x86_64" -c 2000M --tag "google_apis" --device "Nexus 5X" However when I run the emulator, the resolution is really off When I check it in the AVD Manager from Android Studio, it looks like the settings are correct. Is there something missing from my command that's causing this issue? It causes all of my tests to fail when run

Checking if a button is clickable in espresso test, android studio

喜你入骨 提交于 2020-01-13 10:15:08
问题 I am writing tests to determine that a specific button is not clickable or is clickable. However it seems to me that there isn't any method or maybe I can't find a method that can check this feature using Espresso. Can anyone help me ? Thank you 回答1: Why not? You can use isClickable() Matcher. onView(withId(R.id.your_button)).check(matches(isClickable())); 回答2: i always combine more tests for my button @Test public void buttonIsEnabled() { onView(withId(R.id. your_button)).check(matches