SwingWindowInteraction
A lazy handle to the single top-level window targeted by a window query. The target is resolved against the live set of realized windows each time it is needed, so it always reflects windows appearing and disappearing across recomposition.
A window matches while its native peer is realized, whether or not it is currently shown, so a window declared visible = false is still matched once its peer is realized - AWT realizes a window when it is shown, and when it is packed to its content's preferred size. A window that leaves the composition is disposed, which retires its peer and drops it out of the match set; a disposed peer lingering in the global AWT window list is likewise excluded because it is no longer realized.
Beyond asserting on the window itself, the interaction scopes node queries to that window's own content - its content pane and its menu bar - so a test can assert on the content of each top-level peer independently:
onWindowWithTitle("Settings").onNodeWithText("Apply").assertIsEnabled()All methods are intended to be called from a org.jetbrains.compose.swing.test.runComposeSwingTest body, which runs on the EDT.
Functions
Asserts that no realized window matches.
Asserts that exactly one realized window matches. Returns this interaction for chaining.
Asserts the matched window is not visible.
Asserts the matched window is visible.
Finds all nodes matching matcher inside this window's content.
Finds all nodes inside this window's content tagged with tag via SwingModifier.testTag.
Finds the single node matching matcher inside this window's content. Both the window and the node are resolved lazily when the returned interaction is first used.
Finds the single node inside this window's content whose java.awt.Component.getName equals name.
Finds the single node inside this window's content tagged with tag via SwingModifier.testTag.