android-espresso

Espresso checking if toasts are displayed (one on top of another)

这一生的挚爱 提交于 2019-12-24 06:38:28
问题 I have an problem with checking if toast is displayed using espresso. I'm using class: import android.os.IBinder; import android.support.test.espresso.Root; import android.view.WindowManager; import org.hamcrest.Description; import org.hamcrest.TypeSafeMatcher; public class ToastMatcher extends TypeSafeMatcher<Root> { @Override public void describeTo(Description description) { description.appendText("is toast"); } @Override public boolean matchesSafely(Root root) { int type = root

How to split Android Espresso tests into different APKs

笑着哭i 提交于 2019-12-24 06:30:06
问题 I have a Espresso Android test APK with a lot of tests (about 70), and I wanted to split the tests into different APKs and then run them, separately, on Firebase Test Lab. Within the Android Studio framework, I created several Test Suites. However, when I need to generate an APK with fewer tests, I create several copies of the project and I will take tests and generate the APKs with the tests I need. My question is: Is there any way to split the test APK without always having to do the

How to write an Android UI test where the contents of views are determined at runtime?

浪尽此生 提交于 2019-12-24 05:59:45
问题 The Situation I'm writing a timetable-viewing application and the first feature to be implemented is choosing the course for which to view the timetable. The user chooses the name of their course from a list and is taken to another screen to further specify which year, group etc. of the course they're currently in. The screens to choose your course and edit your course details are as follows: The Goal Inspired by the Google I/O 17 talk on Test-Driven Development on Android, what I wish to

Espresso test is passed only first time. Then is failed constantly because of NoMatchingViewException

蓝咒 提交于 2019-12-24 03:32:45
问题 I work in Android Studio. I'm currently working on automation tests creation using Espresso 2.1: androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1' I have following xml layout for MainActivity class: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <com.esri.android.map.MapView android:id="@+id

Espresso test is passed only first time. Then is failed constantly because of NoMatchingViewException

北城余情 提交于 2019-12-24 03:32:06
问题 I work in Android Studio. I'm currently working on automation tests creation using Espresso 2.1: androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1' I have following xml layout for MainActivity class: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <com.esri.android.map.MapView android:id="@+id

ClassNotFoundException on custom AndroidJUnitRunner

一曲冷凌霜 提交于 2019-12-24 01:49:23
问题 When I run connected Android tests I get the following issue: java.lang.RuntimeException: Unable to instantiate instrumentation ComponentInfo{my.package.app.debug.test/my.package.app.ui.AppTestRunner}: java.lang.ClassNotFoundException: Didn't find class "my.package.app.ui.AppTestRunner" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app my.package.app.debug.test-1/base.apk", zip file "/data/app/my.package.app.debug-1 base.apk"]

How to test if a fragment is visible with Espresso

寵の児 提交于 2019-12-23 20:09:13
问题 I wrote a very simple Activity with a Button. When the button is clicked, I will start a new Fragment . Now I want to test this logic in my Espresso UI Test. So I wrote this UI Test for my Activity @RunWith(AndroidJUnit4::class) @LargeTest class MainMenuUiTest { @get: Rule val activityTestRule: ActivityTestRule<MainActivity> = ActivityTestRule(MainActivity::class.java) @Test fun switchToFragment() { onView(withId(R.id.btn)).perform() } } How can I test that my Fragment is displayed when the

android.support.test.espresso.PerformException: Error performing 'load adapter data' on view

泄露秘密 提交于 2019-12-23 18:28:57
问题 I am using Espresso to test a list view that appears when I am searching for an item (like an autocomplete). The list view does not appear until the user has typed in something into the SearchView. i.e. I set the ListView to View.VISIBLE only when the user has typed something into the SearchView I am getting this error when I try to click on text in a list view. android.support.test.espresso.PerformException: Error performing 'load adapter data' on view 'with id:' . Using onData did not work.

Android Instrumentation Tests Stuck “Running Tests” Forever Android Studio

别说谁变了你拦得住时间么 提交于 2019-12-23 17:24:42
问题 I use Android Espresso Tests with latest Android Studio 2.1.2 and Tests are running ok but it does not seems like the standalone test app returns back the results to reflect back to Android Studio and it shows Running Tests Forever 回答1: I realize this is an old question, but I just ran into this and didn't see any other search results that had the same problem. In my case, this was caused by the code under test having a stack overflow exception, which it seems that the test runner failed to

Espresso + Junit4 - login once before running all test

南笙酒味 提交于 2019-12-23 14:51:38
问题 I want to write some automated test for one of my application. All of the functionality requires login. So, i have written test, but for each test, it is doing login and testing the functionality. Is there anyway which will help me to login only once and then run all test? Easiest way would be to write all test in only one test method. But i think it would be ugly way to achieve that. Any cleaner solution so, test will login only once and then run set of test. Following is my test code: