PROBLEM: An instantapp activity from one module (base
) calls activity from another module (my_feature
). Both should be tested using 'Record Espresso Test' in Android Studio.
RESEARCH: Espresso-generated code for non-instant application has R.id.component
references on both activities. In an instant-app generated code only references from the first module are in the scope. So you can't access components from an activity of another module.
QUESTION: How to test inter-module actions in Espresso?
Opened a bug issue at Google: https://issuetracker.google.com/u/4/issues/77502630
As far as there is no movement on the bug, I've resulted with a workaround, using Appium. It can be integrated into Android Studio tests, though a parrallel Appium window should be kept open in your system.
Appium is a higher-level testing framework on base of Selenium Web Driver. So it doesn't use Android Project Resources like Espresso and allows cross-feature testing. Moreover it allows cross-app testing and testing your app integractions with Android System messaging, settings, power, cellular signal and other features.
Here is a detailed instruction on how to setup Appium with Android Studio testing.