SubspaceSemanticsNodeInteractionCollection

class SubspaceSemanticsNodeInteractionCollection


Represents a collection of semantics nodes and the path to fetch them from the subspace semantics tree.

One can interact with these nodes by fetching their semantics information or accessing a specific node via its index. An instance of this collection can be obtained from onAllSubspaceNodes and convenience methods that use a specific filter, such as onAllSubspaceNodesWithTag.

Summary

Public constructors

Public functions

List<SubspaceSemanticsInfo>
fetchSemanticsNodes(
    atLeastOneRootRequired: Boolean,
    errorMessageOnFail: String?
)

Returns the list of semantics nodes captured by this collection.

operator SubspaceSemanticsNodeInteraction
get(index: Int)

Retrieves the interaction for the node at the given index in this collection.

Public constructors

SubspaceSemanticsNodeInteractionCollection

Added in 1.0.0-alpha15
SubspaceSemanticsNodeInteractionCollection(
    testContext: SubspaceTestContext,
    matcher: SubspaceSemanticsMatcher
)

Public functions

fetchSemanticsNodes

Added in 1.0.0-alpha15
fun fetchSemanticsNodes(
    atLeastOneRootRequired: Boolean = true,
    errorMessageOnFail: String? = null
): List<SubspaceSemanticsInfo>

Returns the list of semantics nodes captured by this collection.

This operation involves synchronization with the UI to fetch the latest node data. If accessed multiple times in a single atomic operation, caching the result is recommended to avoid performance overhead.

Parameters
atLeastOneRootRequired: Boolean = true

whether to throw an error if there is no compose content found in the current test application.

errorMessageOnFail: String? = null

the prefix to be added to the error message if the fetch operation fails.

Returns
List<SubspaceSemanticsInfo>

the list of matched SubspaceSemanticsInfo instances.

get

Added in 1.0.0-alpha15
operator fun get(index: Int): SubspaceSemanticsNodeInteraction

Retrieves the interaction for the node at the given index in this collection.

Any subsequent operation on the returned interaction will expect exactly one element to be found (unless SubspaceSemanticsNodeInteraction.assertDoesNotExist is used) and will fail if zero or multiple elements are found.

Parameters
index: Int

the zero-based index of the node to retrieve from the matched collection.

Returns
SubspaceSemanticsNodeInteraction

the interaction corresponding to the node at the specified index.