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