printing-the-semantics-tree

Dump Jetpack Compose semantics trees to diagnose UI test finder failures.

303|10|Updated May 15, 2026
One-click install
npx skills add https://github.com/skydoves/android-testing-skills --skill printing-the-semantics-tree
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: printing-the-semantics-tree
Source: https://github.com/skydoves/android-testing-skills/tree/main/compose/debug/printing-the-semantics-tree
Command: npx skills add https://github.com/skydoves/android-testing-skills --skill printing-the-semantics-tree

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill resolves Jetpack Compose UI test failures where node finders can’t locate the expected element because the developer is matching against the wrong semantics tree (merged vs unmerged) or the tag/matcher is structurally incorrect.

Core Features & Use Cases

  • Dump the actual semantics tree: Print the merged tree to log or string to verify what the test framework currently sees.
  • Escalate to the unmerged tree when needed: Use the framework’s built-in hint to flip useUnmergedTree and reveal nodes hidden by semantics merging.
  • Inspect nodes for custom assertions: Fetch SemanticsNode(s) with fetchSemanticsNode or fetchSemanticsNodes to validate config values directly (including cases that require deeper matcher logic).

Quick Start

Ask your AI coding agent to dump the merged semantics tree for the failing finder using rule.onRoot().printToLog("DEBUG"), then re-run with useUnmergedTree = true if the expected node appears only in the unmerged output.

Frequently Asked Questions about printing-the-semantics-tree

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

FAQPage Schema
How do I fix Jetpack Compose UI test finder failures when no nodes match?

Fix Compose UI test finder failures by dumping the actual semantics tree using printToLog or printToString to inspect what the test framework currently sees and identify where the expected node exists.

Why does my Compose test report a node is found in the unmerged tree?

A node found in the unmerged tree indicates semantics merging is hiding the descendant node. You must flip useUnmergedTree to true in your finder configuration to reveal and match against the hidden node.

How do I print the semantics tree in Jetpack Compose UI testing?

Print the semantics tree in Jetpack Compose by calling rule.onRoot().printToLog("DEBUG") or using printToString to output the merged tree structure and verify the existing semantics properties.

Can I fetch a specific SemanticsNode for custom assertions in Compose testing?

Yes, you can fetch SemanticsNode or fetchSemanticsNodes to validate configuration values directly and perform deeper matcher introspection for custom assertions when standard finders fail.

When should I use the unmerged tree instead of the merged tree in Compose tests?

Use the unmerged tree when a test reports no matches but the expected node appears in the unmerged output, meaning semantics merging has hidden the descendant nodes you are trying to match.

How do I debug multiple matches errors in Jetpack Compose semantics testing?

Debug multiple matches errors by dumping the semantics tree with printToString to inspect the node hierarchy and refine your matcher or test tag to target the specific node uniquely.