@gtkx/testing 1.0.0-rc.1 → 1.0.0-rc.2
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.
- package/dist/act.d.ts +6 -6
- package/dist/act.d.ts.map +1 -1
- package/dist/act.js +34 -26
- package/dist/act.js.map +1 -1
- package/dist/bound-queries.d.ts +4 -3
- package/dist/bound-queries.d.ts.map +1 -1
- package/dist/bound-queries.js.map +1 -1
- package/dist/build-queries.d.ts +5 -5
- package/dist/build-queries.d.ts.map +1 -1
- package/dist/build-queries.js +21 -9
- package/dist/build-queries.js.map +1 -1
- package/dist/cleanup-registry.d.ts +4 -3
- package/dist/cleanup-registry.d.ts.map +1 -1
- package/dist/cleanup-registry.js +13 -3
- package/dist/cleanup-registry.js.map +1 -1
- package/dist/config.d.ts +5 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +11 -9
- package/dist/config.js.map +1 -1
- package/dist/editable.d.ts +6 -5
- package/dist/editable.d.ts.map +1 -1
- package/dist/editable.js +7 -5
- package/dist/editable.js.map +1 -1
- package/dist/errors.d.ts +7 -6
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +64 -48
- package/dist/errors.js.map +1 -1
- package/dist/fire-event.d.ts +2 -1
- package/dist/fire-event.d.ts.map +1 -1
- package/dist/fire-event.js +2 -1
- package/dist/fire-event.js.map +1 -1
- package/dist/frame-sync.d.ts +2 -1
- package/dist/frame-sync.d.ts.map +1 -1
- package/dist/frame-sync.js +28 -21
- package/dist/frame-sync.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/matchers.d.ts +38 -34
- package/dist/matchers.d.ts.map +1 -1
- package/dist/matchers.js +72 -58
- package/dist/matchers.js.map +1 -1
- package/dist/pretty-widget.d.ts +6 -4
- package/dist/pretty-widget.d.ts.map +1 -1
- package/dist/pretty-widget.js +64 -24
- package/dist/pretty-widget.js.map +1 -1
- package/dist/queries.d.ts +143 -86
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +231 -147
- package/dist/queries.js.map +1 -1
- package/dist/register-test-hooks.js +2 -1
- package/dist/register-test-hooks.js.map +1 -1
- package/dist/render-hook.d.ts +3 -2
- package/dist/render-hook.d.ts.map +1 -1
- package/dist/render-hook.js +2 -1
- package/dist/render-hook.js.map +1 -1
- package/dist/render.d.ts +3 -2
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +24 -18
- package/dist/render.js.map +1 -1
- package/dist/role-helpers.d.ts +6 -5
- package/dist/role-helpers.d.ts.map +1 -1
- package/dist/role-helpers.js +16 -12
- package/dist/role-helpers.js.map +1 -1
- package/dist/screen.d.ts +4 -3
- package/dist/screen.d.ts.map +1 -1
- package/dist/screen.js +13 -11
- package/dist/screen.js.map +1 -1
- package/dist/screenshot.d.ts +4 -3
- package/dist/screenshot.d.ts.map +1 -1
- package/dist/screenshot.js +43 -36
- package/dist/screenshot.js.map +1 -1
- package/dist/suggestions.d.ts +11 -6
- package/dist/suggestions.d.ts.map +1 -1
- package/dist/suggestions.js +10 -5
- package/dist/suggestions.js.map +1 -1
- package/dist/traversal.d.ts +7 -7
- package/dist/traversal.d.ts.map +1 -1
- package/dist/traversal.js +17 -11
- package/dist/traversal.js.map +1 -1
- package/dist/types.d.ts +39 -24
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/user-event/adjustment.d.ts +5 -3
- package/dist/user-event/adjustment.d.ts.map +1 -1
- package/dist/user-event/adjustment.js +6 -4
- package/dist/user-event/adjustment.js.map +1 -1
- package/dist/user-event/click.d.ts +6 -5
- package/dist/user-event/click.d.ts.map +1 -1
- package/dist/user-event/click.js +29 -21
- package/dist/user-event/click.js.map +1 -1
- package/dist/user-event/controller.d.ts +6 -5
- package/dist/user-event/controller.d.ts.map +1 -1
- package/dist/user-event/controller.js +9 -6
- package/dist/user-event/controller.js.map +1 -1
- package/dist/user-event/dispatch.d.ts +3 -3
- package/dist/user-event/dispatch.d.ts.map +1 -1
- package/dist/user-event/dispatch.js +3 -2
- package/dist/user-event/dispatch.js.map +1 -1
- package/dist/user-event/event-wrapper.d.ts +2 -1
- package/dist/user-event/event-wrapper.d.ts.map +1 -1
- package/dist/user-event/event-wrapper.js +27 -16
- package/dist/user-event/event-wrapper.js.map +1 -1
- package/dist/user-event/gesture.d.ts +18 -14
- package/dist/user-event/gesture.d.ts.map +1 -1
- package/dist/user-event/gesture.js +70 -37
- package/dist/user-event/gesture.js.map +1 -1
- package/dist/user-event/index.d.ts +17 -10
- package/dist/user-event/index.d.ts.map +1 -1
- package/dist/user-event/index.js +7 -3
- package/dist/user-event/index.js.map +1 -1
- package/dist/user-event/keyboard.d.ts +4 -3
- package/dist/user-event/keyboard.d.ts.map +1 -1
- package/dist/user-event/keyboard.js +89 -58
- package/dist/user-event/keyboard.js.map +1 -1
- package/dist/user-event/pointer.d.ts +7 -3
- package/dist/user-event/pointer.d.ts.map +1 -1
- package/dist/user-event/pointer.js +4 -1
- package/dist/user-event/pointer.js.map +1 -1
- package/dist/user-event/selection.d.ts +3 -2
- package/dist/user-event/selection.d.ts.map +1 -1
- package/dist/user-event/selection.js +26 -27
- package/dist/user-event/selection.js.map +1 -1
- package/dist/user-event/state.d.ts +3 -2
- package/dist/user-event/state.d.ts.map +1 -1
- package/dist/user-event/state.js +2 -1
- package/dist/user-event/state.js.map +1 -1
- package/dist/user-event/text.d.ts +8 -7
- package/dist/user-event/text.d.ts.map +1 -1
- package/dist/user-event/text.js +39 -33
- package/dist/user-event/text.js.map +1 -1
- package/dist/wait-for.d.ts +5 -5
- package/dist/wait-for.d.ts.map +1 -1
- package/dist/wait-for.js +45 -30
- package/dist/wait-for.js.map +1 -1
- package/dist/widget-accessible-properties.d.ts +26 -25
- package/dist/widget-accessible-properties.d.ts.map +1 -1
- package/dist/widget-accessible-properties.js +106 -61
- package/dist/widget-accessible-properties.js.map +1 -1
- package/dist/within.d.ts +2 -1
- package/dist/within.d.ts.map +1 -1
- package/dist/within.js +2 -1
- package/dist/within.js.map +1 -1
- package/package.json +11 -9
- package/src/act.ts +44 -35
- package/src/bound-queries.ts +5 -4
- package/src/build-queries.ts +84 -43
- package/src/cleanup-registry.ts +18 -5
- package/src/config.ts +16 -12
- package/src/editable.ts +13 -6
- package/src/errors.ts +106 -45
- package/src/fire-event.ts +3 -1
- package/src/frame-sync.ts +38 -21
- package/src/index.ts +2 -1
- package/src/matchers.ts +158 -107
- package/src/pretty-widget.ts +114 -42
- package/src/queries.ts +422 -233
- package/src/register-test-hooks.ts +4 -1
- package/src/render-hook.tsx +10 -4
- package/src/render.tsx +58 -33
- package/src/role-helpers.ts +29 -16
- package/src/screen.ts +17 -12
- package/src/screenshot.ts +61 -38
- package/src/suggestions.ts +29 -10
- package/src/traversal.ts +35 -15
- package/src/types.ts +65 -32
- package/src/user-event/adjustment.ts +23 -10
- package/src/user-event/click.ts +49 -20
- package/src/user-event/controller.ts +21 -7
- package/src/user-event/dispatch.ts +4 -2
- package/src/user-event/event-wrapper.ts +42 -16
- package/src/user-event/gesture.ts +135 -50
- package/src/user-event/index.ts +19 -12
- package/src/user-event/keyboard.ts +147 -61
- package/src/user-event/pointer.ts +20 -8
- package/src/user-event/selection.ts +69 -32
- package/src/user-event/state.ts +4 -2
- package/src/user-event/text.ts +73 -38
- package/src/wait-for.ts +77 -36
- package/src/widget-accessible-properties.ts +218 -74
- package/src/within.ts +7 -4
package/src/queries.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Gtk from "@gtkx/gi/gtk";
|
|
2
|
-
import {
|
|
2
|
+
import type { ByRoleOptions, ByRoleValue, Matcher, MatcherOptions, NormalizerFn, NormalizerOptions } from "./types.js";
|
|
3
|
+
import { buildQueries, type BuiltQueries, type QueryAllBy } from "./build-queries.js";
|
|
3
4
|
import { multipleFoundError, notFoundError } from "./errors.js";
|
|
4
5
|
import { type Container, findAll, traverse } from "./traversal.js";
|
|
5
|
-
import type { ByRoleOptions, ByRoleValue, Matcher, MatcherOptions, NormalizerFn, NormalizerOptions } from "./types.js";
|
|
6
6
|
import {
|
|
7
7
|
getWidgetAccessibleName,
|
|
8
8
|
getWidgetBusyState,
|
|
@@ -22,17 +22,246 @@ import {
|
|
|
22
22
|
isInaccessible,
|
|
23
23
|
} from "./widget-accessible-properties.js";
|
|
24
24
|
|
|
25
|
+
type QueryFamilyReturns = {
|
|
26
|
+
queryBy: Gtk.Widget | null;
|
|
27
|
+
queryAllBy: Gtk.Widget[];
|
|
28
|
+
getBy: Gtk.Widget;
|
|
29
|
+
getAllBy: Gtk.Widget[];
|
|
30
|
+
findBy: Promise<Gtk.Widget>;
|
|
31
|
+
findAllBy: Promise<Gtk.Widget[]>;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type NamedFamily<Suffix extends string, Args extends unknown[]> = {
|
|
35
|
+
[K in keyof QueryFamilyReturns as `${K & string}${Suffix}`]: (
|
|
36
|
+
container: Container,
|
|
37
|
+
...args: Args
|
|
38
|
+
) => QueryFamilyReturns[K];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
type BuiltinQueries = NamedFamily<"Role", [role: Gtk.AccessibleRole, options?: ByRoleOptions]> &
|
|
42
|
+
NamedFamily<"LabelText", [text: Matcher, options?: MatcherOptions]> &
|
|
43
|
+
NamedFamily<"Text", [text: Matcher, options?: MatcherOptions]> &
|
|
44
|
+
NamedFamily<"Name", [name: Matcher, options?: MatcherOptions]> &
|
|
45
|
+
NamedFamily<"PlaceholderText", [text: Matcher, options?: MatcherOptions]> &
|
|
46
|
+
NamedFamily<"DisplayValue", [value: Matcher, options?: MatcherOptions]>;
|
|
47
|
+
|
|
48
|
+
const roleQueries = nameQueryFamily(
|
|
49
|
+
"Role",
|
|
50
|
+
queryAllByRole,
|
|
51
|
+
buildQueries<[role: Gtk.AccessibleRole, options?: ByRoleOptions]>(
|
|
52
|
+
"Role",
|
|
53
|
+
queryAllByRole,
|
|
54
|
+
(container, matches, role, options) =>
|
|
55
|
+
multipleFoundError(container, { queryType: "role", role, options }, matches),
|
|
56
|
+
(container, role, options) => notFoundError(container, { queryType: "role", role, options }),
|
|
57
|
+
),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const labelTextQueries = nameQueryFamily(
|
|
61
|
+
"LabelText",
|
|
62
|
+
queryAllByLabelText,
|
|
63
|
+
buildQueries<[text: Matcher, options?: MatcherOptions]>(
|
|
64
|
+
"LabelText",
|
|
65
|
+
queryAllByLabelText,
|
|
66
|
+
(container, matches, text) => multipleFoundError(container, { queryType: "labelText", text }, matches),
|
|
67
|
+
(container, text) => notFoundError(container, { queryType: "labelText", text }),
|
|
68
|
+
),
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const textQueries = nameQueryFamily(
|
|
72
|
+
"Text",
|
|
73
|
+
queryAllByText,
|
|
74
|
+
buildQueries<[text: Matcher, options?: MatcherOptions]>(
|
|
75
|
+
"Text",
|
|
76
|
+
queryAllByText,
|
|
77
|
+
(container, matches, text) => multipleFoundError(container, { queryType: "text", text }, matches),
|
|
78
|
+
(container, text) => notFoundError(container, { queryType: "text", text }),
|
|
79
|
+
),
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const nameQueries = nameQueryFamily(
|
|
83
|
+
"Name",
|
|
84
|
+
queryAllByName,
|
|
85
|
+
buildQueries<[name: Matcher, options?: MatcherOptions]>(
|
|
86
|
+
"Name",
|
|
87
|
+
queryAllByName,
|
|
88
|
+
(container, matches, name) => multipleFoundError(container, { queryType: "name", name }, matches),
|
|
89
|
+
(container, name) => notFoundError(container, { queryType: "name", name }),
|
|
90
|
+
),
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const placeholderTextQueries = nameQueryFamily(
|
|
94
|
+
"PlaceholderText",
|
|
95
|
+
queryAllByPlaceholderText,
|
|
96
|
+
buildQueries<[text: Matcher, options?: MatcherOptions]>(
|
|
97
|
+
"PlaceholderText",
|
|
98
|
+
queryAllByPlaceholderText,
|
|
99
|
+
(container, matches, text) => multipleFoundError(container, { queryType: "placeholderText", text }, matches),
|
|
100
|
+
(container, text) => notFoundError(container, { queryType: "placeholderText", text }),
|
|
101
|
+
),
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const displayValueQueries = nameQueryFamily(
|
|
105
|
+
"DisplayValue",
|
|
106
|
+
queryAllByDisplayValue,
|
|
107
|
+
buildQueries<[value: Matcher, options?: MatcherOptions]>(
|
|
108
|
+
"DisplayValue",
|
|
109
|
+
queryAllByDisplayValue,
|
|
110
|
+
(container, matches, value) => multipleFoundError(container, { queryType: "displayValue", value }, matches),
|
|
111
|
+
(container, value) => notFoundError(container, { queryType: "displayValue", value }),
|
|
112
|
+
),
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const builtinQueries: BuiltinQueries = {
|
|
116
|
+
...roleQueries,
|
|
117
|
+
...labelTextQueries,
|
|
118
|
+
...textQueries,
|
|
119
|
+
...nameQueries,
|
|
120
|
+
...placeholderTextQueries,
|
|
121
|
+
...displayValueQueries,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Returns the single widget with a matching accessible role and options, or null when none match.
|
|
126
|
+
* Throws when more than one matches.
|
|
127
|
+
*/
|
|
128
|
+
const queryByRole: BuiltinQueries["queryByRole"] = roleQueries.queryByRole;
|
|
129
|
+
/** Returns every widget with a matching accessible role and options. Throws when none match. */
|
|
130
|
+
const getAllByRole: BuiltinQueries["getAllByRole"] = roleQueries.getAllByRole;
|
|
131
|
+
/**
|
|
132
|
+
* Returns the single widget with a matching accessible role and options.
|
|
133
|
+
* Throws when none or more than one matches.
|
|
134
|
+
*/
|
|
135
|
+
const getByRole: BuiltinQueries["getByRole"] = roleQueries.getByRole;
|
|
136
|
+
/**
|
|
137
|
+
* Waits for and returns every widget with a matching accessible role and options, retrying until at
|
|
138
|
+
* least one appears or the timeout elapses.
|
|
139
|
+
*/
|
|
140
|
+
const findAllByRole: BuiltinQueries["findAllByRole"] = roleQueries.findAllByRole;
|
|
141
|
+
/**
|
|
142
|
+
* Waits for and returns the single widget with a matching accessible role and options, retrying
|
|
143
|
+
* until it appears or the timeout elapses. Rejects when none or more than one matches.
|
|
144
|
+
*/
|
|
145
|
+
const findByRole: BuiltinQueries["findByRole"] = roleQueries.findByRole;
|
|
25
146
|
/**
|
|
26
|
-
*
|
|
147
|
+
* Returns the single widget with matching associated label text, or null when none match.
|
|
148
|
+
* Throws when more than one matches.
|
|
149
|
+
*/
|
|
150
|
+
const queryByLabelText: BuiltinQueries["queryByLabelText"] = labelTextQueries.queryByLabelText;
|
|
151
|
+
/** Returns every widget with matching associated label text. Throws when none match. */
|
|
152
|
+
const getAllByLabelText: BuiltinQueries["getAllByLabelText"] = labelTextQueries.getAllByLabelText;
|
|
153
|
+
/** Returns the single widget with matching associated label text. Throws when none or more than one matches. */
|
|
154
|
+
const getByLabelText: BuiltinQueries["getByLabelText"] = labelTextQueries.getByLabelText;
|
|
155
|
+
/**
|
|
156
|
+
* Waits for and returns every widget with matching associated label text, retrying until at least
|
|
157
|
+
* one appears or the timeout elapses.
|
|
158
|
+
*/
|
|
159
|
+
const findAllByLabelText: BuiltinQueries["findAllByLabelText"] = labelTextQueries.findAllByLabelText;
|
|
160
|
+
/**
|
|
161
|
+
* Waits for and returns the single widget with matching associated label text, retrying until it
|
|
162
|
+
* appears or the timeout elapses. Rejects when none or more than one matches.
|
|
163
|
+
*/
|
|
164
|
+
const findByLabelText: BuiltinQueries["findByLabelText"] = labelTextQueries.findByLabelText;
|
|
165
|
+
/**
|
|
166
|
+
* Returns the single widget with matching rendered text content, or null when none match.
|
|
167
|
+
* Throws when more than one matches.
|
|
168
|
+
*/
|
|
169
|
+
const queryByText: BuiltinQueries["queryByText"] = textQueries.queryByText;
|
|
170
|
+
/** Returns every widget with matching rendered text content. Throws when none match. */
|
|
171
|
+
const getAllByText: BuiltinQueries["getAllByText"] = textQueries.getAllByText;
|
|
172
|
+
/** Returns the single widget with matching rendered text content. Throws when none or more than one matches. */
|
|
173
|
+
const getByText: BuiltinQueries["getByText"] = textQueries.getByText;
|
|
174
|
+
/**
|
|
175
|
+
* Waits for and returns every widget with matching rendered text content, retrying until at least
|
|
176
|
+
* one appears or the timeout elapses.
|
|
177
|
+
*/
|
|
178
|
+
const findAllByText: BuiltinQueries["findAllByText"] = textQueries.findAllByText;
|
|
179
|
+
/**
|
|
180
|
+
* Waits for and returns the single widget with matching rendered text content, retrying until it
|
|
181
|
+
* appears or the timeout elapses. Rejects when none or more than one matches.
|
|
182
|
+
*/
|
|
183
|
+
const findByText: BuiltinQueries["findByText"] = textQueries.findByText;
|
|
184
|
+
/**
|
|
185
|
+
* Returns the single widget with a matching widget name, or null when none match.
|
|
186
|
+
* Throws when more than one matches.
|
|
187
|
+
*/
|
|
188
|
+
const queryByName: BuiltinQueries["queryByName"] = nameQueries.queryByName;
|
|
189
|
+
/** Returns every widget with a matching widget name. Throws when none match. */
|
|
190
|
+
const getAllByName: BuiltinQueries["getAllByName"] = nameQueries.getAllByName;
|
|
191
|
+
/** Returns the single widget with a matching widget name. Throws when none or more than one matches. */
|
|
192
|
+
const getByName: BuiltinQueries["getByName"] = nameQueries.getByName;
|
|
193
|
+
/**
|
|
194
|
+
* Waits for and returns every widget with a matching widget name, retrying until at least one
|
|
195
|
+
* appears or the timeout elapses.
|
|
196
|
+
*/
|
|
197
|
+
const findAllByName: BuiltinQueries["findAllByName"] = nameQueries.findAllByName;
|
|
198
|
+
/**
|
|
199
|
+
* Waits for and returns the single widget with a matching widget name, retrying until it appears or
|
|
200
|
+
* the timeout elapses. Rejects when none or more than one matches.
|
|
201
|
+
*/
|
|
202
|
+
const findByName: BuiltinQueries["findByName"] = nameQueries.findByName;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Returns the single widget with matching placeholder text, or null when none match.
|
|
206
|
+
* Throws when more than one matches.
|
|
207
|
+
*/
|
|
208
|
+
const queryByPlaceholderText: BuiltinQueries["queryByPlaceholderText"] =
|
|
209
|
+
placeholderTextQueries.queryByPlaceholderText;
|
|
210
|
+
|
|
211
|
+
/** Returns every widget with matching placeholder text. Throws when none match. */
|
|
212
|
+
const getAllByPlaceholderText: BuiltinQueries["getAllByPlaceholderText"] =
|
|
213
|
+
placeholderTextQueries.getAllByPlaceholderText;
|
|
214
|
+
|
|
215
|
+
/** Returns the single widget with matching placeholder text. Throws when none or more than one matches. */
|
|
216
|
+
const getByPlaceholderText: BuiltinQueries["getByPlaceholderText"] = placeholderTextQueries.getByPlaceholderText;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Waits for and returns every widget with matching placeholder text, retrying until at least one
|
|
220
|
+
* appears or the timeout elapses.
|
|
221
|
+
*/
|
|
222
|
+
const findAllByPlaceholderText: BuiltinQueries["findAllByPlaceholderText"] =
|
|
223
|
+
placeholderTextQueries.findAllByPlaceholderText;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Waits for and returns the single widget with matching placeholder text, retrying until it appears
|
|
227
|
+
* or the timeout elapses. Rejects when none or more than one matches.
|
|
228
|
+
*/
|
|
229
|
+
const findByPlaceholderText: BuiltinQueries["findByPlaceholderText"] =
|
|
230
|
+
placeholderTextQueries.findByPlaceholderText;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Returns the single widget with a matching display value, or null when none match.
|
|
234
|
+
* Throws when more than one matches.
|
|
235
|
+
*/
|
|
236
|
+
const queryByDisplayValue: BuiltinQueries["queryByDisplayValue"] = displayValueQueries.queryByDisplayValue;
|
|
237
|
+
/** Returns every widget with a matching display value. Throws when none match. */
|
|
238
|
+
const getAllByDisplayValue: BuiltinQueries["getAllByDisplayValue"] = displayValueQueries.getAllByDisplayValue;
|
|
239
|
+
/** Returns the single widget with a matching display value. Throws when none or more than one matches. */
|
|
240
|
+
const getByDisplayValue: BuiltinQueries["getByDisplayValue"] = displayValueQueries.getByDisplayValue;
|
|
241
|
+
/**
|
|
242
|
+
* Waits for and returns every widget with a matching display value, retrying until at least one
|
|
243
|
+
* appears or the timeout elapses.
|
|
244
|
+
*/
|
|
245
|
+
const findAllByDisplayValue: BuiltinQueries["findAllByDisplayValue"] = displayValueQueries.findAllByDisplayValue;
|
|
246
|
+
/**
|
|
247
|
+
* Waits for and returns the single widget with a matching display value, retrying until it appears
|
|
248
|
+
* or the timeout elapses. Rejects when none or more than one matches.
|
|
249
|
+
*/
|
|
250
|
+
const findByDisplayValue: BuiltinQueries["findByDisplayValue"] = displayValueQueries.findByDisplayValue;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Builds the default text normalizer, which optionally trims surrounding whitespace and collapses
|
|
254
|
+
* runs of whitespace into single spaces.
|
|
27
255
|
* @param options Toggles for trimming and whitespace collapsing.
|
|
28
256
|
* @returns A function that normalizes a string for comparison against a matcher.
|
|
29
257
|
*/
|
|
30
|
-
|
|
258
|
+
const getDefaultNormalizer = ({
|
|
31
259
|
trim = true,
|
|
32
260
|
collapseWhitespace = true,
|
|
33
261
|
}: NormalizerOptions = {}): NormalizerFn => {
|
|
34
262
|
return (text: string): string => {
|
|
35
263
|
let result = text;
|
|
264
|
+
|
|
36
265
|
if (trim) {
|
|
37
266
|
result = result.trim();
|
|
38
267
|
}
|
|
@@ -55,8 +284,8 @@ const buildNormalizer = (options?: MatcherOptions): NormalizerFn => {
|
|
|
55
284
|
if (trim !== undefined || collapseWhitespace !== undefined) {
|
|
56
285
|
throw new Error(
|
|
57
286
|
"trim and collapseWhitespace are not supported with a normalizer. " +
|
|
58
|
-
|
|
59
|
-
|
|
287
|
+
"If you want to use the default trim and collapseWhitespace logic in your normalizer, " +
|
|
288
|
+
"use \"getDefaultNormalizer({ trim, collapseWhitespace })\" and compose that into your normalizer",
|
|
60
289
|
);
|
|
61
290
|
}
|
|
62
291
|
|
|
@@ -65,11 +294,19 @@ const buildNormalizer = (options?: MatcherOptions): NormalizerFn => {
|
|
|
65
294
|
|
|
66
295
|
const normalizeText = (text: string, options?: MatcherOptions): string => {
|
|
67
296
|
const normalizer = buildNormalizer(options);
|
|
297
|
+
|
|
68
298
|
return normalizer(text);
|
|
69
299
|
};
|
|
70
300
|
|
|
71
|
-
const
|
|
72
|
-
|
|
301
|
+
const isTextMatch = (
|
|
302
|
+
actual: string | null,
|
|
303
|
+
expected: Matcher,
|
|
304
|
+
widget: Gtk.Widget,
|
|
305
|
+
options?: MatcherOptions,
|
|
306
|
+
): boolean => {
|
|
307
|
+
if (actual === null) {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
73
310
|
|
|
74
311
|
const normalizedActual = normalizeText(actual, options);
|
|
75
312
|
|
|
@@ -79,76 +316,96 @@ const matchText = (actual: string | null, expected: Matcher, widget: Gtk.Widget,
|
|
|
79
316
|
|
|
80
317
|
if (expected instanceof RegExp) {
|
|
81
318
|
expected.lastIndex = 0;
|
|
319
|
+
|
|
82
320
|
return expected.test(normalizedActual);
|
|
83
321
|
}
|
|
84
322
|
|
|
85
323
|
const normalizedExpected = normalizeText(String(expected), options);
|
|
86
|
-
const
|
|
87
|
-
|
|
324
|
+
const isExact = options?.exact ?? true;
|
|
325
|
+
|
|
326
|
+
return isExact
|
|
88
327
|
? normalizedActual === normalizedExpected
|
|
89
328
|
: normalizedActual.toLowerCase().includes(normalizedExpected.toLowerCase());
|
|
90
329
|
};
|
|
91
330
|
|
|
92
|
-
const
|
|
93
|
-
if (options.name === undefined)
|
|
331
|
+
const hasMatchingAccessibleName = (widget: Gtk.Widget, options: ByRoleOptions): boolean => {
|
|
332
|
+
if (options.name === undefined) {
|
|
333
|
+
return true;
|
|
334
|
+
}
|
|
335
|
+
|
|
94
336
|
const text = getWidgetAccessibleName(widget);
|
|
95
|
-
|
|
337
|
+
|
|
338
|
+
return isTextMatch(text, options.name, widget, options);
|
|
96
339
|
};
|
|
97
340
|
|
|
98
|
-
const
|
|
341
|
+
const isNumericValueMatch = (expected: number | undefined, actual: number | null): boolean =>
|
|
342
|
+
expected === undefined || actual === expected;
|
|
343
|
+
|
|
344
|
+
const hasMatchingAccessibleValue = (widget: Gtk.Widget, value: ByRoleValue, options: ByRoleOptions): boolean => {
|
|
99
345
|
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;
|
|
105
|
-
};
|
|
106
346
|
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
347
|
+
const numericChecks: [number | undefined, number | null][] = [
|
|
348
|
+
[value.now, actual.now],
|
|
349
|
+
[value.min, actual.min],
|
|
350
|
+
[value.max, actual.max],
|
|
351
|
+
];
|
|
352
|
+
|
|
353
|
+
for (const [expected, current] of numericChecks) {
|
|
354
|
+
if (!isNumericValueMatch(expected, current)) {
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
return value.text === undefined || isTextMatch(actual.text, value.text, widget, options);
|
|
114
360
|
};
|
|
115
361
|
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
options.
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
362
|
+
const hasMatchingBooleanStates = (widget: Gtk.Widget, options: ByRoleOptions): boolean => {
|
|
363
|
+
const stateChecks: [boolean | undefined, () => boolean | null][] = [
|
|
364
|
+
[options.checked, () => getWidgetCheckedState(widget)],
|
|
365
|
+
[options.pressed, () => getWidgetPressedState(widget)],
|
|
366
|
+
[options.expanded, () => getWidgetExpandedState(widget)],
|
|
367
|
+
[options.selected, () => getWidgetSelectedState(widget)],
|
|
368
|
+
[options.busy, () => getWidgetBusyState(widget) ?? false],
|
|
369
|
+
];
|
|
370
|
+
|
|
371
|
+
for (const [expected, getActual] of stateChecks) {
|
|
372
|
+
if (expected !== undefined && getActual() !== expected) {
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
125
377
|
return true;
|
|
126
378
|
};
|
|
127
379
|
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
return matchAccessibleName(widget, options) && matchAccessibleStates(widget, options);
|
|
131
|
-
};
|
|
380
|
+
const hasMatchingLevelState = (widget: Gtk.Widget, options: ByRoleOptions): boolean =>
|
|
381
|
+
options.level === undefined || getWidgetLevel(widget) === options.level;
|
|
132
382
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
383
|
+
const hasMatchingDescriptionState = (widget: Gtk.Widget, options: ByRoleOptions): boolean =>
|
|
384
|
+
options.description === undefined ||
|
|
385
|
+
isTextMatch(getWidgetDescription(widget), options.description, widget, options);
|
|
386
|
+
|
|
387
|
+
const hasMatchingValueState = (widget: Gtk.Widget, options: ByRoleOptions): boolean =>
|
|
388
|
+
options.value === undefined || hasMatchingAccessibleValue(widget, options.value, options);
|
|
389
|
+
|
|
390
|
+
const hasMatchingAccessibleStates = (widget: Gtk.Widget, options: ByRoleOptions): boolean =>
|
|
391
|
+
hasMatchingBooleanStates(widget, options) &&
|
|
392
|
+
hasMatchingLevelState(widget, options) &&
|
|
393
|
+
hasMatchingDescriptionState(widget, options) &&
|
|
394
|
+
hasMatchingValueState(widget, options);
|
|
395
|
+
|
|
396
|
+
const hasMatchingByRoleOptions = (widget: Gtk.Widget, options?: ByRoleOptions): boolean => {
|
|
397
|
+
if (!options) {
|
|
398
|
+
return true;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return hasMatchingAccessibleName(widget, options) && hasMatchingAccessibleStates(widget, options);
|
|
145
402
|
};
|
|
146
403
|
|
|
147
|
-
|
|
404
|
+
function nameQueryFamily<Suffix extends string, Args extends unknown[]>(
|
|
148
405
|
suffix: Suffix,
|
|
149
406
|
queryAllBy: QueryAllBy<Args>,
|
|
150
407
|
built: BuiltQueries<Args>,
|
|
151
|
-
): NamedFamily<Suffix, Args>
|
|
408
|
+
): NamedFamily<Suffix, Args> {
|
|
152
409
|
const family = {
|
|
153
410
|
[`queryBy${suffix}`]: built.queryBy,
|
|
154
411
|
[`queryAllBy${suffix}`]: queryAllBy,
|
|
@@ -157,8 +414,9 @@ const nameQueryFamily = <Suffix extends string, Args extends unknown[]>(
|
|
|
157
414
|
[`findBy${suffix}`]: built.findBy,
|
|
158
415
|
[`findAllBy${suffix}`]: built.findAllBy,
|
|
159
416
|
};
|
|
417
|
+
|
|
160
418
|
return family as NamedFamily<Suffix, Args>;
|
|
161
|
-
}
|
|
419
|
+
}
|
|
162
420
|
|
|
163
421
|
/**
|
|
164
422
|
* Finds every widget under the container whose accessible role matches `role` and that satisfies the given options.
|
|
@@ -168,70 +426,84 @@ const nameQueryFamily = <Suffix extends string, Args extends unknown[]>(
|
|
|
168
426
|
* @param options Additional accessible name, state, and value constraints.
|
|
169
427
|
* @returns Every matching widget, or an empty array when none match.
|
|
170
428
|
*/
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
429
|
+
function queryAllByRole(
|
|
430
|
+
container: Container,
|
|
431
|
+
role: Gtk.AccessibleRole,
|
|
432
|
+
options?: ByRoleOptions,
|
|
433
|
+
): Gtk.Widget[] {
|
|
434
|
+
return findAll(container, (widget) => {
|
|
435
|
+
if (widget.getAccessibleRole() !== role) {
|
|
436
|
+
return false;
|
|
437
|
+
}
|
|
177
438
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
multipleFoundError(container, { queryType: "role", role, options }, matches),
|
|
186
|
-
(container, role, options) => notFoundError(container, { queryType: "role", role, options }),
|
|
187
|
-
),
|
|
188
|
-
);
|
|
439
|
+
if (!options?.hidden && isInaccessible(widget)) {
|
|
440
|
+
return false;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
return hasMatchingByRoleOptions(widget, options);
|
|
444
|
+
});
|
|
445
|
+
}
|
|
189
446
|
|
|
190
447
|
const collectMnemonicMatch = (
|
|
191
448
|
widget: Gtk.Widget,
|
|
192
449
|
text: Matcher,
|
|
193
450
|
options: MatcherOptions | undefined,
|
|
194
451
|
): Gtk.Widget | null => {
|
|
195
|
-
if (!(widget instanceof Gtk.Label))
|
|
452
|
+
if (!(widget instanceof Gtk.Label)) {
|
|
453
|
+
return null;
|
|
454
|
+
}
|
|
455
|
+
|
|
196
456
|
const labelText = widget.getLabel();
|
|
197
|
-
|
|
457
|
+
|
|
458
|
+
if (!labelText || !isTextMatch(labelText, text, widget, options)) {
|
|
459
|
+
return null;
|
|
460
|
+
}
|
|
461
|
+
|
|
198
462
|
return widget.getMnemonicWidget();
|
|
199
463
|
};
|
|
200
464
|
|
|
465
|
+
const collectLabelMatches = (
|
|
466
|
+
results: Set<Gtk.Widget>,
|
|
467
|
+
widget: Gtk.Widget,
|
|
468
|
+
text: Matcher,
|
|
469
|
+
options: MatcherOptions | undefined,
|
|
470
|
+
): void => {
|
|
471
|
+
const mnemonicTarget = collectMnemonicMatch(widget, text, options);
|
|
472
|
+
|
|
473
|
+
if (mnemonicTarget) {
|
|
474
|
+
results.add(mnemonicTarget);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
const ownLabel = getWidgetOwnLabel(widget);
|
|
478
|
+
|
|
479
|
+
if (ownLabel !== null && isTextMatch(ownLabel, text, widget, options)) {
|
|
480
|
+
results.add(widget);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
const labelledByText = getWidgetLabelledByText(widget);
|
|
484
|
+
|
|
485
|
+
if (labelledByText !== null && isTextMatch(labelledByText, text, widget, options)) {
|
|
486
|
+
results.add(widget);
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
|
|
201
490
|
/**
|
|
202
|
-
* Finds every widget associated with a label whose text matches: a Gtk.Label mnemonic target, the
|
|
491
|
+
* Finds every widget associated with a label whose text matches: a Gtk.Label mnemonic target, the
|
|
492
|
+
* widget's own accessible label, or its labelled-by relation.
|
|
203
493
|
* @param container Widget subtree to search.
|
|
204
494
|
* @param text Matcher for the label text.
|
|
205
495
|
* @param options Text matching options.
|
|
206
496
|
* @returns Every matching widget, or an empty array when none match.
|
|
207
497
|
*/
|
|
208
|
-
|
|
209
|
-
const results
|
|
498
|
+
function queryAllByLabelText(container: Container, text: Matcher, options?: MatcherOptions): Gtk.Widget[] {
|
|
499
|
+
const results: Set<Gtk.Widget> = new Set();
|
|
210
500
|
|
|
211
501
|
for (const widget of traverse(container)) {
|
|
212
|
-
|
|
213
|
-
if (mnemonicTarget) results.add(mnemonicTarget);
|
|
214
|
-
|
|
215
|
-
const ownLabel = getWidgetOwnLabel(widget);
|
|
216
|
-
if (ownLabel !== null && matchText(ownLabel, text, widget, options)) results.add(widget);
|
|
217
|
-
|
|
218
|
-
const labelledByText = getWidgetLabelledByText(widget);
|
|
219
|
-
if (labelledByText !== null && matchText(labelledByText, text, widget, options)) results.add(widget);
|
|
502
|
+
collectLabelMatches(results, widget, text, options);
|
|
220
503
|
}
|
|
221
504
|
|
|
222
505
|
return [...results];
|
|
223
|
-
}
|
|
224
|
-
|
|
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
|
-
);
|
|
506
|
+
}
|
|
235
507
|
|
|
236
508
|
/**
|
|
237
509
|
* Finds every widget whose rendered text content matches.
|
|
@@ -240,19 +512,9 @@ const labelTextQueries = nameQueryFamily(
|
|
|
240
512
|
* @param options Text matching options.
|
|
241
513
|
* @returns Every matching widget, or an empty array when none match.
|
|
242
514
|
*/
|
|
243
|
-
|
|
244
|
-
findAll(container, (widget) =>
|
|
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
|
-
);
|
|
515
|
+
function queryAllByText(container: Container, text: Matcher, options?: MatcherOptions): Gtk.Widget[] {
|
|
516
|
+
return findAll(container, (widget) => isTextMatch(getWidgetLabelText(widget), text, widget, options));
|
|
517
|
+
}
|
|
256
518
|
|
|
257
519
|
/**
|
|
258
520
|
* Finds every widget whose widget name matches.
|
|
@@ -261,19 +523,9 @@ const textQueries = nameQueryFamily(
|
|
|
261
523
|
* @param options Text matching options.
|
|
262
524
|
* @returns Every matching widget, or an empty array when none match.
|
|
263
525
|
*/
|
|
264
|
-
|
|
265
|
-
findAll(container, (widget) =>
|
|
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
|
-
);
|
|
526
|
+
function queryAllByName(container: Container, name: Matcher, options?: MatcherOptions): Gtk.Widget[] {
|
|
527
|
+
return findAll(container, (widget) => isTextMatch(getWidgetName(widget), name, widget, options));
|
|
528
|
+
}
|
|
277
529
|
|
|
278
530
|
/**
|
|
279
531
|
* Finds every widget whose placeholder text matches.
|
|
@@ -282,22 +534,13 @@ const nameQueries = nameQueryFamily(
|
|
|
282
534
|
* @param options Text matching options.
|
|
283
535
|
* @returns Every matching widget, or an empty array when none match.
|
|
284
536
|
*/
|
|
285
|
-
|
|
537
|
+
function queryAllByPlaceholderText(
|
|
286
538
|
container: Container,
|
|
287
539
|
text: Matcher,
|
|
288
540
|
options?: MatcherOptions,
|
|
289
|
-
): Gtk.Widget[]
|
|
290
|
-
|
|
291
|
-
|
|
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
|
-
);
|
|
541
|
+
): Gtk.Widget[] {
|
|
542
|
+
return findAll(container, (widget) => isTextMatch(getWidgetPlaceholderText(widget), text, widget, options));
|
|
543
|
+
}
|
|
301
544
|
|
|
302
545
|
/**
|
|
303
546
|
* Finds every widget whose current display value matches.
|
|
@@ -306,102 +549,48 @@ const placeholderTextQueries = nameQueryFamily(
|
|
|
306
549
|
* @param options Text matching options.
|
|
307
550
|
* @returns Every matching widget, or an empty array when none match.
|
|
308
551
|
*/
|
|
309
|
-
|
|
310
|
-
findAll(container, (widget) =>
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
552
|
+
function queryAllByDisplayValue(container: Container, value: Matcher, options?: MatcherOptions): Gtk.Widget[] {
|
|
553
|
+
return findAll(container, (widget) => isTextMatch(getWidgetDisplayValue(widget), value, widget, options));
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
export {
|
|
557
|
+
builtinQueries,
|
|
558
|
+
queryByRole,
|
|
559
|
+
getAllByRole,
|
|
560
|
+
getByRole,
|
|
561
|
+
findAllByRole,
|
|
562
|
+
findByRole,
|
|
563
|
+
queryByLabelText,
|
|
564
|
+
getAllByLabelText,
|
|
565
|
+
getByLabelText,
|
|
566
|
+
findAllByLabelText,
|
|
567
|
+
findByLabelText,
|
|
568
|
+
queryByText,
|
|
569
|
+
getAllByText,
|
|
570
|
+
getByText,
|
|
571
|
+
findAllByText,
|
|
572
|
+
findByText,
|
|
573
|
+
queryByName,
|
|
574
|
+
getAllByName,
|
|
575
|
+
getByName,
|
|
576
|
+
findAllByName,
|
|
577
|
+
findByName,
|
|
578
|
+
queryByPlaceholderText,
|
|
579
|
+
getAllByPlaceholderText,
|
|
580
|
+
getByPlaceholderText,
|
|
581
|
+
findAllByPlaceholderText,
|
|
582
|
+
findByPlaceholderText,
|
|
583
|
+
queryByDisplayValue,
|
|
584
|
+
getAllByDisplayValue,
|
|
585
|
+
getByDisplayValue,
|
|
586
|
+
findAllByDisplayValue,
|
|
587
|
+
findByDisplayValue,
|
|
588
|
+
getDefaultNormalizer,
|
|
589
|
+
queryAllByRole,
|
|
590
|
+
queryAllByLabelText,
|
|
591
|
+
queryAllByText,
|
|
592
|
+
queryAllByName,
|
|
593
|
+
queryAllByPlaceholderText,
|
|
314
594
|
queryAllByDisplayValue,
|
|
315
|
-
|
|
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,
|
|
595
|
+
type BuiltinQueries,
|
|
337
596
|
};
|
|
338
|
-
|
|
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;
|