android-espresso

Android Espresso: Make assertion while button is kept pressed

一笑奈何 提交于 2021-02-20 11:26:12
问题 I'm quite new to Espresso on Android and I am running into the following problem: I want Espresso to perform a longclick(or something..) on a button, and while the button is kept pressed down, I want to check the state of a different View. In (more or less) pseudocode: onView(withId(button_id)).perform(pressButtonDown()); onView(withId(textBox_id)).check(matches(withText("Button is pressed"))); onView(withId(button_id)).perform(releaseButton()); I tried writing 2 custom Taps, PRESS and

How to add testInstrumentation environment variable for firebase testlab?

旧时模样 提交于 2021-02-18 18:57:43
问题 If i am going to run espresso test locally and pass enviroment variable i can do this by adding defaultConfig { testInstrumentationRunnerArgument 'USERNAME' 'David' } in build.gradle file then i can call this variable by InstrumentationRegistry.getArguments().getString("USERNAME") but when i run this on firebase testlab instrumentationrunner argument are not working 回答1: This is not supported in Test Lab. If you really need to do this, there's a workaround by overriding the test runner and

How to add testInstrumentation environment variable for firebase testlab?

喜欢而已 提交于 2021-02-18 18:55:26
问题 If i am going to run espresso test locally and pass enviroment variable i can do this by adding defaultConfig { testInstrumentationRunnerArgument 'USERNAME' 'David' } in build.gradle file then i can call this variable by InstrumentationRegistry.getArguments().getString("USERNAME") but when i run this on firebase testlab instrumentationrunner argument are not working 回答1: This is not supported in Test Lab. If you really need to do this, there's a workaround by overriding the test runner and

Disable/accept test storage service in Espresso

偶尔善良 提交于 2021-02-10 05:45:48
问题 As can be seen in AndroidX Test 1.3.0 alpha04 release notes: Include the test storage service in the test services Unfortunately, this makes standard connectedDebugAndroidTest to fail because this screen is getting displayed: Choose what to allow TestServices to access And this requires my interaction in order to proceed with UI testing. This makes me to hang with already quite old 1.3.0-alpha03 artifacts, although 1.3.0-beta01 is already available. Question: How to accepts this permission

./gradlew test connectedAndroidTest erases my getFilesDir() folder

你说的曾经没有我的故事 提交于 2021-02-08 14:13:41
问题 I'm writing a Room database into my getFilesDir() folder. (Writing the database onto the removable SD card is apparently going to require some major research!) When I manually run my app, I want to write some records and leave them in the database, so I don't need to keep writing them again. When I run my tests, I switch the database name from "*.dat" to "_test.dat" (think Ruby on Rails's or Django's "environments" system). The tests are free to erase records. This system works when I

./gradlew test connectedAndroidTest erases my getFilesDir() folder

帅比萌擦擦* 提交于 2021-02-08 14:13:32
问题 I'm writing a Room database into my getFilesDir() folder. (Writing the database onto the removable SD card is apparently going to require some major research!) When I manually run my app, I want to write some records and leave them in the database, so I don't need to keep writing them again. When I run my tests, I switch the database name from "*.dat" to "_test.dat" (think Ruby on Rails's or Django's "environments" system). The tests are free to erase records. This system works when I

Espresso-android jar - 'Error in opening zip file' in android studio 8.x

限于喜欢 提交于 2021-02-08 05:54:25
问题 I've been getting this error, I've tried the solution stated here: Android studio - Failed to complete gradle execution - error in opening zip file This error is killing me, I've tried removing the .gradle folder. I've noticed that the .idea\libraries folder has a bunch of xml's in it and I've tried deleting that (thinking its storing something wrong) and that wasn't it either. I've narrowed it down to the jars downloaded from the espresso-android site, espresso-1.1.jar and the test runners -

How do I test the home button on the Action Bar with Espresso?

自作多情 提交于 2021-02-06 10:19:46
问题 I have enabled the home button to return to the previous view. Simply, doing this: getActionBar().setDisplayHomeAsUpEnabled(true); I'm using the last version of com.android.support:appcompat-v7:21.0.2 . However, when I use the below code it doesn't work throwing a Exception. Espresso.onView(ViewMatchers.withId(android.R.id.home)).perform(ViewActions.click()); Espresso.onView(ViewMatchers.withId(R.id.home)).perform(ViewActions.click()); Exception: com.google.android.apps.common.testing.ui

JUnit4 - AssertionFailedError: No tests found

…衆ロ難τιáo~ 提交于 2021-02-06 06:55:59
问题 I'm using AndroidJUnitRunner with Espresso. I wrote a simple test but always receive this exception. According to Stackoverflow answers, the problem is messing up the JUnit3 and JUnit4 but I have never used JUnit3 in my project. junit.framework.AssertionFailedError: No tests found in com.walletsaver.app.test.espresso.SignUpPopupTest package com.walletsaver.app.test.espresso; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android

JUnit4 - AssertionFailedError: No tests found

牧云@^-^@ 提交于 2021-02-06 06:49:07
问题 I'm using AndroidJUnitRunner with Espresso. I wrote a simple test but always receive this exception. According to Stackoverflow answers, the problem is messing up the JUnit3 and JUnit4 but I have never used JUnit3 in my project. junit.framework.AssertionFailedError: No tests found in com.walletsaver.app.test.espresso.SignUpPopupTest package com.walletsaver.app.test.espresso; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android