@testspectra/matchers 1.1.8-rc.2 → 1.1.8-rc.21

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.
@@ -1,200 +1,200 @@
1
- /**
2
- * Element & collection proxy factories plus target resolution.
3
- *
4
- * Assembles action, state-inspection, and assertion methods into `SingleElementProxy` and
5
- * `CollectionProxy` instances that dispatch to the bound `PlatformDriverBridge`. The sibling
6
- * factories are read from the shared runtime context (single-scope concatenated assembly).
7
- */
8
-
9
- import type {
10
- AssertionOptions,
11
- CollectionProxy,
12
- ElementTarget,
13
- ScopedSelector,
14
- SingleElementProxy,
15
- } from '@testspectra/matchers';
16
-
17
- /** Display text for error messages / debugging — the local selector only, never the full chain. */
18
- function selectorText(s: string | ScopedSelector): string {
19
- return typeof s === 'string' ? s : s.selector;
20
- }
21
-
22
- /** Normalizes this element/collection's own identity into a `ScopedSelector`, for use as a
23
- * child's `parent` when chaining via `.get()`/`.getAll()`. */
24
- function toScopedSelector(selector: string | ScopedSelector, index: number | null): ScopedSelector {
25
- return typeof selector === 'string' ? { selector, index, parent: undefined } : selector;
26
- }
27
-
28
- export function createElementProxy(
29
- selector: string | ScopedSelector,
30
- index: number | null = null,
31
- ): SingleElementProxy {
32
- const selectorTextValue = selectorText(selector);
33
- const resolvedIndex = typeof selector === 'string' ? index : selector.index;
34
- const actions = globalThis.__TS_RUNTIME__.createElementActions!(selector, index);
35
- const state = globalThis.__TS_RUNTIME__.createElementState!(selector, index);
36
- const assertions = globalThis.__TS_RUNTIME__.createElementAssertions!(selector, index, state);
37
-
38
- return {
39
- selector: selectorTextValue,
40
- index: resolvedIndex,
41
- ...actions,
42
- ...state,
43
- ...assertions,
44
- get(childSelector: string, childIndex: number | null = null): SingleElementProxy {
45
- return globalThis.__TS_RUNTIME__.createElementProxy!(
46
- { selector: childSelector, index: childIndex, parent: toScopedSelector(selector, index) },
47
- null,
48
- );
49
- },
50
- getAll(childSelector: string): CollectionProxy {
51
- return globalThis.__TS_RUNTIME__.createCollectionProxy!({
52
- selector: childSelector,
53
- index: null,
54
- parent: toScopedSelector(selector, index),
55
- });
56
- },
57
- } as SingleElementProxy;
58
- }
59
-
60
- export function createCollectionProxy(selector: string | ScopedSelector): CollectionProxy {
61
- const driver = () => globalThis.__TS_RUNTIME__.activeDriver!;
62
- const selectorTextValue = selectorText(selector);
63
-
64
- /** Builds the (selector, index) pair to hand to `createElementProxy` for first()/last()/nth(),
65
- * preserving this collection's own scope (parent chain) instead of discarding it. */
66
- const withIndex = (idx: number): [string | ScopedSelector, number | null] =>
67
- typeof selector === 'string' ? [selector, idx] : [{ ...selector, index: idx }, null];
68
-
69
- const collectionProxy: CollectionProxy = {
70
- selector: selectorTextValue,
71
- async count(): Promise<number> {
72
- return await driver().count(selector);
73
- },
74
- get length(): Promise<number> {
75
- return this.count();
76
- },
77
- first(): SingleElementProxy {
78
- return globalThis.__TS_RUNTIME__.createElementProxy!(...withIndex(0));
79
- },
80
- last(): SingleElementProxy {
81
- return globalThis.__TS_RUNTIME__.createElementProxy!(...withIndex(-1));
82
- },
83
- nth(index: number): SingleElementProxy {
84
- return globalThis.__TS_RUNTIME__.createElementProxy!(...withIndex(index));
85
- },
86
- async shouldHaveLength(expected: number, options?: AssertionOptions): Promise<void> {
87
- return globalThis.__TS_RUNTIME__.trackStep(
88
- 'assertion',
89
- { type: 'assertion', key: 'have.length', target: selector, args: [expected] },
90
- async () => {
91
- let actual = 0;
92
- const ok = await globalThis.__TS_RUNTIME__.pollCondition(async () => {
93
- actual = await this.count();
94
- return actual === expected;
95
- }, options?.timeoutMs ?? globalThis.__TS_RUNTIME__.getAssertionTimeoutMs());
96
- if (!ok) {
97
- throw new Error(`Expected collection "${selectorTextValue}" count to equal ${expected}, but got ${actual}`);
98
- }
99
- },
100
- );
101
- },
102
- async shouldNotHaveLength(expected: number, options?: AssertionOptions): Promise<void> {
103
- return globalThis.__TS_RUNTIME__.trackStep(
104
- 'assertion',
105
- { type: 'assertion', key: 'not.have.length', target: selector, args: [expected] },
106
- async () => {
107
- let actual = 0;
108
- const ok = await globalThis.__TS_RUNTIME__.pollCondition(async () => {
109
- actual = await this.count();
110
- return actual !== expected;
111
- }, options?.timeoutMs ?? globalThis.__TS_RUNTIME__.getAssertionTimeoutMs());
112
- if (!ok) {
113
- throw new Error(`Expected collection "${selectorTextValue}" count not to equal ${expected}`);
114
- }
115
- },
116
- );
117
- },
118
- async shouldHaveLengthGreaterThan(expected: number, options?: AssertionOptions): Promise<void> {
119
- return globalThis.__TS_RUNTIME__.trackStep(
120
- 'assertion',
121
- { type: 'assertion', key: 'have.length.greaterThan', target: selector, args: [expected] },
122
- async () => {
123
- let actual = 0;
124
- const ok = await globalThis.__TS_RUNTIME__.pollCondition(async () => {
125
- actual = await this.count();
126
- return actual > expected;
127
- }, options?.timeoutMs ?? globalThis.__TS_RUNTIME__.getAssertionTimeoutMs());
128
- if (!ok) {
129
- throw new Error(
130
- `Expected collection "${selectorTextValue}" count to be greater than ${expected}, but got ${actual}`,
131
- );
132
- }
133
- },
134
- );
135
- },
136
- async shouldHaveLengthLessThan(expected: number, options?: AssertionOptions): Promise<void> {
137
- return globalThis.__TS_RUNTIME__.trackStep(
138
- 'assertion',
139
- { type: 'assertion', key: 'have.length.lessThan', target: selector, args: [expected] },
140
- async () => {
141
- let actual = 0;
142
- const ok = await globalThis.__TS_RUNTIME__.pollCondition(async () => {
143
- actual = await this.count();
144
- return actual < expected;
145
- }, options?.timeoutMs ?? globalThis.__TS_RUNTIME__.getAssertionTimeoutMs());
146
- if (!ok) {
147
- throw new Error(`Expected collection "${selectorTextValue}" count to be less than ${expected}, but got ${actual}`);
148
- }
149
- },
150
- );
151
- },
152
- async shouldBeEmpty(options?: AssertionOptions): Promise<void> {
153
- return globalThis.__TS_RUNTIME__.trackStep(
154
- 'assertion',
155
- { type: 'assertion', key: 'be.empty', target: selector, args: [] },
156
- async () => {
157
- let actual = 0;
158
- const ok = await globalThis.__TS_RUNTIME__.pollCondition(async () => {
159
- actual = await this.count();
160
- return actual === 0;
161
- }, options?.timeoutMs ?? globalThis.__TS_RUNTIME__.getAssertionTimeoutMs());
162
- if (!ok) {
163
- throw new Error(`Expected collection "${selectorTextValue}" to be empty, but got ${actual}`);
164
- }
165
- },
166
- );
167
- },
168
- async shouldNotBeEmpty(options?: AssertionOptions): Promise<void> {
169
- return globalThis.__TS_RUNTIME__.trackStep(
170
- 'assertion',
171
- { type: 'assertion', key: 'not.be.empty', target: selector, args: [] },
172
- async () => {
173
- let actual = 0;
174
- const ok = await globalThis.__TS_RUNTIME__.pollCondition(async () => {
175
- actual = await this.count();
176
- return actual > 0;
177
- }, options?.timeoutMs ?? globalThis.__TS_RUNTIME__.getAssertionTimeoutMs());
178
- if (!ok) {
179
- throw new Error(`Expected collection "${selectorTextValue}" not to be empty`);
180
- }
181
- },
182
- );
183
- },
184
- };
185
- return collectionProxy;
186
- }
187
-
188
- export function resolveTargetProxy(target: ElementTarget): SingleElementProxy {
189
- if (typeof target === 'string') {
190
- return (globalThis as any).$(target);
191
- }
192
- if (target && typeof target === 'object' && 'selector' in target) {
193
- return target as SingleElementProxy;
194
- }
195
- throw new Error(`Invalid element target: ${String(target)}`);
196
- }
197
-
198
- globalThis.__TS_RUNTIME__.createElementProxy = createElementProxy;
199
- globalThis.__TS_RUNTIME__.createCollectionProxy = createCollectionProxy;
200
- globalThis.__TS_RUNTIME__.resolveTargetProxy = resolveTargetProxy;
1
+ /**
2
+ * Element & collection proxy factories plus target resolution.
3
+ *
4
+ * Assembles action, state-inspection, and assertion methods into `SingleElementProxy` and
5
+ * `CollectionProxy` instances that dispatch to the bound `PlatformDriverBridge`. The sibling
6
+ * factories are read from the shared runtime context (single-scope concatenated assembly).
7
+ */
8
+
9
+ import type {
10
+ AssertionOptions,
11
+ CollectionProxy,
12
+ ElementTarget,
13
+ ScopedSelector,
14
+ SingleElementProxy,
15
+ } from '@testspectra/matchers';
16
+
17
+ /** Display text for error messages / debugging — the local selector only, never the full chain. */
18
+ function selectorText(s: string | ScopedSelector): string {
19
+ return typeof s === 'string' ? s : s.selector;
20
+ }
21
+
22
+ /** Normalizes this element/collection's own identity into a `ScopedSelector`, for use as a
23
+ * child's `parent` when chaining via `.get()`/`.getAll()`. */
24
+ function toScopedSelector(selector: string | ScopedSelector, index: number | null): ScopedSelector {
25
+ return typeof selector === 'string' ? { selector, index, parent: undefined } : selector;
26
+ }
27
+
28
+ export function createElementProxy(
29
+ selector: string | ScopedSelector,
30
+ index: number | null = null,
31
+ ): SingleElementProxy {
32
+ const selectorTextValue = selectorText(selector);
33
+ const resolvedIndex = typeof selector === 'string' ? index : selector.index;
34
+ const actions = globalThis.__TS_RUNTIME__.createElementActions!(selector, index);
35
+ const state = globalThis.__TS_RUNTIME__.createElementState!(selector, index);
36
+ const assertions = globalThis.__TS_RUNTIME__.createElementAssertions!(selector, index, state);
37
+
38
+ return {
39
+ selector: selectorTextValue,
40
+ index: resolvedIndex,
41
+ ...actions,
42
+ ...state,
43
+ ...assertions,
44
+ get(childSelector: string, childIndex: number | null = null): SingleElementProxy {
45
+ return globalThis.__TS_RUNTIME__.createElementProxy!(
46
+ { selector: childSelector, index: childIndex, parent: toScopedSelector(selector, index) },
47
+ null,
48
+ );
49
+ },
50
+ getAll(childSelector: string): CollectionProxy {
51
+ return globalThis.__TS_RUNTIME__.createCollectionProxy!({
52
+ selector: childSelector,
53
+ index: null,
54
+ parent: toScopedSelector(selector, index),
55
+ });
56
+ },
57
+ } as SingleElementProxy;
58
+ }
59
+
60
+ export function createCollectionProxy(selector: string | ScopedSelector): CollectionProxy {
61
+ const driver = () => globalThis.__TS_RUNTIME__.activeDriver!;
62
+ const selectorTextValue = selectorText(selector);
63
+
64
+ /** Builds the (selector, index) pair to hand to `createElementProxy` for first()/last()/nth(),
65
+ * preserving this collection's own scope (parent chain) instead of discarding it. */
66
+ const withIndex = (idx: number): [string | ScopedSelector, number | null] =>
67
+ typeof selector === 'string' ? [selector, idx] : [{ ...selector, index: idx }, null];
68
+
69
+ const collectionProxy: CollectionProxy = {
70
+ selector: selectorTextValue,
71
+ async count(): Promise<number> {
72
+ return await driver().count(selector);
73
+ },
74
+ get length(): Promise<number> {
75
+ return this.count();
76
+ },
77
+ first(): SingleElementProxy {
78
+ return globalThis.__TS_RUNTIME__.createElementProxy!(...withIndex(0));
79
+ },
80
+ last(): SingleElementProxy {
81
+ return globalThis.__TS_RUNTIME__.createElementProxy!(...withIndex(-1));
82
+ },
83
+ nth(index: number): SingleElementProxy {
84
+ return globalThis.__TS_RUNTIME__.createElementProxy!(...withIndex(index));
85
+ },
86
+ async shouldHaveLength(expected: number, options?: AssertionOptions): Promise<void> {
87
+ return globalThis.__TS_RUNTIME__.trackStep(
88
+ 'assertion',
89
+ { type: 'assertion', key: 'have.length', target: selector, args: [expected] },
90
+ async () => {
91
+ let actual = 0;
92
+ const ok = await globalThis.__TS_RUNTIME__.pollCondition(async () => {
93
+ actual = await this.count();
94
+ return actual === expected;
95
+ }, options?.timeoutMs ?? globalThis.__TS_RUNTIME__.getAssertionTimeoutMs());
96
+ if (!ok) {
97
+ throw new Error(`Expected collection "${selectorTextValue}" count to equal ${expected}, but got ${actual}`);
98
+ }
99
+ },
100
+ );
101
+ },
102
+ async shouldNotHaveLength(expected: number, options?: AssertionOptions): Promise<void> {
103
+ return globalThis.__TS_RUNTIME__.trackStep(
104
+ 'assertion',
105
+ { type: 'assertion', key: 'not.have.length', target: selector, args: [expected] },
106
+ async () => {
107
+ let actual = 0;
108
+ const ok = await globalThis.__TS_RUNTIME__.pollCondition(async () => {
109
+ actual = await this.count();
110
+ return actual !== expected;
111
+ }, options?.timeoutMs ?? globalThis.__TS_RUNTIME__.getAssertionTimeoutMs());
112
+ if (!ok) {
113
+ throw new Error(`Expected collection "${selectorTextValue}" count not to equal ${expected}`);
114
+ }
115
+ },
116
+ );
117
+ },
118
+ async shouldHaveLengthGreaterThan(expected: number, options?: AssertionOptions): Promise<void> {
119
+ return globalThis.__TS_RUNTIME__.trackStep(
120
+ 'assertion',
121
+ { type: 'assertion', key: 'have.length.greaterThan', target: selector, args: [expected] },
122
+ async () => {
123
+ let actual = 0;
124
+ const ok = await globalThis.__TS_RUNTIME__.pollCondition(async () => {
125
+ actual = await this.count();
126
+ return actual > expected;
127
+ }, options?.timeoutMs ?? globalThis.__TS_RUNTIME__.getAssertionTimeoutMs());
128
+ if (!ok) {
129
+ throw new Error(
130
+ `Expected collection "${selectorTextValue}" count to be greater than ${expected}, but got ${actual}`,
131
+ );
132
+ }
133
+ },
134
+ );
135
+ },
136
+ async shouldHaveLengthLessThan(expected: number, options?: AssertionOptions): Promise<void> {
137
+ return globalThis.__TS_RUNTIME__.trackStep(
138
+ 'assertion',
139
+ { type: 'assertion', key: 'have.length.lessThan', target: selector, args: [expected] },
140
+ async () => {
141
+ let actual = 0;
142
+ const ok = await globalThis.__TS_RUNTIME__.pollCondition(async () => {
143
+ actual = await this.count();
144
+ return actual < expected;
145
+ }, options?.timeoutMs ?? globalThis.__TS_RUNTIME__.getAssertionTimeoutMs());
146
+ if (!ok) {
147
+ throw new Error(`Expected collection "${selectorTextValue}" count to be less than ${expected}, but got ${actual}`);
148
+ }
149
+ },
150
+ );
151
+ },
152
+ async shouldBeEmpty(options?: AssertionOptions): Promise<void> {
153
+ return globalThis.__TS_RUNTIME__.trackStep(
154
+ 'assertion',
155
+ { type: 'assertion', key: 'be.empty', target: selector, args: [] },
156
+ async () => {
157
+ let actual = 0;
158
+ const ok = await globalThis.__TS_RUNTIME__.pollCondition(async () => {
159
+ actual = await this.count();
160
+ return actual === 0;
161
+ }, options?.timeoutMs ?? globalThis.__TS_RUNTIME__.getAssertionTimeoutMs());
162
+ if (!ok) {
163
+ throw new Error(`Expected collection "${selectorTextValue}" to be empty, but got ${actual}`);
164
+ }
165
+ },
166
+ );
167
+ },
168
+ async shouldNotBeEmpty(options?: AssertionOptions): Promise<void> {
169
+ return globalThis.__TS_RUNTIME__.trackStep(
170
+ 'assertion',
171
+ { type: 'assertion', key: 'not.be.empty', target: selector, args: [] },
172
+ async () => {
173
+ let actual = 0;
174
+ const ok = await globalThis.__TS_RUNTIME__.pollCondition(async () => {
175
+ actual = await this.count();
176
+ return actual > 0;
177
+ }, options?.timeoutMs ?? globalThis.__TS_RUNTIME__.getAssertionTimeoutMs());
178
+ if (!ok) {
179
+ throw new Error(`Expected collection "${selectorTextValue}" not to be empty`);
180
+ }
181
+ },
182
+ );
183
+ },
184
+ };
185
+ return collectionProxy;
186
+ }
187
+
188
+ export function resolveTargetProxy(target: ElementTarget): SingleElementProxy {
189
+ if (typeof target === 'string') {
190
+ return (globalThis as any).$(target);
191
+ }
192
+ if (target && typeof target === 'object' && 'selector' in target) {
193
+ return target as SingleElementProxy;
194
+ }
195
+ throw new Error(`Invalid element target: ${String(target)}`);
196
+ }
197
+
198
+ globalThis.__TS_RUNTIME__.createElementProxy = createElementProxy;
199
+ globalThis.__TS_RUNTIME__.createCollectionProxy = createCollectionProxy;
200
+ globalThis.__TS_RUNTIME__.resolveTargetProxy = resolveTargetProxy;
@@ -1,94 +1,94 @@
1
- /**
2
- * Element state-inspection methods for `SingleElementProxy`.
3
- *
4
- * Thin delegations to the bound `PlatformDriverBridge`. No platform branching here.
5
- */
6
-
7
- import type { ScopedSelector } from '@testspectra/matchers';
8
-
9
- export function createElementState(selector: string | ScopedSelector, index: number | null): Record<string, any> {
10
- const driver = () => globalThis.__TS_RUNTIME__.activeDriver!;
11
- const selectorText = typeof selector === 'string' ? selector : selector.selector;
12
-
13
- async function getText(): Promise<string> {
14
- return await driver().getText(selector, index);
15
- }
16
-
17
- async function getValue(): Promise<string> {
18
- return await driver().getValue(selector, index);
19
- }
20
-
21
- async function isDisplayed(): Promise<boolean> {
22
- return await driver().isDisplayed(selector, index);
23
- }
24
-
25
- async function isVisible(): Promise<boolean> {
26
- return await isDisplayed();
27
- }
28
-
29
- async function isExisting(): Promise<boolean> {
30
- return await driver().isExisting(selector, index);
31
- }
32
-
33
- async function isEnabled(): Promise<boolean> {
34
- return await driver().isEnabled(selector, index);
35
- }
36
-
37
- async function isSelected(): Promise<boolean> {
38
- return await driver().isSelected(selector, index);
39
- }
40
-
41
- async function isChecked(): Promise<boolean> {
42
- return await isSelected();
43
- }
44
-
45
- async function isFocused(): Promise<boolean> {
46
- return await driver().isFocused(selector, index);
47
- }
48
-
49
- async function getAttribute(name: string): Promise<string | null> {
50
- return await driver().getAttribute(selector, name, index);
51
- }
52
-
53
- async function getCSSProperty(name: string): Promise<{ value: string }> {
54
- return await driver().getCSSProperty(selector, name, index);
55
- }
56
-
57
- async function waitForElement(timeoutMs?: number): Promise<boolean> {
58
- const waitTimeout = timeoutMs ?? globalThis.__TS_RUNTIME__.getImplicitWaitMs();
59
- const ok = await globalThis.__TS_RUNTIME__.pollCondition(
60
- async () => driver().isExisting(selector, index),
61
- waitTimeout,
62
- );
63
- if (ok) return true;
64
- throw new Error('Element not found: ' + JSON.stringify(selectorText));
65
- }
66
-
67
- async function waitForDisplayed(opts: { timeout?: number } = {}): Promise<boolean> {
68
- const timeout = opts.timeout || 5000;
69
- const start = Date.now();
70
- while (Date.now() - start < timeout) {
71
- if (await driver().isDisplayed(selector, index)) return true;
72
- await new Promise((r) => setTimeout(r, 20));
73
- }
74
- throw new Error(`Element ${selectorText} not displayed after ${timeout}ms`);
75
- }
76
-
77
- return {
78
- getText,
79
- getValue,
80
- isDisplayed,
81
- isVisible,
82
- isExisting,
83
- isEnabled,
84
- isSelected,
85
- isChecked,
86
- isFocused,
87
- getAttribute,
88
- getCSSProperty,
89
- waitForElement,
90
- waitForDisplayed,
91
- };
92
- }
93
-
94
- globalThis.__TS_RUNTIME__.createElementState = createElementState;
1
+ /**
2
+ * Element state-inspection methods for `SingleElementProxy`.
3
+ *
4
+ * Thin delegations to the bound `PlatformDriverBridge`. No platform branching here.
5
+ */
6
+
7
+ import type { ScopedSelector } from '@testspectra/matchers';
8
+
9
+ export function createElementState(selector: string | ScopedSelector, index: number | null): Record<string, any> {
10
+ const driver = () => globalThis.__TS_RUNTIME__.activeDriver!;
11
+ const selectorText = typeof selector === 'string' ? selector : selector.selector;
12
+
13
+ async function getText(): Promise<string> {
14
+ return await driver().getText(selector, index);
15
+ }
16
+
17
+ async function getValue(): Promise<string> {
18
+ return await driver().getValue(selector, index);
19
+ }
20
+
21
+ async function isDisplayed(): Promise<boolean> {
22
+ return await driver().isDisplayed(selector, index);
23
+ }
24
+
25
+ async function isVisible(): Promise<boolean> {
26
+ return await isDisplayed();
27
+ }
28
+
29
+ async function isExisting(): Promise<boolean> {
30
+ return await driver().isExisting(selector, index);
31
+ }
32
+
33
+ async function isEnabled(): Promise<boolean> {
34
+ return await driver().isEnabled(selector, index);
35
+ }
36
+
37
+ async function isSelected(): Promise<boolean> {
38
+ return await driver().isSelected(selector, index);
39
+ }
40
+
41
+ async function isChecked(): Promise<boolean> {
42
+ return await isSelected();
43
+ }
44
+
45
+ async function isFocused(): Promise<boolean> {
46
+ return await driver().isFocused(selector, index);
47
+ }
48
+
49
+ async function getAttribute(name: string): Promise<string | null> {
50
+ return await driver().getAttribute(selector, name, index);
51
+ }
52
+
53
+ async function getCSSProperty(name: string): Promise<{ value: string }> {
54
+ return await driver().getCSSProperty(selector, name, index);
55
+ }
56
+
57
+ async function waitForElement(timeoutMs?: number): Promise<boolean> {
58
+ const waitTimeout = timeoutMs ?? globalThis.__TS_RUNTIME__.getImplicitWaitMs();
59
+ const ok = await globalThis.__TS_RUNTIME__.pollCondition(
60
+ async () => driver().isExisting(selector, index),
61
+ waitTimeout,
62
+ );
63
+ if (ok) return true;
64
+ throw new Error('Element not found: ' + JSON.stringify(selectorText));
65
+ }
66
+
67
+ async function waitForDisplayed(opts: { timeout?: number } = {}): Promise<boolean> {
68
+ const timeout = opts.timeout || 5000;
69
+ const start = Date.now();
70
+ while (Date.now() - start < timeout) {
71
+ if (await driver().isDisplayed(selector, index)) return true;
72
+ await new Promise((r) => setTimeout(r, 20));
73
+ }
74
+ throw new Error(`Element ${selectorText} not displayed after ${timeout}ms`);
75
+ }
76
+
77
+ return {
78
+ getText,
79
+ getValue,
80
+ isDisplayed,
81
+ isVisible,
82
+ isExisting,
83
+ isEnabled,
84
+ isSelected,
85
+ isChecked,
86
+ isFocused,
87
+ getAttribute,
88
+ getCSSProperty,
89
+ waitForElement,
90
+ waitForDisplayed,
91
+ };
92
+ }
93
+
94
+ globalThis.__TS_RUNTIME__.createElementState = createElementState;