@gtkx/testing 0.20.0 → 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/README.md +122 -55
  2. package/dist/act.d.ts +19 -0
  3. package/dist/act.d.ts.map +1 -0
  4. package/dist/act.js +48 -0
  5. package/dist/act.js.map +1 -0
  6. package/dist/bound-queries.d.ts +32 -0
  7. package/dist/bound-queries.d.ts.map +1 -0
  8. package/dist/bound-queries.js +2 -0
  9. package/dist/bound-queries.js.map +1 -0
  10. package/dist/build-queries.d.ts +16 -0
  11. package/dist/build-queries.d.ts.map +1 -0
  12. package/dist/build-queries.js +103 -0
  13. package/dist/build-queries.js.map +1 -0
  14. package/dist/cleanup-registry.d.ts +4 -0
  15. package/dist/cleanup-registry.d.ts.map +1 -0
  16. package/dist/cleanup-registry.js +11 -0
  17. package/dist/cleanup-registry.js.map +1 -0
  18. package/dist/config.d.ts +18 -51
  19. package/dist/config.d.ts.map +1 -1
  20. package/dist/config.js +9 -40
  21. package/dist/config.js.map +1 -1
  22. package/dist/editable.d.ts +7 -0
  23. package/dist/editable.d.ts.map +1 -0
  24. package/dist/editable.js +24 -0
  25. package/dist/editable.js.map +1 -0
  26. package/dist/errors.d.ts +29 -0
  27. package/dist/errors.d.ts.map +1 -0
  28. package/dist/errors.js +119 -0
  29. package/dist/errors.js.map +1 -0
  30. package/dist/fire-event.d.ts +7 -25
  31. package/dist/fire-event.d.ts.map +1 -1
  32. package/dist/fire-event.js +9 -29
  33. package/dist/fire-event.js.map +1 -1
  34. package/dist/frame-sync.d.ts +3 -0
  35. package/dist/frame-sync.d.ts.map +1 -0
  36. package/dist/frame-sync.js +30 -0
  37. package/dist/frame-sync.js.map +1 -0
  38. package/dist/index.d.ts +16 -11
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +10 -6
  41. package/dist/index.js.map +1 -1
  42. package/dist/matchers.d.ts +55 -0
  43. package/dist/matchers.d.ts.map +1 -0
  44. package/dist/matchers.js +103 -0
  45. package/dist/matchers.js.map +1 -0
  46. package/dist/pretty-widget.d.ts +21 -25
  47. package/dist/pretty-widget.d.ts.map +1 -1
  48. package/dist/pretty-widget.js +69 -115
  49. package/dist/pretty-widget.js.map +1 -1
  50. package/dist/queries.d.ts +130 -177
  51. package/dist/queries.d.ts.map +1 -1
  52. package/dist/queries.js +212 -325
  53. package/dist/queries.js.map +1 -1
  54. package/dist/register-test-hooks.d.ts +2 -0
  55. package/dist/register-test-hooks.d.ts.map +1 -0
  56. package/dist/register-test-hooks.js +15 -0
  57. package/dist/register-test-hooks.js.map +1 -0
  58. package/dist/render-hook.d.ts +14 -35
  59. package/dist/render-hook.d.ts.map +1 -1
  60. package/dist/render-hook.js +8 -45
  61. package/dist/render-hook.js.map +1 -1
  62. package/dist/render.d.ts +11 -41
  63. package/dist/render.d.ts.map +1 -1
  64. package/dist/render.js +129 -118
  65. package/dist/render.js.map +1 -1
  66. package/dist/role-helpers.d.ts +16 -51
  67. package/dist/role-helpers.d.ts.map +1 -1
  68. package/dist/role-helpers.js +39 -58
  69. package/dist/role-helpers.js.map +1 -1
  70. package/dist/screen.d.ts +6 -63
  71. package/dist/screen.d.ts.map +1 -1
  72. package/dist/screen.js +21 -109
  73. package/dist/screen.js.map +1 -1
  74. package/dist/screenshot.d.ts +20 -23
  75. package/dist/screenshot.d.ts.map +1 -1
  76. package/dist/screenshot.js +89 -48
  77. package/dist/screenshot.js.map +1 -1
  78. package/dist/suggestions.d.ts +22 -0
  79. package/dist/suggestions.d.ts.map +1 -0
  80. package/dist/suggestions.js +56 -0
  81. package/dist/suggestions.js.map +1 -0
  82. package/dist/traversal.d.ts +10 -8
  83. package/dist/traversal.d.ts.map +1 -1
  84. package/dist/traversal.js +28 -13
  85. package/dist/traversal.js.map +1 -1
  86. package/dist/types.d.ts +103 -172
  87. package/dist/types.d.ts.map +1 -1
  88. package/dist/types.js.map +1 -1
  89. package/dist/user-event/adjustment.d.ts +8 -0
  90. package/dist/user-event/adjustment.d.ts.map +1 -0
  91. package/dist/user-event/adjustment.js +33 -0
  92. package/dist/user-event/adjustment.js.map +1 -0
  93. package/dist/user-event/click.d.ts +7 -0
  94. package/dist/user-event/click.d.ts.map +1 -0
  95. package/dist/user-event/click.js +65 -0
  96. package/dist/user-event/click.js.map +1 -0
  97. package/dist/user-event/controller.d.ts +7 -0
  98. package/dist/user-event/controller.d.ts.map +1 -0
  99. package/dist/user-event/controller.js +28 -0
  100. package/dist/user-event/controller.js.map +1 -0
  101. package/dist/user-event/dispatch.d.ts +7 -0
  102. package/dist/user-event/dispatch.d.ts.map +1 -0
  103. package/dist/user-event/dispatch.js +10 -0
  104. package/dist/user-event/dispatch.js.map +1 -0
  105. package/dist/user-event/event-wrapper.d.ts +3 -0
  106. package/dist/user-event/event-wrapper.d.ts.map +1 -0
  107. package/dist/user-event/event-wrapper.js +48 -0
  108. package/dist/user-event/event-wrapper.js.map +1 -0
  109. package/dist/user-event/gesture.d.ts +31 -0
  110. package/dist/user-event/gesture.d.ts.map +1 -0
  111. package/dist/user-event/gesture.js +105 -0
  112. package/dist/user-event/gesture.js.map +1 -0
  113. package/dist/user-event/index.d.ts +44 -0
  114. package/dist/user-event/index.d.ts.map +1 -0
  115. package/dist/user-event/index.js +38 -0
  116. package/dist/user-event/index.js.map +1 -0
  117. package/dist/user-event/keyboard.d.ts +9 -0
  118. package/dist/user-event/keyboard.d.ts.map +1 -0
  119. package/dist/user-event/keyboard.js +173 -0
  120. package/dist/user-event/keyboard.js.map +1 -0
  121. package/dist/user-event/pointer.d.ts +6 -0
  122. package/dist/user-event/pointer.d.ts.map +1 -0
  123. package/dist/user-event/pointer.js +27 -0
  124. package/dist/user-event/pointer.js.map +1 -0
  125. package/dist/user-event/selection.d.ts +4 -0
  126. package/dist/user-event/selection.d.ts.map +1 -0
  127. package/dist/user-event/selection.js +106 -0
  128. package/dist/user-event/selection.js.map +1 -0
  129. package/dist/user-event/state.d.ts +6 -0
  130. package/dist/user-event/state.d.ts.map +1 -0
  131. package/dist/user-event/state.js +2 -0
  132. package/dist/user-event/state.js.map +1 -0
  133. package/dist/user-event/text.d.ts +17 -0
  134. package/dist/user-event/text.d.ts.map +1 -0
  135. package/dist/user-event/text.js +107 -0
  136. package/dist/user-event/text.js.map +1 -0
  137. package/dist/wait-for.d.ts +13 -32
  138. package/dist/wait-for.d.ts.map +1 -1
  139. package/dist/wait-for.js +62 -73
  140. package/dist/wait-for.js.map +1 -1
  141. package/dist/widget-accessible-properties.d.ts +33 -0
  142. package/dist/widget-accessible-properties.d.ts.map +1 -0
  143. package/dist/widget-accessible-properties.js +215 -0
  144. package/dist/widget-accessible-properties.js.map +1 -0
  145. package/dist/within.d.ts +9 -26
  146. package/dist/within.d.ts.map +1 -1
  147. package/dist/within.js +15 -25
  148. package/dist/within.js.map +1 -1
  149. package/package.json +21 -12
  150. package/src/act.ts +68 -0
  151. package/src/bound-queries.ts +36 -0
  152. package/src/build-queries.ts +185 -0
  153. package/src/cleanup-registry.ts +14 -0
  154. package/src/config.ts +28 -59
  155. package/src/editable.ts +30 -0
  156. package/src/errors.ts +130 -0
  157. package/src/fire-event.ts +11 -38
  158. package/src/frame-sync.ts +34 -0
  159. package/src/index.ts +60 -18
  160. package/src/matchers.ts +200 -0
  161. package/src/pretty-widget.ts +99 -138
  162. package/src/queries.ts +321 -425
  163. package/src/register-test-hooks.ts +16 -0
  164. package/src/render-hook.tsx +31 -44
  165. package/src/render.tsx +161 -149
  166. package/src/role-helpers.ts +47 -67
  167. package/src/screen.ts +21 -114
  168. package/src/screenshot.ts +104 -55
  169. package/src/suggestions.ts +87 -0
  170. package/src/traversal.ts +32 -18
  171. package/src/types.ts +115 -176
  172. package/src/user-event/adjustment.ts +49 -0
  173. package/src/user-event/click.ts +70 -0
  174. package/src/user-event/controller.ts +44 -0
  175. package/src/user-event/dispatch.ts +23 -0
  176. package/src/user-event/event-wrapper.ts +54 -0
  177. package/src/user-event/gesture.ts +154 -0
  178. package/src/user-event/index.ts +74 -0
  179. package/src/user-event/keyboard.ts +204 -0
  180. package/src/user-event/pointer.ts +34 -0
  181. package/src/user-event/selection.ts +122 -0
  182. package/src/user-event/state.ts +6 -0
  183. package/src/user-event/text.ts +137 -0
  184. package/src/wait-for.ts +79 -80
  185. package/src/widget-accessible-properties.ts +244 -0
  186. package/src/within.ts +26 -27
  187. package/dist/bind-queries.d.ts +0 -14
  188. package/dist/bind-queries.d.ts.map +0 -1
  189. package/dist/bind-queries.js +0 -29
  190. package/dist/bind-queries.js.map +0 -1
  191. package/dist/error-builder.d.ts +0 -28
  192. package/dist/error-builder.d.ts.map +0 -1
  193. package/dist/error-builder.js +0 -81
  194. package/dist/error-builder.js.map +0 -1
  195. package/dist/timing.d.ts +0 -18
  196. package/dist/timing.d.ts.map +0 -1
  197. package/dist/timing.js +0 -18
  198. package/dist/timing.js.map +0 -1
  199. package/dist/user-event.d.ts +0 -138
  200. package/dist/user-event.d.ts.map +0 -1
  201. package/dist/user-event.js +0 -411
  202. package/dist/user-event.js.map +0 -1
  203. package/dist/widget-text.d.ts +0 -69
  204. package/dist/widget-text.d.ts.map +0 -1
  205. package/dist/widget-text.js +0 -177
  206. package/dist/widget-text.js.map +0 -1
  207. package/dist/widget.d.ts +0 -3
  208. package/dist/widget.d.ts.map +0 -1
  209. package/dist/widget.js +0 -13
  210. package/dist/widget.js.map +0 -1
  211. package/src/bind-queries.ts +0 -52
  212. package/src/error-builder.ts +0 -102
  213. package/src/timing.ts +0 -17
  214. package/src/user-event.ts +0 -492
  215. package/src/widget-text.ts +0 -202
  216. package/src/widget.ts +0 -15
package/src/queries.ts CHANGED
@@ -1,26 +1,36 @@
1
- import * as Gtk from "@gtkx/ffi/gtk";
2
- import { buildMultipleFoundError, buildNotFoundError } from "./error-builder.js";
1
+ import * as Gtk from "@gtkx/gi/gtk";
2
+ import { type BuiltQueries, buildQueries, type QueryAllBy } from "./build-queries.js";
3
+ import { multipleFoundError, notFoundError } from "./errors.js";
3
4
  import { type Container, findAll, traverse } from "./traversal.js";
4
- import type { ByRoleOptions, TextMatch, TextMatchOptions } from "./types.js";
5
- import { waitFor } from "./wait-for.js";
5
+ import type { ByRoleOptions, ByRoleValue, Matcher, MatcherOptions, NormalizerFn, NormalizerOptions } from "./types.js";
6
6
  import {
7
7
  getWidgetAccessibleName,
8
+ getWidgetBusyState,
8
9
  getWidgetCheckedState,
10
+ getWidgetDescription,
11
+ getWidgetDisplayValue,
9
12
  getWidgetExpandedState,
13
+ getWidgetLabelledByText,
14
+ getWidgetLabelText,
15
+ getWidgetLevel,
16
+ getWidgetName,
17
+ getWidgetOwnLabel,
18
+ getWidgetPlaceholderText,
10
19
  getWidgetPressedState,
11
20
  getWidgetSelectedState,
12
- getWidgetTestId,
13
- getWidgetText,
14
- } from "./widget-text.js";
15
-
16
- const buildNormalizer = (options?: TextMatchOptions): ((text: string) => string) => {
17
- if (options?.normalizer) {
18
- return options.normalizer;
19
- }
20
-
21
- const trim = options?.trim ?? true;
22
- const collapseWhitespace = options?.collapseWhitespace ?? true;
21
+ getWidgetValue,
22
+ isInaccessible,
23
+ } from "./widget-accessible-properties.js";
23
24
 
25
+ /**
26
+ * Builds the default text normalizer, which optionally trims surrounding whitespace and collapses runs of whitespace into single spaces.
27
+ * @param options Toggles for trimming and whitespace collapsing.
28
+ * @returns A function that normalizes a string for comparison against a matcher.
29
+ */
30
+ export const getDefaultNormalizer = ({
31
+ trim = true,
32
+ collapseWhitespace = true,
33
+ }: NormalizerOptions = {}): NormalizerFn => {
24
34
  return (text: string): string => {
25
35
  let result = text;
26
36
  if (trim) {
@@ -28,24 +38,37 @@ const buildNormalizer = (options?: TextMatchOptions): ((text: string) => string)
28
38
  }
29
39
 
30
40
  if (collapseWhitespace) {
31
- result = result.replace(/\s+/g, " ");
41
+ result = result.replaceAll(/\s+/g, " ");
32
42
  }
33
43
 
34
44
  return result;
35
45
  };
36
46
  };
37
47
 
38
- const normalizeText = (text: string, options?: TextMatchOptions): string => {
48
+ const buildNormalizer = (options?: MatcherOptions): NormalizerFn => {
49
+ const { normalizer, trim, collapseWhitespace } = options ?? {};
50
+
51
+ if (!normalizer) {
52
+ return getDefaultNormalizer({ trim, collapseWhitespace });
53
+ }
54
+
55
+ if (trim !== undefined || collapseWhitespace !== undefined) {
56
+ throw new Error(
57
+ "trim and collapseWhitespace are not supported with a normalizer. " +
58
+ "If you want to use the default trim and collapseWhitespace logic in your normalizer, " +
59
+ 'use "getDefaultNormalizer({ trim, collapseWhitespace })" and compose that into your normalizer',
60
+ );
61
+ }
62
+
63
+ return normalizer;
64
+ };
65
+
66
+ const normalizeText = (text: string, options?: MatcherOptions): string => {
39
67
  const normalizer = buildNormalizer(options);
40
68
  return normalizer(text);
41
69
  };
42
70
 
43
- const matchText = (
44
- actual: string | null,
45
- expected: TextMatch,
46
- widget: Gtk.Widget,
47
- options?: TextMatchOptions,
48
- ): boolean => {
71
+ const matchText = (actual: string | null, expected: Matcher, widget: Gtk.Widget, options?: MatcherOptions): boolean => {
49
72
  if (actual === null) return false;
50
73
 
51
74
  const normalizedActual = normalizeText(actual, options);
@@ -59,453 +82,326 @@ const matchText = (
59
82
  return expected.test(normalizedActual);
60
83
  }
61
84
 
62
- const normalizedExpected = normalizeText(expected, options);
85
+ const normalizedExpected = normalizeText(String(expected), options);
63
86
  const exact = options?.exact ?? true;
64
87
  return exact
65
88
  ? normalizedActual === normalizedExpected
66
89
  : normalizedActual.toLowerCase().includes(normalizedExpected.toLowerCase());
67
90
  };
68
91
 
69
- const matchByRoleOptions = (widget: Gtk.Widget, options?: ByRoleOptions): boolean => {
70
- if (!options) return true;
71
-
72
- if (options.name !== undefined) {
73
- const text = getWidgetAccessibleName(widget);
74
- if (!matchText(text, options.name, widget, options)) return false;
75
- }
76
-
77
- if (options.checked !== undefined) {
78
- const checked = getWidgetCheckedState(widget);
79
- if (checked !== options.checked) return false;
80
- }
81
-
82
- if (options.pressed !== undefined) {
83
- const pressed = getWidgetPressedState(widget);
84
- if (pressed !== options.pressed) return false;
85
- }
86
-
87
- if (options.expanded !== undefined) {
88
- const expanded = getWidgetExpandedState(widget);
89
- if (expanded !== options.expanded) return false;
90
- }
91
-
92
- if (options.selected !== undefined) {
93
- const selected = getWidgetSelectedState(widget);
94
- if (selected !== options.selected) return false;
95
- }
96
-
97
- return true;
92
+ const matchAccessibleName = (widget: Gtk.Widget, options: ByRoleOptions): boolean => {
93
+ if (options.name === undefined) return true;
94
+ const text = getWidgetAccessibleName(widget);
95
+ return matchText(text, options.name, widget, options);
98
96
  };
99
97
 
100
- /**
101
- * Finds all elements matching a role without throwing.
102
- *
103
- * @param container - The container to search within
104
- * @param role - The GTK accessible role to match
105
- * @param options - Query options including name and state filters
106
- * @returns Array of matching widgets (empty if none found)
107
- */
108
- export const queryAllByRole = (
109
- container: Container,
110
- role: Gtk.AccessibleRole,
111
- options?: ByRoleOptions,
112
- ): Gtk.Widget[] => {
113
- return findAll(container, (node) => {
114
- if (node.getAccessibleRole() !== role) return false;
115
- return matchByRoleOptions(node, options);
116
- });
98
+ const matchAccessibleValue = (widget: Gtk.Widget, value: ByRoleValue, options: ByRoleOptions): boolean => {
99
+ const actual = getWidgetValue(widget);
100
+ if (value.now !== undefined && actual.now !== value.now) return false;
101
+ if (value.min !== undefined && actual.min !== value.min) return false;
102
+ if (value.max !== undefined && actual.max !== value.max) return false;
103
+ if (value.text !== undefined && !matchText(actual.text, value.text, widget, options)) return false;
104
+ return true;
117
105
  };
118
106
 
119
- /**
120
- * Finds a single element matching a role without throwing.
121
- *
122
- * @param container - The container to search within
123
- * @param role - The GTK accessible role to match
124
- * @param options - Query options including name and state filters
125
- * @returns The matching widget or null if not found
126
- * @throws Error if multiple elements match
127
- */
128
- export const queryByRole = (
129
- container: Container,
130
- role: Gtk.AccessibleRole,
131
- options?: ByRoleOptions,
132
- ): Gtk.Widget | null => {
133
- const matches = queryAllByRole(container, role, options);
134
-
135
- if (matches.length > 1) {
136
- throw buildMultipleFoundError(container, "role", { role, options }, matches.length);
137
- }
138
-
139
- return matches[0] ?? null;
107
+ const matchBooleanStates = (widget: Gtk.Widget, options: ByRoleOptions): boolean => {
108
+ if (options.checked !== undefined && getWidgetCheckedState(widget) !== options.checked) return false;
109
+ if (options.pressed !== undefined && getWidgetPressedState(widget) !== options.pressed) return false;
110
+ if (options.expanded !== undefined && getWidgetExpandedState(widget) !== options.expanded) return false;
111
+ if (options.selected !== undefined && getWidgetSelectedState(widget) !== options.selected) return false;
112
+ if (options.busy !== undefined && (getWidgetBusyState(widget) ?? false) !== options.busy) return false;
113
+ return true;
140
114
  };
141
115
 
142
- /**
143
- * Finds all elements that are labelled by a GtkLabel whose text matches.
144
- *
145
- * Uses GtkLabel's mnemonic widget association to find form elements
146
- * by their label text. Only returns widgets that are properly labelled
147
- * via GtkLabel's mnemonic-widget property.
148
- *
149
- * @param container - The container to search within
150
- * @param text - Label text to match (string, RegExp, or custom matcher)
151
- * @param options - Query options including normalization
152
- * @returns Array of labelled widgets (empty if none found)
153
- */
154
- export const queryAllByLabelText = (
155
- container: Container,
156
- text: TextMatch,
157
- options?: TextMatchOptions,
158
- ): Gtk.Widget[] => {
159
- const results: Gtk.Widget[] = [];
160
-
161
- for (const node of traverse(container)) {
162
- if (!(node instanceof Gtk.Label)) continue;
163
-
164
- const labelText = node.getLabel();
165
- if (!labelText) continue;
166
- if (!matchText(labelText, text, node, options)) continue;
167
-
168
- const target = node.getMnemonicWidget();
169
- if (target) {
170
- results.push(target);
171
- }
172
- }
173
-
174
- return results;
116
+ const matchAccessibleStates = (widget: Gtk.Widget, options: ByRoleOptions): boolean => {
117
+ if (!matchBooleanStates(widget, options)) return false;
118
+ if (options.level !== undefined && getWidgetLevel(widget) !== options.level) return false;
119
+ if (
120
+ options.description !== undefined &&
121
+ !matchText(getWidgetDescription(widget), options.description, widget, options)
122
+ )
123
+ return false;
124
+ if (options.value !== undefined && !matchAccessibleValue(widget, options.value, options)) return false;
125
+ return true;
175
126
  };
176
127
 
177
- /**
178
- * Finds a single element matching label text without throwing.
179
- *
180
- * @param container - The container to search within
181
- * @param text - Text to match (string, RegExp, or custom matcher)
182
- * @param options - Query options including normalization
183
- * @returns The matching widget or null if not found
184
- * @throws Error if multiple elements match
185
- */
186
- export const queryByLabelText = (
187
- container: Container,
188
- text: TextMatch,
189
- options?: TextMatchOptions,
190
- ): Gtk.Widget | null => {
191
- const matches = queryAllByLabelText(container, text, options);
192
-
193
- if (matches.length > 1) {
194
- throw buildMultipleFoundError(container, "labelText", { text, options }, matches.length);
195
- }
196
-
197
- return matches[0] ?? null;
128
+ const matchByRoleOptions = (widget: Gtk.Widget, options?: ByRoleOptions): boolean => {
129
+ if (!options) return true;
130
+ return matchAccessibleName(widget, options) && matchAccessibleStates(widget, options);
198
131
  };
199
132
 
200
- /**
201
- * Finds all elements matching text content without throwing.
202
- *
203
- * @param container - The container to search within
204
- * @param text - Text to match (string, RegExp, or custom matcher)
205
- * @param options - Query options including normalization
206
- * @returns Array of matching widgets (empty if none found)
207
- */
208
- export const queryAllByText = (container: Container, text: TextMatch, options?: TextMatchOptions): Gtk.Widget[] => {
209
- return findAll(container, (node) => {
210
- return matchText(getWidgetText(node), text, node, options);
211
- });
133
+ type NamedFamily<Suffix extends string, Args extends unknown[]> = {
134
+ [P in `queryBy${Suffix}`]: (container: Container, ...args: Args) => Gtk.Widget | null;
135
+ } & {
136
+ [P in `queryAllBy${Suffix}`]: (container: Container, ...args: Args) => Gtk.Widget[];
137
+ } & {
138
+ [P in `getBy${Suffix}`]: (container: Container, ...args: Args) => Gtk.Widget;
139
+ } & {
140
+ [P in `getAllBy${Suffix}`]: (container: Container, ...args: Args) => Gtk.Widget[];
141
+ } & {
142
+ [P in `findBy${Suffix}`]: (container: Container, ...args: Args) => Promise<Gtk.Widget>;
143
+ } & {
144
+ [P in `findAllBy${Suffix}`]: (container: Container, ...args: Args) => Promise<Gtk.Widget[]>;
212
145
  };
213
146
 
214
- /**
215
- * Finds a single element matching text content without throwing.
216
- *
217
- * @param container - The container to search within
218
- * @param text - Text to match (string, RegExp, or custom matcher)
219
- * @param options - Query options including normalization
220
- * @returns The matching widget or null if not found
221
- * @throws Error if multiple elements match
222
- */
223
- export const queryByText = (container: Container, text: TextMatch, options?: TextMatchOptions): Gtk.Widget | null => {
224
- const matches = queryAllByText(container, text, options);
225
-
226
- if (matches.length > 1) {
227
- throw buildMultipleFoundError(container, "text", { text, options }, matches.length);
228
- }
229
-
230
- return matches[0] ?? null;
147
+ const nameQueryFamily = <Suffix extends string, Args extends unknown[]>(
148
+ suffix: Suffix,
149
+ queryAllBy: QueryAllBy<Args>,
150
+ built: BuiltQueries<Args>,
151
+ ): NamedFamily<Suffix, Args> => {
152
+ const family = {
153
+ [`queryBy${suffix}`]: built.queryBy,
154
+ [`queryAllBy${suffix}`]: queryAllBy,
155
+ [`getBy${suffix}`]: built.getBy,
156
+ [`getAllBy${suffix}`]: built.getAllBy,
157
+ [`findBy${suffix}`]: built.findBy,
158
+ [`findAllBy${suffix}`]: built.findAllBy,
159
+ };
160
+ return family as NamedFamily<Suffix, Args>;
231
161
  };
232
162
 
233
163
  /**
234
- * Finds all elements matching a test ID without throwing.
235
- *
236
- * @param container - The container to search within
237
- * @param testId - Test ID to match (string, RegExp, or custom matcher)
238
- * @param options - Query options including normalization
239
- * @returns Array of matching widgets (empty if none found)
164
+ * Finds every widget under the container whose accessible role matches `role` and that satisfies the given options.
165
+ * Widgets excluded from the accessibility tree are skipped unless `options.hidden` is set.
166
+ * @param container Widget subtree to search.
167
+ * @param role Accessible role to match.
168
+ * @param options Additional accessible name, state, and value constraints.
169
+ * @returns Every matching widget, or an empty array when none match.
240
170
  */
241
- export const queryAllByTestId = (container: Container, testId: TextMatch, options?: TextMatchOptions): Gtk.Widget[] => {
242
- return findAll(container, (node) => {
243
- const widgetTestId = getWidgetTestId(node);
244
- return matchText(widgetTestId, testId, node, options);
171
+ export const queryAllByRole = (container: Container, role: Gtk.AccessibleRole, options?: ByRoleOptions): Gtk.Widget[] =>
172
+ findAll(container, (widget) => {
173
+ if (widget.getAccessibleRole() !== role) return false;
174
+ if (!options?.hidden && isInaccessible(widget)) return false;
175
+ return matchByRoleOptions(widget, options);
245
176
  });
246
- };
247
177
 
248
- /**
249
- * Finds a single element matching a test ID without throwing.
250
- *
251
- * @param container - The container to search within
252
- * @param testId - Test ID to match (string, RegExp, or custom matcher)
253
- * @param options - Query options including normalization
254
- * @returns The matching widget or null if not found
255
- * @throws Error if multiple elements match
256
- */
257
- export const queryByTestId = (
258
- container: Container,
259
- testId: TextMatch,
260
- options?: TextMatchOptions,
178
+ const roleQueries = nameQueryFamily(
179
+ "Role",
180
+ queryAllByRole,
181
+ buildQueries<[role: Gtk.AccessibleRole, options?: ByRoleOptions]>(
182
+ "Role",
183
+ queryAllByRole,
184
+ (container, matches, role, options) =>
185
+ multipleFoundError(container, { queryType: "role", role, options }, matches),
186
+ (container, role, options) => notFoundError(container, { queryType: "role", role, options }),
187
+ ),
188
+ );
189
+
190
+ const collectMnemonicMatch = (
191
+ widget: Gtk.Widget,
192
+ text: Matcher,
193
+ options: MatcherOptions | undefined,
261
194
  ): Gtk.Widget | null => {
262
- const matches = queryAllByTestId(container, testId, options);
263
-
264
- if (matches.length > 1) {
265
- throw buildMultipleFoundError(container, "testId", { testId, options }, matches.length);
266
- }
267
-
268
- return matches[0] ?? null;
269
- };
270
-
271
- const getAllByRole = (container: Container, role: Gtk.AccessibleRole, options?: ByRoleOptions): Gtk.Widget[] => {
272
- const matches = queryAllByRole(container, role, options);
273
-
274
- if (matches.length === 0) {
275
- throw buildNotFoundError(container, "role", { role, options });
276
- }
277
-
278
- return matches;
279
- };
280
-
281
- const getByRole = (container: Container, role: Gtk.AccessibleRole, options?: ByRoleOptions): Gtk.Widget => {
282
- const matches = getAllByRole(container, role, options);
283
-
284
- if (matches.length > 1) {
285
- throw buildMultipleFoundError(container, "role", { role, options }, matches.length);
286
- }
287
-
288
- return matches[0] as Gtk.Widget;
289
- };
290
-
291
- const getAllByLabelText = (container: Container, text: TextMatch, options?: TextMatchOptions): Gtk.Widget[] => {
292
- const matches = queryAllByLabelText(container, text, options);
293
-
294
- if (matches.length === 0) {
295
- throw buildNotFoundError(container, "labelText", { text, options });
296
- }
297
-
298
- return matches;
299
- };
300
-
301
- const getByLabelText = (container: Container, text: TextMatch, options?: TextMatchOptions): Gtk.Widget => {
302
- const matches = getAllByLabelText(container, text, options);
303
-
304
- if (matches.length > 1) {
305
- throw buildMultipleFoundError(container, "labelText", { text, options }, matches.length);
306
- }
307
-
308
- return matches[0] as Gtk.Widget;
309
- };
310
-
311
- const getAllByText = (container: Container, text: TextMatch, options?: TextMatchOptions): Gtk.Widget[] => {
312
- const matches = queryAllByText(container, text, options);
313
-
314
- if (matches.length === 0) {
315
- throw buildNotFoundError(container, "text", { text, options });
316
- }
317
-
318
- return matches;
319
- };
320
-
321
- const getByText = (container: Container, text: TextMatch, options?: TextMatchOptions): Gtk.Widget => {
322
- const matches = getAllByText(container, text, options);
323
-
324
- if (matches.length > 1) {
325
- throw buildMultipleFoundError(container, "text", { text, options }, matches.length);
326
- }
327
-
328
- return matches[0] as Gtk.Widget;
195
+ if (!(widget instanceof Gtk.Label)) return null;
196
+ const labelText = widget.getLabel();
197
+ if (!labelText || !matchText(labelText, text, widget, options)) return null;
198
+ return widget.getMnemonicWidget();
329
199
  };
330
200
 
331
- const getAllByTestId = (container: Container, testId: TextMatch, options?: TextMatchOptions): Gtk.Widget[] => {
332
- const matches = queryAllByTestId(container, testId, options);
333
-
334
- if (matches.length === 0) {
335
- throw buildNotFoundError(container, "testId", { testId, options });
336
- }
201
+ /**
202
+ * Finds every widget associated with a label whose text matches: a Gtk.Label mnemonic target, the widget's own accessible label, or its labelled-by relation.
203
+ * @param container Widget subtree to search.
204
+ * @param text Matcher for the label text.
205
+ * @param options Text matching options.
206
+ * @returns Every matching widget, or an empty array when none match.
207
+ */
208
+ export const queryAllByLabelText = (container: Container, text: Matcher, options?: MatcherOptions): Gtk.Widget[] => {
209
+ const results = new Set<Gtk.Widget>();
337
210
 
338
- return matches;
339
- };
211
+ for (const widget of traverse(container)) {
212
+ const mnemonicTarget = collectMnemonicMatch(widget, text, options);
213
+ if (mnemonicTarget) results.add(mnemonicTarget);
340
214
 
341
- const getByTestId = (container: Container, testId: TextMatch, options?: TextMatchOptions): Gtk.Widget => {
342
- const matches = getAllByTestId(container, testId, options);
215
+ const ownLabel = getWidgetOwnLabel(widget);
216
+ if (ownLabel !== null && matchText(ownLabel, text, widget, options)) results.add(widget);
343
217
 
344
- if (matches.length > 1) {
345
- throw buildMultipleFoundError(container, "testId", { testId, options }, matches.length);
218
+ const labelledByText = getWidgetLabelledByText(widget);
219
+ if (labelledByText !== null && matchText(labelledByText, text, widget, options)) results.add(widget);
346
220
  }
347
221
 
348
- return matches[0] as Gtk.Widget;
222
+ return [...results];
349
223
  };
350
224
 
351
- /**
352
- * Finds a single element by accessible role.
353
- *
354
- * Waits for the element to appear, throwing if not found within timeout.
355
- *
356
- * @param container - The container to search within
357
- * @param role - The GTK accessible role to match
358
- * @param options - Query options including name, state filters, and timeout
359
- * @returns Promise resolving to the matching widget
360
- *
361
- * @example
362
- * ```tsx
363
- * const button = await findByRole(container, Gtk.AccessibleRole.BUTTON, { name: "Submit" });
364
- * ```
365
- */
366
- export const findByRole = async (
367
- container: Container,
368
- role: Gtk.AccessibleRole,
369
- options?: ByRoleOptions,
370
- ): Promise<Gtk.Widget> =>
371
- waitFor(() => getByRole(container, role, options), {
372
- timeout: options?.timeout,
373
- });
374
-
375
- /**
376
- * Finds all elements matching an accessible role.
377
- *
378
- * @param container - The container to search within
379
- * @param role - The GTK accessible role to match
380
- * @param options - Query options including name, state filters, and timeout
381
- * @returns Promise resolving to array of matching widgets
382
- */
383
- export const findAllByRole = async (
384
- container: Container,
385
- role: Gtk.AccessibleRole,
386
- options?: ByRoleOptions,
387
- ): Promise<Gtk.Widget[]> =>
388
- waitFor(() => getAllByRole(container, role, options), {
389
- timeout: options?.timeout,
390
- });
391
-
392
- /**
393
- * Finds a single element that is labelled by a GtkLabel whose text matches.
394
- *
395
- * Waits for the element to appear, throwing if not found within timeout.
396
- * Uses GtkLabel's mnemonic widget association to find form elements.
397
- *
398
- * @param container - The container to search within
399
- * @param text - Label text to match (string, RegExp, or custom matcher)
400
- * @param options - Query options including normalization and timeout
401
- * @returns Promise resolving to the labelled widget
402
- *
403
- * @example
404
- * ```tsx
405
- * const input = await findByLabelText(container, "Username");
406
- * ```
407
- */
408
- export const findByLabelText = async (
409
- container: Container,
410
- text: TextMatch,
411
- options?: TextMatchOptions,
412
- ): Promise<Gtk.Widget> =>
413
- waitFor(() => getByLabelText(container, text, options), {
414
- timeout: options?.timeout,
415
- });
225
+ const labelTextQueries = nameQueryFamily(
226
+ "LabelText",
227
+ queryAllByLabelText,
228
+ buildQueries<[text: Matcher, options?: MatcherOptions]>(
229
+ "LabelText",
230
+ queryAllByLabelText,
231
+ (container, matches, text) => multipleFoundError(container, { queryType: "labelText", text }, matches),
232
+ (container, text) => notFoundError(container, { queryType: "labelText", text }),
233
+ ),
234
+ );
416
235
 
417
236
  /**
418
- * Finds all elements matching label or text content.
419
- *
420
- * @param container - The container to search within
421
- * @param text - Text to match (string, RegExp, or custom matcher)
422
- * @param options - Query options including normalization and timeout
423
- * @returns Promise resolving to array of matching widgets
237
+ * Finds every widget whose rendered text content matches.
238
+ * @param container Widget subtree to search.
239
+ * @param text Matcher for the widget text.
240
+ * @param options Text matching options.
241
+ * @returns Every matching widget, or an empty array when none match.
424
242
  */
425
- export const findAllByLabelText = async (
426
- container: Container,
427
- text: TextMatch,
428
- options?: TextMatchOptions,
429
- ): Promise<Gtk.Widget[]> =>
430
- waitFor(() => getAllByLabelText(container, text, options), {
431
- timeout: options?.timeout,
432
- });
243
+ export const queryAllByText = (container: Container, text: Matcher, options?: MatcherOptions): Gtk.Widget[] =>
244
+ findAll(container, (widget) => matchText(getWidgetLabelText(widget), text, widget, options));
245
+
246
+ const textQueries = nameQueryFamily(
247
+ "Text",
248
+ queryAllByText,
249
+ buildQueries<[text: Matcher, options?: MatcherOptions]>(
250
+ "Text",
251
+ queryAllByText,
252
+ (container, matches, text) => multipleFoundError(container, { queryType: "text", text }, matches),
253
+ (container, text) => notFoundError(container, { queryType: "text", text }),
254
+ ),
255
+ );
433
256
 
434
257
  /**
435
- * Finds a single element by visible text content.
436
- *
437
- * Similar to {@link findByLabelText} but focuses on directly visible text.
438
- *
439
- * @param container - The container to search within
440
- * @param text - Text to match (string, RegExp, or custom matcher)
441
- * @param options - Query options including normalization and timeout
442
- * @returns Promise resolving to the matching widget
258
+ * Finds every widget whose widget name matches.
259
+ * @param container Widget subtree to search.
260
+ * @param name Matcher for the widget name.
261
+ * @param options Text matching options.
262
+ * @returns Every matching widget, or an empty array when none match.
443
263
  */
444
- export const findByText = async (
445
- container: Container,
446
- text: TextMatch,
447
- options?: TextMatchOptions,
448
- ): Promise<Gtk.Widget> =>
449
- waitFor(() => getByText(container, text, options), {
450
- timeout: options?.timeout,
451
- });
264
+ export const queryAllByName = (container: Container, name: Matcher, options?: MatcherOptions): Gtk.Widget[] =>
265
+ findAll(container, (widget) => matchText(getWidgetName(widget), name, widget, options));
266
+
267
+ const nameQueries = nameQueryFamily(
268
+ "Name",
269
+ queryAllByName,
270
+ buildQueries<[name: Matcher, options?: MatcherOptions]>(
271
+ "Name",
272
+ queryAllByName,
273
+ (container, matches, name) => multipleFoundError(container, { queryType: "name", name }, matches),
274
+ (container, name) => notFoundError(container, { queryType: "name", name }),
275
+ ),
276
+ );
452
277
 
453
278
  /**
454
- * Finds all elements matching visible text content.
455
- *
456
- * @param container - The container to search within
457
- * @param text - Text to match (string, RegExp, or custom matcher)
458
- * @param options - Query options including normalization and timeout
459
- * @returns Promise resolving to array of matching widgets
279
+ * Finds every widget whose placeholder text matches.
280
+ * @param container Widget subtree to search.
281
+ * @param text Matcher for the placeholder text.
282
+ * @param options Text matching options.
283
+ * @returns Every matching widget, or an empty array when none match.
460
284
  */
461
- export const findAllByText = async (
285
+ export const queryAllByPlaceholderText = (
462
286
  container: Container,
463
- text: TextMatch,
464
- options?: TextMatchOptions,
465
- ): Promise<Gtk.Widget[]> =>
466
- waitFor(() => getAllByText(container, text, options), {
467
- timeout: options?.timeout,
468
- });
287
+ text: Matcher,
288
+ options?: MatcherOptions,
289
+ ): Gtk.Widget[] => findAll(container, (widget) => matchText(getWidgetPlaceholderText(widget), text, widget, options));
290
+
291
+ const placeholderTextQueries = nameQueryFamily(
292
+ "PlaceholderText",
293
+ queryAllByPlaceholderText,
294
+ buildQueries<[text: Matcher, options?: MatcherOptions]>(
295
+ "PlaceholderText",
296
+ queryAllByPlaceholderText,
297
+ (container, matches, text) => multipleFoundError(container, { queryType: "placeholderText", text }, matches),
298
+ (container, text) => notFoundError(container, { queryType: "placeholderText", text }),
299
+ ),
300
+ );
469
301
 
470
302
  /**
471
- * Finds a single element by test ID (widget name).
472
- *
473
- * Uses the widget's `name` property as a test identifier.
474
- * Set via the `name` prop on GTKX components.
475
- *
476
- * @param container - The container to search within
477
- * @param testId - Test ID to match (string, RegExp, or custom matcher)
478
- * @param options - Query options including normalization and timeout
479
- * @returns Promise resolving to the matching widget
480
- *
481
- * @example
482
- * ```tsx
483
- * // In component: <GtkButton name="submit-btn" />
484
- * const button = await findByTestId(container, "submit-btn");
485
- * ```
303
+ * Finds every widget whose current display value matches.
304
+ * @param container Widget subtree to search.
305
+ * @param value Matcher for the display value.
306
+ * @param options Text matching options.
307
+ * @returns Every matching widget, or an empty array when none match.
486
308
  */
487
- export const findByTestId = async (
488
- container: Container,
489
- testId: TextMatch,
490
- options?: TextMatchOptions,
491
- ): Promise<Gtk.Widget> =>
492
- waitFor(() => getByTestId(container, testId, options), {
493
- timeout: options?.timeout,
494
- });
309
+ export const queryAllByDisplayValue = (container: Container, value: Matcher, options?: MatcherOptions): Gtk.Widget[] =>
310
+ findAll(container, (widget) => matchText(getWidgetDisplayValue(widget), value, widget, options));
311
+
312
+ const displayValueQueries = nameQueryFamily(
313
+ "DisplayValue",
314
+ queryAllByDisplayValue,
315
+ buildQueries<[value: Matcher, options?: MatcherOptions]>(
316
+ "DisplayValue",
317
+ queryAllByDisplayValue,
318
+ (container, matches, value) => multipleFoundError(container, { queryType: "displayValue", value }, matches),
319
+ (container, value) => notFoundError(container, { queryType: "displayValue", value }),
320
+ ),
321
+ );
322
+
323
+ export type BuiltinQueries = NamedFamily<"Role", [role: Gtk.AccessibleRole, options?: ByRoleOptions]> &
324
+ NamedFamily<"LabelText", [text: Matcher, options?: MatcherOptions]> &
325
+ NamedFamily<"Text", [text: Matcher, options?: MatcherOptions]> &
326
+ NamedFamily<"Name", [name: Matcher, options?: MatcherOptions]> &
327
+ NamedFamily<"PlaceholderText", [text: Matcher, options?: MatcherOptions]> &
328
+ NamedFamily<"DisplayValue", [value: Matcher, options?: MatcherOptions]>;
329
+
330
+ export const builtinQueries: BuiltinQueries = {
331
+ ...roleQueries,
332
+ ...labelTextQueries,
333
+ ...textQueries,
334
+ ...nameQueries,
335
+ ...placeholderTextQueries,
336
+ ...displayValueQueries,
337
+ };
495
338
 
496
- /**
497
- * Finds all elements matching a test ID pattern.
498
- *
499
- * @param container - The container to search within
500
- * @param testId - Test ID to match (string, RegExp, or custom matcher)
501
- * @param options - Query options including normalization and timeout
502
- * @returns Promise resolving to array of matching widgets
503
- */
504
- export const findAllByTestId = async (
505
- container: Container,
506
- testId: TextMatch,
507
- options?: TextMatchOptions,
508
- ): Promise<Gtk.Widget[]> =>
509
- waitFor(() => getAllByTestId(container, testId, options), {
510
- timeout: options?.timeout,
511
- });
339
+ /** Returns the single widget with a matching accessible role and options, or null when none match. Throws when more than one matches. */
340
+ export const queryByRole: BuiltinQueries["queryByRole"] = roleQueries.queryByRole;
341
+ /** Returns every widget with a matching accessible role and options. Throws when none match. */
342
+ export const getAllByRole: BuiltinQueries["getAllByRole"] = roleQueries.getAllByRole;
343
+ /** Returns the single widget with a matching accessible role and options. Throws when none or more than one matches. */
344
+ export const getByRole: BuiltinQueries["getByRole"] = roleQueries.getByRole;
345
+ /** Waits for and returns every widget with a matching accessible role and options, retrying until at least one appears or the timeout elapses. */
346
+ export const findAllByRole: BuiltinQueries["findAllByRole"] = roleQueries.findAllByRole;
347
+ /** Waits for and returns the single widget with a matching accessible role and options, retrying until it appears or the timeout elapses. Rejects when none or more than one matches. */
348
+ export const findByRole: BuiltinQueries["findByRole"] = roleQueries.findByRole;
349
+
350
+ /** Returns the single widget with matching associated label text, or null when none match. Throws when more than one matches. */
351
+ export const queryByLabelText: BuiltinQueries["queryByLabelText"] = labelTextQueries.queryByLabelText;
352
+ /** Returns every widget with matching associated label text. Throws when none match. */
353
+ export const getAllByLabelText: BuiltinQueries["getAllByLabelText"] = labelTextQueries.getAllByLabelText;
354
+ /** Returns the single widget with matching associated label text. Throws when none or more than one matches. */
355
+ export const getByLabelText: BuiltinQueries["getByLabelText"] = labelTextQueries.getByLabelText;
356
+ /** Waits for and returns every widget with matching associated label text, retrying until at least one appears or the timeout elapses. */
357
+ export const findAllByLabelText: BuiltinQueries["findAllByLabelText"] = labelTextQueries.findAllByLabelText;
358
+ /** Waits for and returns the single widget with matching associated label text, retrying until it appears or the timeout elapses. Rejects when none or more than one matches. */
359
+ export const findByLabelText: BuiltinQueries["findByLabelText"] = labelTextQueries.findByLabelText;
360
+
361
+ /** Returns the single widget with matching rendered text content, or null when none match. Throws when more than one matches. */
362
+ export const queryByText: BuiltinQueries["queryByText"] = textQueries.queryByText;
363
+ /** Returns every widget with matching rendered text content. Throws when none match. */
364
+ export const getAllByText: BuiltinQueries["getAllByText"] = textQueries.getAllByText;
365
+ /** Returns the single widget with matching rendered text content. Throws when none or more than one matches. */
366
+ export const getByText: BuiltinQueries["getByText"] = textQueries.getByText;
367
+ /** Waits for and returns every widget with matching rendered text content, retrying until at least one appears or the timeout elapses. */
368
+ export const findAllByText: BuiltinQueries["findAllByText"] = textQueries.findAllByText;
369
+ /** Waits for and returns the single widget with matching rendered text content, retrying until it appears or the timeout elapses. Rejects when none or more than one matches. */
370
+ export const findByText: BuiltinQueries["findByText"] = textQueries.findByText;
371
+
372
+ /** Returns the single widget with a matching widget name, or null when none match. Throws when more than one matches. */
373
+ export const queryByName: BuiltinQueries["queryByName"] = nameQueries.queryByName;
374
+ /** Returns every widget with a matching widget name. Throws when none match. */
375
+ export const getAllByName: BuiltinQueries["getAllByName"] = nameQueries.getAllByName;
376
+ /** Returns the single widget with a matching widget name. Throws when none or more than one matches. */
377
+ export const getByName: BuiltinQueries["getByName"] = nameQueries.getByName;
378
+ /** Waits for and returns every widget with a matching widget name, retrying until at least one appears or the timeout elapses. */
379
+ export const findAllByName: BuiltinQueries["findAllByName"] = nameQueries.findAllByName;
380
+ /** Waits for and returns the single widget with a matching widget name, retrying until it appears or the timeout elapses. Rejects when none or more than one matches. */
381
+ export const findByName: BuiltinQueries["findByName"] = nameQueries.findByName;
382
+
383
+ /** Returns the single widget with matching placeholder text, or null when none match. Throws when more than one matches. */
384
+ export const queryByPlaceholderText: BuiltinQueries["queryByPlaceholderText"] =
385
+ placeholderTextQueries.queryByPlaceholderText;
386
+ /** Returns every widget with matching placeholder text. Throws when none match. */
387
+ export const getAllByPlaceholderText: BuiltinQueries["getAllByPlaceholderText"] =
388
+ placeholderTextQueries.getAllByPlaceholderText;
389
+ /** Returns the single widget with matching placeholder text. Throws when none or more than one matches. */
390
+ export const getByPlaceholderText: BuiltinQueries["getByPlaceholderText"] = placeholderTextQueries.getByPlaceholderText;
391
+ /** Waits for and returns every widget with matching placeholder text, retrying until at least one appears or the timeout elapses. */
392
+ export const findAllByPlaceholderText: BuiltinQueries["findAllByPlaceholderText"] =
393
+ placeholderTextQueries.findAllByPlaceholderText;
394
+ /** Waits for and returns the single widget with matching placeholder text, retrying until it appears or the timeout elapses. Rejects when none or more than one matches. */
395
+ export const findByPlaceholderText: BuiltinQueries["findByPlaceholderText"] =
396
+ placeholderTextQueries.findByPlaceholderText;
397
+
398
+ /** Returns the single widget with a matching display value, or null when none match. Throws when more than one matches. */
399
+ export const queryByDisplayValue: BuiltinQueries["queryByDisplayValue"] = displayValueQueries.queryByDisplayValue;
400
+ /** Returns every widget with a matching display value. Throws when none match. */
401
+ export const getAllByDisplayValue: BuiltinQueries["getAllByDisplayValue"] = displayValueQueries.getAllByDisplayValue;
402
+ /** Returns the single widget with a matching display value. Throws when none or more than one matches. */
403
+ export const getByDisplayValue: BuiltinQueries["getByDisplayValue"] = displayValueQueries.getByDisplayValue;
404
+ /** Waits for and returns every widget with a matching display value, retrying until at least one appears or the timeout elapses. */
405
+ export const findAllByDisplayValue: BuiltinQueries["findAllByDisplayValue"] = displayValueQueries.findAllByDisplayValue;
406
+ /** Waits for and returns the single widget with a matching display value, retrying until it appears or the timeout elapses. Rejects when none or more than one matches. */
407
+ export const findByDisplayValue: BuiltinQueries["findByDisplayValue"] = displayValueQueries.findByDisplayValue;