I'm using Barista to test my Android app. At a certain point in my activity's lifecycle, a QR code is displayed on screen. I'm able to successfully test that the image appears on screen:
BaristaVisibilityAssertions.assertDisplayed(R.id.qrCode);
Is there a way to get access to the actual ImageView object? I want to inspect its Bitmap and verify that the QR code's contents are correct.
It suffices to get access to the activity object as, from there, you can call
findViewById. Assuming you have aBaristaRule<MyActivity>:you can get the activity by
baristaRule.getActivityTestRule().getActivity().