traitsui.testing.tester.target_registry module¶
Define the registry object responsible for collecting and reporting implementations for testing various GUI elements.
- class traitsui.testing.tester.target_registry.TargetRegistry[source]¶
Bases:
AbstractTargetRegistry
An object for registering interaction and location resolution logic for different UI target types.
register_interaction
supports extendingUIWrapper.perform
andUIWrapper.inspect
for a given UI target type and interaction type.register_location
supports extendingUIWrapper.locate
for a given UI target type and location type.See How extension works in the User Manual for further details.
- register_interaction(target_class, interaction_class, handler)[source]¶
Register a handler for a given target type and interaction type.
- Parameters:
target_class (subclass of type) – The type of a UI target being operated on.
interaction_class (subclass of type) – Any class.
handler (callable(UIWrapper, interaction) -> any) – The function to handle the particular interaction on a target.
interaction
should be an instance ofinteraction_class
.
- Raises:
ValueError – If a handler has already be registered for the same target type and interaction class.
- register_location(target_class, locator_class, solver)[source]¶
Register a solver for resolving the next UI target for the given target type and locator type.
- Parameters:
target_class (subclass of type) – The type of a UI target being operated on.
locator_class (subclass of type) – Any class.
solver (callable(UIWrapper, location) -> any) – A callable for resolving a location into a new target. The location argument will be an instance of locator_class.
- Raises:
ValueError – If a solver has already been registered for the given target type and locator type.