In my android application (Tablet) I want to verify that after selecting a button the fragment appears on the screen. Is there a way to do this?
In my android application (Tablet) I want to verify that after selecting a button
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can get a instance of the FragmentManager in your test since you have access to the activity. You can then either find the fragment by id or by tag and test that it is visible using the fragment method “isVisible” and assert that is set to true.
The javadoc for Fragment.isVisible() states Return true if the fragment is currently visible to the user. This means the fragment has been added, has its view attached to the window, and is not hidden.