Closed ddeleon92 closed 4 years ago
You will need ensure the view is created properly through whatever pipeline Data Binding requires. The library itself doesn't instantiate the view for you, it just captures a screenshot of the view you give it.
to get rootView out
ViewHolder(DataBindingUtil.inflate<ListItemBinding>(inflater, "layout here", null, false).apply {
executePendingBindings()
}.root)
This 1 is more of a question that could lead to an issue/enhancement.
I'm currently implementing testing across multiple projects at work but have hit a snag. Writing test for layout that use data binding return blank screens. Using this format....
I am constantly returned an empty view. When I remove "layout" and "data" just leaving the ConstraintLayout by itself, the views show with no problem. No error message reported. The app itself runs fine on devices with the data binding enabled so I know my seniors code being written wrong isn't the issue.
So my question is: Do the screenshot test support layouts that use data binding?