android-espresso

How to surpass location enabler dialogue in UI testing Espresso android?

[亡魂溺海] 提交于 2021-01-27 06:46:08
问题 I am using Espresso for UI testing android. I wanted to run a test with location off in the settings and I got stuck with the location enabler dialogue as it fails other test. I have mentioned my observations and what I have tried so far Used UiAutomator, it works only on single test case but it fails on complete run of test suite. Used Grant permission rule, it gave permission but the dialogue still exists. Used Roboelectric, it had no effect on the problem. Used Shadow operation, it had no

Espresso Matcher for Nested RecyclerView

落花浮王杯 提交于 2021-01-27 06:02:40
问题 So here's a breakdown of my hierarchy: RecyclerView --> LinearLayout --> RecyclerView --> FrameLayout -> FrameLayout Here's a screenshot: I would like to be able to verify the FrameLayout with the text is displayed. This what I have tried so far: onView(withRecyclerView(R.id.container_list).atPositionOnView(0, R.id.row_content)) .check(matches(withRecyclerView(R.id.row_content).atPositionOnView(0, R.id.info_field))) .check(matches(isDisplayed())); But it causes an

Android Espresso listView scroll to

白昼怎懂夜的黑 提交于 2021-01-27 04:52:07
问题 I have a list_view, which I want to test. list_view item layout is RelativeLayout , adapter is ItemAdapter . This code works fine (item contatining Daft Punk is visible): @Test public void listViewTest() { Espresso.onView(withText("Daft Punk")).perform(click()); } Both of this variants fail: (The scrolling starts, comes to the item and then fails, the error is at the very and of this question.) @Test public void listViewTest() { Espresso.onData(artistWithName("Imagine Dragons")).perform

Android Espresso listView scroll to

烈酒焚心 提交于 2021-01-27 04:51:39
问题 I have a list_view, which I want to test. list_view item layout is RelativeLayout , adapter is ItemAdapter . This code works fine (item contatining Daft Punk is visible): @Test public void listViewTest() { Espresso.onView(withText("Daft Punk")).perform(click()); } Both of this variants fail: (The scrolling starts, comes to the item and then fails, the error is at the very and of this question.) @Test public void listViewTest() { Espresso.onData(artistWithName("Imagine Dragons")).perform

Test coverage report is not generated with java.io.IOException

蹲街弑〆低调 提交于 2021-01-26 07:29:21
问题 I am running a coverage task on Android app. I have added the necessary command testCoverageEnabled = true in build.gradle file. I can see the task createMockDebugAndroidTestCoverageReport in ./gradlew task list. I executed the tasks createMockDebugAndroidTestCoverageReport and got the following error on the console: * What went wrong: Execution failed for task ':myAppApplication:createMockDebugAndroidTestCoverageReport'. > java.io.IOException: No coverage data to process in directory '/Users

Espresso check if no dialog is displayed

余生颓废 提交于 2021-01-22 07:01:32
问题 I have a method that checks several conditions, and calls another activity when they are satisfied. When a condition isn't satisfied, it should display an error dialog (which is currently using a DialogFragment to display an alert dialog). The method looks something like this: void checkAndCall() { CustomObject o1 = null; try { o1 = CustomObject.parse(editText1.getText().toString()); } catch (CustomException e) { handleBadCase(e); return; } CustomObject o2 = null; try { o2 = CustomObject

Espresso check if no dialog is displayed

风流意气都作罢 提交于 2021-01-22 06:55:11
问题 I have a method that checks several conditions, and calls another activity when they are satisfied. When a condition isn't satisfied, it should display an error dialog (which is currently using a DialogFragment to display an alert dialog). The method looks something like this: void checkAndCall() { CustomObject o1 = null; try { o1 = CustomObject.parse(editText1.getText().toString()); } catch (CustomException e) { handleBadCase(e); return; } CustomObject o2 = null; try { o2 = CustomObject

Duplicate class org.hamcrest.BaseDescription found in modules jetified-hamcrest-core-1.3.jar

青春壹個敷衍的年華 提交于 2021-01-19 06:24:48
问题 Android studio 3.6 app/build.gradle: androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'com.azimolabs.conditionwatcher:conditionwatcher:0.2' // Espresso framework androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version" androidTestImplementation "androidx.test.espresso:espresso-intents:$espresso_version" androidTestImplementation "androidx.test.espresso:espresso-contrib:$espresso_version" androidTestImplementation 'org.hamcrest

attribute android:forceQueryable not found in Android studio when running Espresso test

烈酒焚心 提交于 2021-01-03 05:43:27
问题 I have recorded my android app Espresso test using android studio Record Espresso Test option in Run menu. In the end of the record I saved the test with a my own file name. Once click the save button, IDE automatically created the file in AndroidTest directory of the app module. I right click the saved file and clicked run. Then it prompting me the following error. /Users/dehanwijesekara/Documents/ProjectName/app/build/intermediates/packaged_manifests/debugAndroidTest/AndroidManifest.xml:24:

Android Espresso test: Class not found: …Empty test suite

被刻印的时光 ゝ 提交于 2020-12-31 05:57:10
问题 I'm trying to implement things from this example - https://github.com/googlesamples/android-testing/tree/master/ui/espresso/BasicSample - into my app. When I try to execute the simple Espresso test, this happens: "/Applications/Android Studio 2.2.3.app/Contents/jre/jdk/Contents/Home/bin/java" (...) Process finished with exit code 1 Class not found: "com.faces_shop.app.MainActivityTest"Empty test suite. (copy-pasted from Android Studio) The test: package com.faces_shop.app; import android