android-espresso

Espresso test for Notification to showing up

送分小仙女□ 提交于 2019-12-18 07:53:20
问题 I want to test that when I receive push, Notification will be showing up. And it might be as well to check its properties (like title, set intent and so on.) How can I do so? @Before public void setupTest() { mData.putString(PushNotificator.KEY_PUSH_TYPE, PushType.PROJECT_OFFER.toString()); mData.putString(PushNotificator.KEY_PUSH_OBJECT, pushObjectJsonString); mContext = InstrumentationRegistry.getContext(); } @Test public void projectOfferCreatedFromBundle() { mPushNotificator = new

Espresso test for Notification to showing up

拈花ヽ惹草 提交于 2019-12-18 07:52:07
问题 I want to test that when I receive push, Notification will be showing up. And it might be as well to check its properties (like title, set intent and so on.) How can I do so? @Before public void setupTest() { mData.putString(PushNotificator.KEY_PUSH_TYPE, PushType.PROJECT_OFFER.toString()); mData.putString(PushNotificator.KEY_PUSH_OBJECT, pushObjectJsonString); mContext = InstrumentationRegistry.getContext(); } @Test public void projectOfferCreatedFromBundle() { mPushNotificator = new

Android Espresso not working with Multidex gives “No tests found”

点点圈 提交于 2019-12-18 04:33:09
问题 My Espresso tests were running until I had to support multidex. My build.gradle, I have minSdkVersion 14 targetSdkVersion 23 multiDexEnabled = true testInstrumentationRunner "com.android.test.runner.MultiDexTestRunner" androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1' androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.1' androidTestCompile 'com.android.support.test:runner:0.4.1' androidTestCompile 'com.android.support.test:rules:0.4.1'

onChildView and hasSiblings with Espresso

大憨熊 提交于 2019-12-18 03:36:11
问题 I am trying to access a button from a specific view. The same view is displayed 6 times. This is the code I am using. public void testTimeConfig(){ onData(withDesc("description")).onChildView(withId(R.id.positive)).perform(click()); } private static Matcher<Object> withDesc(String desc) { return allOf(is(instanceOf(String.class)), is(desc)); } When I run, I get an error: Error performing 'load adapter data' on view 'is assignable from class: class android.widget.AdapterView'. Is this the best

Why would adding espresso-contrib cause an InflateException?

旧时模样 提交于 2019-12-17 23:45:03
问题 In my build.gradle file I have the support library dependencies: compile "com.android.support:appcompat-v7:22.2.0" compile "com.android.support:recyclerview-v7:22.2.0" compile "com.android.support:design:22.2.0" I also have dependencies for espresso tests: androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2' androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2' Everything runs fine at this point, but when I add the dependency for espresso-contrib I

Wait for view pager animations with espresso?

↘锁芯ラ 提交于 2019-12-17 22:54:52
问题 Trying to do some tests with a ViewPager. I want to swipe between tabs, and I don't want to continue until the swipe is complete. But there doesn't appear to be a way to turn off the animation for the view pager (all animations under the developer options are disabled). So this always results in a test failure, because the view pager hasn't completed it's animation, and so the view is not completely displayed yet: // swipe left onView(withId(R.id.viewpager)).check(matches(isDisplayed()))

Check if a dialog is displayed with Espresso

倖福魔咒の 提交于 2019-12-17 17:33:58
问题 I'm trying to write some tests with the new android-test-kit (Espresso). But I can't find any information on how to check if a dialog is displayed and perform some actions on it (like clicking the positive and negative buttons, e.t.c.). Note that a dialog may be also displayed by a WebView , not by the application it self. Any help would be appreciated. I just need a link, or some example code for the basics: Check if a dialog appears Perform clicks on dialog buttons Interact with the dialog

How to manage Runtime permissions android marshmallow espresso tests

…衆ロ難τιáo~ 提交于 2019-12-17 15:38:52
问题 I'm using espresso for testing but sometimes I try to get an image form external storage and with marshmallow I need a Runtime permission otherwise there will be an Exception crash and the test will fail. androidTestCompile 'com.android.support.test:runner:0.4' androidTestCompile 'com.android.support.test:rules:0.4' androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1' androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.1' androidTestCompile('com

Espresso - How can I check if an activity is launched after performing a certain action?

依然范特西╮ 提交于 2019-12-17 15:32:37
问题 the following is one of my Espresso test cases. public void testLoginAttempt() { Espresso.onView(ViewMatchers.withId(R.id.username)).perform(ViewActions.clearText()).perform(ViewActions.typeText("nonexistinguser@krossover.com")); Espresso.onView(ViewMatchers.withId(R.id.username)).perform(ViewActions.clearText()).perform(ViewActions.typeText("invalidpassword")); Espresso.onView(ViewMatchers.withId(R.id.login_button)).perform(ViewActions.click()); // AFTER CLICKING THE BUTTON, A NEW ACTIVITY

Espresso webView webkeys failures on the Android 8.0 simulator

两盒软妹~` 提交于 2019-12-13 17:13:56
问题 I am running some test codes from Espresso Web @Test public void typeTextInInput_clickButton_SubmitsForm() { // Lazily launch the Activity with a custom start Intent per test. mActivityRule.launchActivity(withWebFormIntent()); // Selects the WebView in your layout. If you have multiple WebView objects, // you can also use a matcher to select a given WebView, // onWebView(withId(R.id.web_view)). onWebView() // Find the input element by ID. .withElement(findElement(Locator.ID, "text_input")) //