printing-the-semantics-tree

Diagnose Jetpack Compose UI test finder failures by inspecting the semantics tree.

Updated Jul 20, 2026
One-click install
npx skills add https://github.com/trancee/MeshLink-template --skill printing-the-semantics-tree-trancee
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: printing-the-semantics-tree
Source: https://github.com/trancee/MeshLink-template/tree/main/.agents/skills/android-testing-skills/compose/debug/printing-the-semantics-tree
Command: npx skills add https://github.com/trancee/MeshLink-template --skill printing-the-semantics-tree-trancee

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill resolves frustrating UI test failures where finders cannot locate nodes, helping you distinguish between structural issues, incorrect tags, and merged vs. unmerged tree visibility.

Core Features & Use Cases

  • Tree Visualization: Dumps the full semantics tree to logcat or string format to reveal node IDs, tags, and properties.
  • Diagnostic Hints: Identifies when nodes are hidden in the unmerged tree, providing a clear path to fix failing assertions.
  • Use Case: When a test fails with a "no node matched" error, use this skill to inspect the actual hierarchy and verify if the node is present but collapsed under a merging composable.

Quick Start

Use the printing-the-semantics-tree skill to dump the merged semantics tree to the debug log for the current screen.

Frequently Asked Questions about printing-the-semantics-tree

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

FAQPage Schema
Why does my Jetpack Compose UI test fail with a node not found error?

Jetpack Compose UI test finder failures often occur because the node is collapsed under a merging composable or has incorrect tags. Dumping the semantics tree reveals the actual hierarchy to verify if the node exists but is hidden in the unmerged tree.

How do I dump the Jetpack Compose semantics tree to debug UI tests?

Dump the Jetpack Compose semantics tree by using the printToLog API to output the full node hierarchy to logcat. This visualization reveals node IDs, tags, and properties to diagnose missing nodes or ambiguous matches in instrumentation tests.

What is the difference between merged and unmerged semantics trees in Compose testing?

Merged semantics trees combine child node properties into parent composables, potentially hiding nodes. Inspecting the unmerged tree helps verify if a node is actually present but collapsed, providing a clear path to fix failing assertions when finders cannot locate nodes.

Do I need specific dependencies to inspect the Compose semantics tree?

Yes, inspecting the Compose semantics tree requires the androidx.compose.ui:ui-test library. This dependency provides the necessary printToLog and fetchSemanticsNode APIs to access and dump the tree structure during Android instrumentation tests.

How do I fix ambiguous match errors in Jetpack Compose UI tests?

Fix ambiguous match errors in Jetpack Compose UI tests by inspecting the dumped semantics tree structure. Visualizing node IDs and properties helps distinguish between structural issues and incorrect tags, clarifying which node the test finder is incorrectly matching.

Can I output the Compose semantics tree to a string instead of logcat?

Yes, the Compose semantics tree can be output to a string format instead of logcat. This allows you to inspect node IDs, tags, and properties directly in your test diagnostics to resolve missing nodes or merged tree visibility issues.