google / Accessibility-Test-Framework-for-Android

Accessibility checks for automated Android testing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not displaying Accessibility issues for another activity

KDMaheshwari opened this issue · comments

I have basic Android app which takes input and shows it in next screen(new activity). Accessibility Scanner app shows the accessibility issue on both the screens(Main activity and also in messageDisplayActivity) but when i have tried to run via espresso test it only displays accessibility issues for Main activity screen. I have tried below code in Before class.

1: AccessibilityChecks.enable().setRunChecksFromRootView(true)

and also (to check in logcat logs)

2:AccessibilityChecks.enable().setRunChecksFromRootView(true).setThrowExceptionForErrors(false);

Since AccessibilityChecks.enable() code is in before class hence i am wondering how it can find accessibility issues for new screen when app performs a click and open a new screen? Please help.

AccessibilityChecks.enable() registers a global assertion that runs whenever an Espresso ViewAction is performed. If you'd like some coverage on the second Activity, you'll need to perform a ViewAction on that UI. Alternatively, you can explicitly invoke accessibility checks with the ViewAssertion obtained with AccessibilityChecks.accessibilityAssertion().