Skip to main content

@gtkx/testing

Functions

FunctionDescription
cleanupCleans up the rendered component by unmounting it and destroying windows. Should be called after each test to reset state.
findAllByLabelTextWaits for and finds all widgets matching the specified label text.
findAllByRoleWaits for and finds all widgets matching the specified accessible role.
findAllByTestIdWaits for and finds all widgets matching the specified test ID.
findAllByTextWaits for and finds all widgets matching the specified text content.
findByLabelTextWaits for and finds a single widget matching the specified label text.
findByRoleWaits for and finds a single widget matching the specified accessible role.
findByTestIdWaits for and finds a single widget matching the specified test ID.
findByTextWaits for and finds a single widget matching the specified text content.
renderRenders a React element into a GTK application for testing.
teardownTears down the testing environment by cleaning up and stopping GTK. Can be used as global teardown in your test runner configuration.
waitForWaits for a callback to succeed without throwing an error.
waitForElementToBeRemovedWaits for an element to be removed from the widget tree.

Variables

VariableDescription
fireEventFires GTK signals on widgets for testing. Can be called directly with a signal name or using convenience methods like fireEvent.click().
screenGlobal screen object providing query methods bound to the current render root. Similar to Testing Library's screen, it provides all query variants without needing to destructure from render().
userEventSimulates user interactions with GTK widgets. Provides methods that mimic real user behavior like clicking, typing, and clearing input fields. Use userEvent.setup() to create an instance with custom options.

Interfaces

InterfaceDescription
ByRoleOptions-
RenderOptions-
RenderResult-
TextMatchOptions-
UserEventInstanceInstance returned by userEvent.setup() with bound options.
UserEventOptionsOptions for configuring user event behavior.
WaitForOptions-