cross-app-tests-with-uiautomator

Drive cross-process Android UI automation with UiAutomator 2.3.0 APIs.

303|10|Updated May 15, 2026
One-click install
npx skills add https://github.com/skydoves/android-testing-skills --skill cross-app-tests-with-uiautomator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cross-app-tests-with-uiautomator
Source: https://github.com/skydoves/android-testing-skills/tree/main/instrumentation/uiautomator/cross-app-tests-with-uiautomator
Command: npx skills add https://github.com/skydoves/android-testing-skills --skill cross-app-tests-with-uiautomator

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill solves the challenge of reliably driving cross-process Android UI flows—like Settings, system notifications, and another app’s screens—from instrumentation tests when Espresso can’t interact across foreign windows.

Core Features & Use Cases

  • Cross-app/system UI control with UiAutomator 2.3.0: Use UiDevice global actions (home, back, recents, notifications, quick settings) and interact with UI nodes across package boundaries.
  • Modern selector-based element targeting: Use BySelector with By factory methods to resolve UiObject2 elements using BySelector criteria.
  • Robustness for real device flakiness: Handle findObject returning null, prefer device.wait(Until...), and recover from StaleObjectException by re-finding after transitions or UI refreshes.
  • Safer launch strategy for foreign packages: Prefer Context.startActivity plus <queries> on API 30+, while documenting the discouraged executeShellCommand path.
  • Use cases: Turn Wi‑Fi on/off via Settings, dismiss the notification shade, test a share/contact picker flow that spans the app under test and another activity.

Quick Start

Use cross-app-tests-with-uiautomator to launch Settings from an instrumentation test, wait until the target Settings package appears, and then click a specific Settings screen element using a By selector.

Frequently Asked Questions about cross-app-tests-with-uiautomator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test Android UI flows that span multiple apps or system settings?

Cross-app Android UI testing uses UiAutomator's UiDevice and BySelector APIs to drive system UI and foreign app windows from instrumentation tests. This allows reliable interaction across package boundaries where Espresso fails.

How do I interact with system UI like notifications or quick settings in Android instrumentation tests?

You can control system UI in instrumentation tests using UiAutomator's UiDevice global actions to trigger home, back, recents, notifications, and quick settings panel interactions across package boundaries.

Why does my UiAutomator test fail with a StaleObjectException during UI transitions?

StaleObjectException occurs when UI elements become invalid during transitions or refreshes. Recover from StaleObjectException by re-finding elements with BySelector criteria and gating resolution with Until conditions after UI transitions complete.

Does UiAutomator require package visibility declarations to launch foreign apps on Android 11?

Yes, launching foreign packages on API 30+ requires adding <queries> declarations to the test manifest. Prefer using Context.startActivity with these declarations rather than the discouraged executeShellCommand path.

What is the best way to wait for a UI element to appear in cross-app Android tests?

The best way to wait for UI elements in cross-app tests is using device.wait(Until...) conditions with BySelector criteria. This approach prevents flakiness from null findObject returns by gating element resolution until the target appears.

Can I use Espresso to navigate Settings or interact with system notifications?

Espresso cannot interact across foreign windows or system UI. For navigating Settings, dismissing notification shades, or testing multi-window flows, use UiAutomator 2.3.0 with UiObject2 and BySelector APIs instead.