material-components / material-components/material-components-android
[MaterialDatePicker] Create Espresso Actions
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
It is very hard to write tests that need to interact with the MaterialDatePicker. This is made somewhat easier by following the code in your own [TestUtils Class](https://github.com/material-components/material-components-android/blob/master/tests/javatests/com/google/android/material/datepicker/MaterialDatePickerTestUtils.java) but due to private types like `Month` it's not possible to fully use this code.
**Describe the solution you'd like**
Using your test utils as a base, expose Espresso View Actions like was done for [RecyclerView](https://developer.android.com/reference/androidx/test/espresso/contrib/RecyclerViewActions). This will make testing these bits of UI much more simple.
**Describe alternatives you've considered**
It's possible to get things working, sort of, in an incomplete way, by using the `MaterialDatePickerTestUtils` as a sample, but it's a huge amount of work for the net gain of people able to write a test that selects a date.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tests/javatests/com/google/android/material/datepicker/MaterialDatePickerTestUtils.java and compare its test interactions with the RecyclerViewActions API referenced in the issue. Define the public Espresso actions needed to select a date without exposing private types, then verify that consumers can use them to test MaterialDatePicker date selection.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100