@testspectra/matchers 1.1.8-rc.9 → 1.1.10
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/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* state-inspection methods.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { AssertionOptions, ScopedSelector } from '../types';
|
|
10
|
+
import type { AssertionOptions, ScopedSelector } from '../types.js';
|
|
11
11
|
|
|
12
12
|
export function createElementAssertions(
|
|
13
13
|
selector: string | ScopedSelector,
|
|
@@ -294,7 +294,8 @@ export function createElementAssertions(
|
|
|
294
294
|
actual = await state.getText();
|
|
295
295
|
return actual.includes(String(substring));
|
|
296
296
|
}, options?.timeoutMs ?? globalThis.__TS_RUNTIME__.getAssertionTimeoutMs());
|
|
297
|
-
if (!ok)
|
|
297
|
+
if (!ok)
|
|
298
|
+
throw new Error(`Expected element "${selectorText}" to contain text "${substring}", but got "${actual}"`);
|
|
298
299
|
},
|
|
299
300
|
);
|
|
300
301
|
}
|
|
@@ -6,18 +6,9 @@
|
|
|
6
6
|
* platform-specific behavior lives inside the active driver.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
LongPressOptions,
|
|
13
|
-
ScopedSelector,
|
|
14
|
-
TypeOptions,
|
|
15
|
-
} from '@testspectra/matchers';
|
|
16
|
-
|
|
17
|
-
export function createElementActions(
|
|
18
|
-
selector: string | ScopedSelector,
|
|
19
|
-
index: number | null,
|
|
20
|
-
): Record<string, any> {
|
|
9
|
+
import type { ClickOptions, ElementTarget, LongPressOptions, ScopedSelector, TypeOptions } from '@testspectra/matchers';
|
|
10
|
+
|
|
11
|
+
export function createElementActions(selector: string | ScopedSelector, index: number | null): Record<string, any> {
|
|
21
12
|
const driver = () => globalThis.__TS_RUNTIME__.activeDriver!;
|
|
22
13
|
|
|
23
14
|
async function click(_options?: ClickOptions): Promise<void> {
|
|
@@ -25,10 +25,7 @@ function toScopedSelector(selector: string | ScopedSelector, index: number | nul
|
|
|
25
25
|
return typeof selector === 'string' ? { selector, index, parent: undefined } : selector;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export function createElementProxy(
|
|
29
|
-
selector: string | ScopedSelector,
|
|
30
|
-
index: number | null = null,
|
|
31
|
-
): SingleElementProxy {
|
|
28
|
+
export function createElementProxy(selector: string | ScopedSelector, index: number | null = null): SingleElementProxy {
|
|
32
29
|
const selectorTextValue = selectorText(selector);
|
|
33
30
|
const resolvedIndex = typeof selector === 'string' ? index : selector.index;
|
|
34
31
|
const actions = globalThis.__TS_RUNTIME__.createElementActions!(selector, index);
|
|
@@ -144,7 +141,9 @@ export function createCollectionProxy(selector: string | ScopedSelector): Collec
|
|
|
144
141
|
return actual < expected;
|
|
145
142
|
}, options?.timeoutMs ?? globalThis.__TS_RUNTIME__.getAssertionTimeoutMs());
|
|
146
143
|
if (!ok) {
|
|
147
|
-
throw new Error(
|
|
144
|
+
throw new Error(
|
|
145
|
+
`Expected collection "${selectorTextValue}" count to be less than ${expected}, but got ${actual}`,
|
|
146
|
+
);
|
|
148
147
|
}
|
|
149
148
|
},
|
|
150
149
|
);
|
|
Binary file
|
|
Binary file
|