This is more of a feature request - allow capturing screenshot with multiple root nodes.
Multiple root nodes would typically mean there's a Popup being shown on the screen.
Steps to reproduce
Render some conventional @Composables
Render Popup on the screen, for example DropdownMenu.
Use ScreenshotTest.compareScreenshot(node: SemanticsNodeInteraction, name: String? = null) to capture and compare screenshots.
Resulting in the following error:
java.lang.AssertionError: Failed to capture a node to bitmap.
Reason: Expected exactly '1' node but found '2' nodes that satisfy: (isRoot)
Nodes found:
1) Node #597 at (l=0.0, t=66.0, r=1080.0, b=1532.0)px
Has 2 children
2) Node #608 at (l=0.0, t=0.0, r=706.0, b=389.0)px
Has 1 child
Proposal
Introduce ScreenshotTest.compareScreenshot(nodeCollection: SemanticsNodeInteractionCollection, name: String? = null) to allow passing in multiple nodes. First node in collection should likely define output screenshot dimensions, the rest nodes can be applied upon the result of previous application. Here's the example where 1 is the first node, 2 is applied upon 1, 3 is applied upon 1+2:
What
This is more of a feature request - allow capturing screenshot with multiple root nodes. Multiple root nodes would typically mean there's a
Popup
being shown on the screen.Steps to reproduce
@Composable
sPopup
on the screen, for example DropdownMenu.ScreenshotTest.compareScreenshot(node: SemanticsNodeInteraction, name: String? = null)
to capture and compare screenshots.Resulting in the following error:
Proposal
Introduce
ScreenshotTest.compareScreenshot(nodeCollection: SemanticsNodeInteractionCollection, name: String? = null)
to allow passing in multiple nodes. First node in collection should likely define output screenshot dimensions, the rest nodes can be applied upon the result of previous application. Here's the example where1
is the first node,2
is applied upon1
,3
is applied upon1+2
:Version of the library
5.11.2
@pedrovgs I'm wondering if you'd be interested in me making such contribution to the library?