Colton Idle
01/23/2021, 9:48 PMText
s. (you could even argue that this shouldn't be a separate compasable)
Either way it's legitimately being used in my app and now I've been watching @ppvi (it says Jose if offline, so hopefully that doesn't ping him. Wasn't my intention.) compose testing talk and I want to write a test, but I've never really tested individual views before (not an android and not in any language) and now I'm not sure what to really assert. Maybe since it's such a contrived example there's not much to test and so it's actually a bad candidate, but should I just test that my composable is there with the text that I passed in the parameter? Any guidance would be appreciated.jim
01/23/2021, 9:55 PMDesktopScreenshotTestRule
. That should be fast and stable and a generally ideal solution.
Failing that, I know there is some code in the androidx repository around taking screenshot tests on Android emulator, but I'm a little less familiar with that code and I think it's a little slower/flakier.
cc @Filip Pavlis for more thoughts.Colton Idle
01/23/2021, 10:00 PMjim
01/23/2021, 10:02 PMColton Idle
01/23/2021, 10:04 PMjim
01/23/2021, 10:04 PMColton Idle
01/23/2021, 10:04 PMTesting UI is notoriously hard. The challenge is that there are so many things that can impact the UI that it's hard to write a test which will break when the UI is doing the wrong thing.Thanks. Thats reassuring actually.
Adam Powell
01/23/2021, 10:04 PMColton Idle
01/23/2021, 10:06 PMjim
01/23/2021, 10:08 PMAdam Powell
01/23/2021, 10:11 PMjim
01/23/2021, 10:12 PMAdam Powell
01/23/2021, 10:13 PMText
composables post-1.0, I'd hope I wouldn't need to test for compatibility of that version over version in my own apps 🙂Colton Idle
01/23/2021, 10:14 PMBut it'd be really nice if more folks would run tests that make sure text doesn't get cut off when the user increases the systemwide font sizeOoooH. Thats a good freakin test idea. lol
Adam Powell
01/23/2021, 10:25 PMColton Idle
01/23/2021, 10:37 PMFilip Pavlis
01/28/2021, 1:51 PMassertIsDisplayed()
gives pretty strong guarantees and is cheap to maintain unless something is overlaying your composables in compose which is not that super frequent.