I’ve been using a BaseTest class for Espresso something like this : abstract class BaseTest<T : Activity> { val context: Context = InstrumentationRegistry.getInstrumentation().targetContext abstract fun getTestActivity(): IntentsTestRule<T> abstract fun startIntentActivity() @Rule @JvmField var activityTestRule = this.getTestActivity() fun launchActivity(intent: Intent?) { getTestActivity().launchActivity(intent) } @Before fun setUp() { startIntentActivity() } @After fun tearDown() { activityTestRule.finishActivity() } } ..
Category : android-espresso
What I want when real, use auto suggestion when testing, do not use auto suggestion because the suggestion view make testing trouble I think. I just want to know the way using typeText() when use replaceText(), it’ ok. For testing,I used to set inputType like this, but It doesn’t work. const val emailInputType = InputType.TYPE_CLASS_TEXT ..
I’m practicing making an app with Room and LiveData, Basicly using this codeLab resource but just wrapped the list for recyclerView into a PagedList. This is what my adapter looks like: Adapter public class WordListAdapter extends PagedListAdapter<Word, WordListAdapter.ViewHolder> { private static final String TAG = WordListAdapter.class.getSimpleName(); public WordListAdapter(MyOnClickListener listener){ super(DIFF_CALLBACK); } @Override public ViewHolder onCreateViewHolder(ViewGroup ..
I’m planning to create Espresso tests on my app multi-module, and I’m about to create the first Espresso test, but what I’m seeing is that on my app I do not have an AppComponent where I can fake it. Since I want to add the test on my feature-module, I’ll create the TestApp, TestRunner there ..
In the following android test fragment test class, https://github.com/TheReprator/UITestLearning/blob/master/app/src/androidTest/kotlin/com/example/uitest/FragmentDataBindingBTest.kt Only testDataBindingObserverValue() passed and other 2 fail(testDataBindingBDefaultValue(), testDataBindingBDefaultValue_updatedValue()), Ideally i am expecting, that i should be able to receive the initial value and then the new updated value, so i am atleast trying to make testDataBindingBDefaultValue_updatedValue(), test case to pass. My github Repo is as follows, ..
I am new to Espresso. I want to test UI performance for an app(fluidity). I can create custom annotation in Espresso for getting fluidity for a particular test or automate new test cases. Does anyone know how to send command like "adb shell dumpsys gfxinfo app_package" from an espresso test? Source: Android..
I am calling regular espresso matcher onView(withText("test")).check(matches(isDisplayed())) But matches(isDisplayed()) showed error message that parameter not fit Type mismatch. Required: ViewAssertion! Found: Boolean Type mismatch. Required: String! Found: Matcher<View!>! Could you give suggestions? Source: Android..
I wanted to create a custom regex matcher for Espresso so that I can check if the text on the screen contains time in format like HH:mm for example 23:34 or 04:23 I have a regex matcher class: class RegexMatcher(private val regex: String) : BoundedMatcher<View, TextView>(TextView::class.java) { private val pattern = Pattern.compile(regex) override fun describeTo(description: ..
Using this guide to test dialog https://developer.android.com/guide/fragments/test The bottom sample with(launchFragment<MyDialogFragment>()) { onFragment { fragment -> // here error assertThat(fragment.dialog).isNotNull() assertThat(fragment.requireDialog().isShowing).isTrue() fragment.dismiss() fragment.parentFragmentManager.executePendingTransactions() assertThat(fragment.dialog).isNull() } } But here it shows error onFragment { fragment -> // error below Type mismatch. Required: FragmentScenario.FragmentAction Found: (???) → Unit Cannot infer a type for this parameter. Please specify ..
Imagine I have a test that types some_text into an instance of EditText. It seems that some third-party keyboards that have auto-capitalisation turned on (e.g., SwiftKey), will enter this text as Some_text instead. The test then fails because what’s in the EditText is not what was expected. I have worked through the documentation, which is ..
Recent Comments