Function: findByTestId()
findByTestId(
container,testId,options?):Promise<Widget>
Defined in: queries.ts:476
Finds a single element by test ID (widget name).
Uses the widget's name property as a test identifier.
Set via the name prop on GTKX components.
Parameters
| Parameter | Type | Description |
|---|---|---|
container | Container | The container to search within |
testId | TextMatch | Test ID to match (string, RegExp, or custom matcher) |
options? | TextMatchOptions | Query options including normalization and timeout |
Returns
Promise<Widget>
Promise resolving to the matching widget
Example
// In component: <GtkButton name="submit-btn" />
const button = await findByTestId(container, "submit-btn");