android-espresso

IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation in Android unit test

╄→尐↘猪︶ㄣ 提交于 2019-12-25 04:28:14
问题 I'm struggling getting a unit test in Android Studio to work on some existing code. I'm kepp getting the IllegalAccessError and can't seem to find a solution for it. Any help is very needed. I'm using Android Studio 1.1.0, gradle 1.1.0 and Espresso 2.0. The stacktrace: java.lang.NoClassDefFoundError: com/hoganas/eclino/activities/BikeActivity at com.hoganas.eclino.activities.ScanActivity$1.onItemClick(ScanActivity.java:49) at android.widget.AdapterView.performItemClick(AdapterView.java:308)

How can I specify android Instrumentation context when I run my ActivityTestRule test cases?

不问归期 提交于 2019-12-24 22:25:26
问题 I have one android system with two displays(Display1, display2) connected for my app. my app has an activity that is running on display2. I was trying to use android espresso library to test my activity on display2. Below is my test code: onView(withId(R.id.button_test)).check(matches(isDisplayed())); //This line worked fine, it means espresso found my view successfully. onView(withId(R.id.button_test)).withFailureHandler(new FailureHandler() { @Override public void handle(Throwable error,

Espresso Webview select hidden element

我是研究僧i 提交于 2019-12-24 17:00:35
问题 How do you find a hidden element inside an Android Webview using espresso? This is what I tried: onWebView().withElement(findElement(Locator.CSS_SELECTOR, "#clsp:hidden")); That produces the following stacktrace. java.lang.RuntimeException: java.lang.RuntimeException: Error in evaluationEvaluation: status: 13 value: {message=An invalid or illegal selector was specified} hasMessage: true message: An invalid or illegal selector was specified at android.support.test.espresso.web.sugar.Web

Espresso test aren't running after adding espresso-contrib library in gradle

不羁岁月 提交于 2019-12-24 16:15:02
问题 When I'm adding the androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.1' in the gradle and run an Espresso test, I get the following error: Testing started at 5:59 PM ... 02/08 17:59:58: Launching changeText_sameAct...() No apk changes detected since last installation, skipping installation of /Users/xxx/Documents/home/MasterDetails/app/build/outputs/apk/app-debug.apk $ adb shell am force-stop databinding.com.masterdetails No apk changes detected since last

Android Tests Exception in Constructor NoClassDefFoundError

不羁的心 提交于 2019-12-24 15:12:49
问题 After solving my issues with project structure and android tests it appears that another issue is coming, when I try to run my tests i get this exception: junit.framework.AssertionFailedError: Exception in constructor: testRegisterNaming (java.lang.NoClassDefFoundError: es.unizar.vv.mobile.catmdedit.app.view.LibraryActivity at es.unizar.vv.mobile.catmdedit.app.LibraryTest.<init>(LibraryTest.java:16) at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect

Android Studio project setup for Espresso tests

我是研究僧i 提交于 2019-12-24 13:13:44
问题 About a week ago I asked this question Why is library module android.support.test not visible in add dependency After much head scratching and project setup morphing I discovered that this app/build.gradle dependency configuration gets me so much further than ever before in that at least the project compiles but does not build when attempting to run: apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion '22.0.1' defaultConfig { applicationId "com.my.package

Espresso throw " Error performing 'single click' on view” when it run on device in the cloud, but same test successfully run locally

别说谁变了你拦得住时间么 提交于 2019-12-24 12:43:22
问题 I fill up user name and password and press a button that sends the information over the network (Espresso Idling resource is implemented), in the application the next screen appears and I can see in logs that the information has being sent. But the test fails with error that it was not able to press the button: android.support.test.espresso.PerformException: Error performing 'single click' on view 'with id: Log: 10-03 07:36:30.308: D/_IdlingResource(27742): _ is idle now! with: 0 10-03 07:36

Android Kotlin Espresso asserting intended activity in the unit test is throwing error

白昼怎懂夜的黑 提交于 2019-12-24 11:29:42
问题 I am developing an Android application. I am adding instrumented tests to my application and testing if an activity is launched using Espresso. But I am getting error in asserting that an activity is launched using the Espresso test framework. I added the following express packages into my app gradle androidTestImplementation "androidx.test.espresso:espresso-core:$expressoVersion" androidTestImplementation "androidx.test.espresso:espresso-intents:$expressoVersion" This is my activity class

Espresso test fails due to Data binding

喜夏-厌秋 提交于 2019-12-24 08:46:44
问题 This is my viewmodel class : class MainViewModel( private val schedulerProvider: BaseSchedulerProvider, private val api : StorytelService ) : BaseViewModel() { private val _posts = MutableLiveData<List<Post>>() val posts: LiveData<List<Post>> get() = _posts private val _status = MutableLiveData<Status>() val status: LiveData<Status> get() = _status init { showPhotos() } fun showPhotos() { EspressoIdlingResource.increment() // App is busy until further notice _status.postValue(Status.LOADING)

RecyclerViewActions returns NoMatchingViewException in Espresso Android Testing

假如想象 提交于 2019-12-24 07:24:11
问题 I'm using this line of code to perform a click on RecyclerView 's list at position 0. onView(withId(R.id.rv)).perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); But it's not working and returns NoMatchingViewException . But, when I perform a click operation on TextView (which is inside the RecyclerView layout), it's working and testing is passing, as shown in the line of code below, onView(allOf(result(withId(R.id.tv), 0), isDisplayed())).perform(click()); Am I using the