android-espresso

Why android espresso test fails when checking whether textView text ends with expected string (when ellipsized)

不打扰是莪最后的温柔 提交于 2020-06-23 12:52:08
问题 I have an android test checking that external text message is truncated and ends with three dots when applying android:ellipsize="end". I do not know why test fails despite text presented in a activity is properly formatted. @Test fun when_errorMessage_is_very_long_then_text_of_errorMessageTextView_ends_with_dots() { //given val errorMessage = """ Very long error, Very long error, Very long error, Very long error, Very long error, Very long error, Very long error, Very long error, Very long

Why android espresso test fails when checking whether textView text ends with expected string (when ellipsized)

喜欢而已 提交于 2020-06-23 12:50:43
问题 I have an android test checking that external text message is truncated and ends with three dots when applying android:ellipsize="end". I do not know why test fails despite text presented in a activity is properly formatted. @Test fun when_errorMessage_is_very_long_then_text_of_errorMessageTextView_ends_with_dots() { //given val errorMessage = """ Very long error, Very long error, Very long error, Very long error, Very long error, Very long error, Very long error, Very long error, Very long

Why android espresso test fails when checking whether textView text ends with expected string (when ellipsized)

↘锁芯ラ 提交于 2020-06-23 12:49:14
问题 I have an android test checking that external text message is truncated and ends with three dots when applying android:ellipsize="end". I do not know why test fails despite text presented in a activity is properly formatted. @Test fun when_errorMessage_is_very_long_then_text_of_errorMessageTextView_ends_with_dots() { //given val errorMessage = """ Very long error, Very long error, Very long error, Very long error, Very long error, Very long error, Very long error, Very long error, Very long

Espresso - How to check if one of the view is displayed

两盒软妹~` 提交于 2020-06-09 11:04:48
问题 In my test, after one action, there are two possible views which can appear and both of them are correct. How can I check if one of the view is displayed. For a single view I can check with is Displayed(). But that would fail if other view is visible instead. I want to pass the test if any one of those two views are displayed. onMyButton.perform(click()); onMyPageOne.check(matches(isDisplayed())); //view 1 or onMyPageTwo.check(matches(isDisplayed())); //view 2 After, perform click on MyButton

Android Espresso - Web browser

北城以北 提交于 2020-05-25 13:35:31
问题 I have a question I want to test whether after button click the web browser is beign launched using espresso. And the question is: is it even possible to test such thing? If so any ideas how would I do that? 回答1: Actually no. Espresso will allow you to click in the button and once the browser is fired up, the test will end. The alternative you have is having your class that fires the browser Intent mocked, so that you can test the remaining flow (if any). HAve a look in this answer:

Android Espresso - Web browser

徘徊边缘 提交于 2020-05-25 13:33:28
问题 I have a question I want to test whether after button click the web browser is beign launched using espresso. And the question is: is it even possible to test such thing? If so any ideas how would I do that? 回答1: Actually no. Espresso will allow you to click in the button and once the browser is fired up, the test will end. The alternative you have is having your class that fires the browser Intent mocked, so that you can test the remaining flow (if any). HAve a look in this answer:

Android Espresso - Web browser

这一生的挚爱 提交于 2020-05-25 13:32:15
问题 I have a question I want to test whether after button click the web browser is beign launched using espresso. And the question is: is it even possible to test such thing? If so any ideas how would I do that? 回答1: Actually no. Espresso will allow you to click in the button and once the browser is fired up, the test will end. The alternative you have is having your class that fires the browser Intent mocked, so that you can test the remaining flow (if any). HAve a look in this answer:

Espresso - how to switch typeText to English or other languages input mode

故事扮演 提交于 2020-05-14 22:45:30
问题 I'm using Espresso to implement my application's autotest framework. But in some test-cases I've designed, I found my test always fail, and the root cause is not in my testing codes on feature implementation codes. The root cause is in the android input methods mode, sometimes, it's in Chinese input mode, and my input text is English, then the input value will fail. So I want to know how can I switch the current typeText input method mode from Chinese to English, or how could I ensure the

Espresso - how to switch typeText to English or other languages input mode

有些话、适合烂在心里 提交于 2020-05-14 22:44:31
问题 I'm using Espresso to implement my application's autotest framework. But in some test-cases I've designed, I found my test always fail, and the root cause is not in my testing codes on feature implementation codes. The root cause is in the android input methods mode, sometimes, it's in Chinese input mode, and my input text is English, then the input value will fail. So I want to know how can I switch the current typeText input method mode from Chinese to English, or how could I ensure the

Android Espresso match BitmapDrawables with different tint

耗尽温柔 提交于 2020-05-14 18:36:06
问题 Is there some way to compare two Bitmaps which are wrapped by the BitmapDrawable . The comparison should not fail if the sizes doesn't match, but it should match pixels and the color of the Bitmap I am not sure how the native part of Android draws the Bitmap , because sameAs returns true even though the tint color is different. If the size is different, I can create scaled Bitmap from the other and the compare these to. In my source code I use DrawableCompat.setTint with the ImageViews