@testspectra/matchers 1.1.8-rc.3 → 1.1.8-rc.30
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/__tests__/matchers.test.js +8 -0
- package/dist/runner/collection.d.ts +4 -16
- package/dist/runner/collection.js +12 -24
- package/dist/runner/single.d.ts +2 -28
- package/dist/runner/single.js +36 -55
- package/dist/spectra.d.ts +3 -3
- package/dist/spectra.js +3 -3
- package/package.json +10 -11
- package/src/contract.ts +223 -223
- package/src/proto.ts +35 -35
- package/src/runtime/assertions.ts +454 -453
- package/src/runtime/element_actions.ts +169 -178
- package/src/runtime/element_proxy.ts +199 -200
- package/src/runtime/element_state.ts +94 -94
- package/src/runtime/spectra.ts +110 -110
- package/src/types.ts +1648 -1648
- package/testspectra-matchers-1.1.8-rc.30.tgz +0 -0
- package/tsconfig.json +17 -17
- package/dist/semantic.d.ts +0 -11
- package/dist/semantic.js +0 -141
|
@@ -89,6 +89,14 @@ describe('Matchers Assertion Library & Receiver API', () => {
|
|
|
89
89
|
expect(runner.dragDrop('#dest')).toBe(runner);
|
|
90
90
|
expect(runner._actionPayload.key).toBe('dragDrop');
|
|
91
91
|
});
|
|
92
|
+
it('should support action to semantic assertion chaining', () => {
|
|
93
|
+
const runner = new SingleElementRunner('#login-btn');
|
|
94
|
+
runner.click().shouldNotBeVisible();
|
|
95
|
+
expect(runner._actionPayload.key).toBe('click');
|
|
96
|
+
const assertions = runner._assertions;
|
|
97
|
+
expect(assertions).toHaveLength(1);
|
|
98
|
+
expect(assertions[0].matcher).toBe('not.be.visible');
|
|
99
|
+
});
|
|
92
100
|
});
|
|
93
101
|
describe('MultiElementRunner - 6 Collection Receiver Assertions', () => {
|
|
94
102
|
it('should queue all 6 collection assertions', () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CollectionReceiverAssertions
|
|
1
|
+
import { CollectionReceiverAssertions } from '../types.js';
|
|
2
2
|
import { SingleElementRunner } from './single.js';
|
|
3
3
|
/**
|
|
4
4
|
* Fluent assertion, filtering, and iteration runner for multi-element collections.
|
|
@@ -26,6 +26,7 @@ export declare class MultiElementRunner implements PromiseLike<void>, Collection
|
|
|
26
26
|
private _selector;
|
|
27
27
|
private _assertions;
|
|
28
28
|
constructor(selector: string);
|
|
29
|
+
private _pushAssertion;
|
|
29
30
|
/**
|
|
30
31
|
* Asserts that the collection contains exactly `count` elements.
|
|
31
32
|
*/
|
|
@@ -50,19 +51,6 @@ export declare class MultiElementRunner implements PromiseLike<void>, Collection
|
|
|
50
51
|
* Asserts that the collection is not empty (contains at least 1 element).
|
|
51
52
|
*/
|
|
52
53
|
shouldNotBeEmpty(): this;
|
|
53
|
-
/**
|
|
54
|
-
* Queues an assertion matcher against the multi-element collection.
|
|
55
|
-
*
|
|
56
|
-
* @param matcher - Multi-element matcher string (e.g. `'have.length'`, `'be.empty'`).
|
|
57
|
-
* @param args - Expected values or limits for the matcher.
|
|
58
|
-
* @example
|
|
59
|
-
* ```ts
|
|
60
|
-
* await Spectra.getAll(".product-card").should("have.length.greaterThan", 0);
|
|
61
|
-
* await Spectra.getAll(".error-badge").should("be.empty");
|
|
62
|
-
* ```
|
|
63
|
-
* @returns Current collection runner instance for chaining.
|
|
64
|
-
*/
|
|
65
|
-
should(matcher: MultiElementMatcher, ...args: any[]): this;
|
|
66
54
|
/**
|
|
67
55
|
* Returns a `SingleElementRunner` targeting the element at the specified 0-based index.
|
|
68
56
|
*
|
|
@@ -89,7 +77,7 @@ export declare class MultiElementRunner implements PromiseLike<void>, Collection
|
|
|
89
77
|
*
|
|
90
78
|
* @example
|
|
91
79
|
* ```ts
|
|
92
|
-
* await Spectra.getAll(".step-indicator").last().
|
|
80
|
+
* await Spectra.getAll(".step-indicator").last().shouldHaveClass("current");
|
|
93
81
|
* ```
|
|
94
82
|
* @returns `SingleElementRunner` for the last element.
|
|
95
83
|
*/
|
|
@@ -101,7 +89,7 @@ export declare class MultiElementRunner implements PromiseLike<void>, Collection
|
|
|
101
89
|
* @example
|
|
102
90
|
* ```ts
|
|
103
91
|
* await Spectra.getAll(".checkbox").each(async (item, index) => {
|
|
104
|
-
* await item.
|
|
92
|
+
* await item.shouldBeVisible();
|
|
105
93
|
* });
|
|
106
94
|
* ```
|
|
107
95
|
*/
|
|
@@ -29,58 +29,46 @@ export class MultiElementRunner {
|
|
|
29
29
|
constructor(selector) {
|
|
30
30
|
this._selector = selector;
|
|
31
31
|
}
|
|
32
|
+
_pushAssertion(matcher, args = []) {
|
|
33
|
+
this._assertions.push({ matcher, args });
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
32
36
|
// --- Collection Assertions ---
|
|
33
37
|
/**
|
|
34
38
|
* Asserts that the collection contains exactly `count` elements.
|
|
35
39
|
*/
|
|
36
40
|
shouldHaveLength(count) {
|
|
37
|
-
return this.
|
|
41
|
+
return this._pushAssertion('have.length', [count]);
|
|
38
42
|
}
|
|
39
43
|
/**
|
|
40
44
|
* Asserts that the collection does not contain `count` elements.
|
|
41
45
|
*/
|
|
42
46
|
shouldNotHaveLength(count) {
|
|
43
|
-
return this.
|
|
47
|
+
return this._pushAssertion('not.have.length', [count]);
|
|
44
48
|
}
|
|
45
49
|
/**
|
|
46
50
|
* Asserts that the collection contains more than `min` elements.
|
|
47
51
|
*/
|
|
48
52
|
shouldHaveLengthGreaterThan(min) {
|
|
49
|
-
return this.
|
|
53
|
+
return this._pushAssertion('have.length.greaterThan', [min]);
|
|
50
54
|
}
|
|
51
55
|
/**
|
|
52
56
|
* Asserts that the collection contains less than `max` elements.
|
|
53
57
|
*/
|
|
54
58
|
shouldHaveLengthLessThan(max) {
|
|
55
|
-
return this.
|
|
59
|
+
return this._pushAssertion('have.length.lessThan', [max]);
|
|
56
60
|
}
|
|
57
61
|
/**
|
|
58
62
|
* Asserts that the collection is empty (contains 0 elements).
|
|
59
63
|
*/
|
|
60
64
|
shouldBeEmpty() {
|
|
61
|
-
return this.
|
|
65
|
+
return this._pushAssertion('be.empty');
|
|
62
66
|
}
|
|
63
67
|
/**
|
|
64
68
|
* Asserts that the collection is not empty (contains at least 1 element).
|
|
65
69
|
*/
|
|
66
70
|
shouldNotBeEmpty() {
|
|
67
|
-
return this.
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Queues an assertion matcher against the multi-element collection.
|
|
71
|
-
*
|
|
72
|
-
* @param matcher - Multi-element matcher string (e.g. `'have.length'`, `'be.empty'`).
|
|
73
|
-
* @param args - Expected values or limits for the matcher.
|
|
74
|
-
* @example
|
|
75
|
-
* ```ts
|
|
76
|
-
* await Spectra.getAll(".product-card").should("have.length.greaterThan", 0);
|
|
77
|
-
* await Spectra.getAll(".error-badge").should("be.empty");
|
|
78
|
-
* ```
|
|
79
|
-
* @returns Current collection runner instance for chaining.
|
|
80
|
-
*/
|
|
81
|
-
should(matcher, ...args) {
|
|
82
|
-
this._assertions.push({ matcher, args });
|
|
83
|
-
return this;
|
|
71
|
+
return this._pushAssertion('not.be.empty');
|
|
84
72
|
}
|
|
85
73
|
// --- Item Navigation ---
|
|
86
74
|
/**
|
|
@@ -122,7 +110,7 @@ export class MultiElementRunner {
|
|
|
122
110
|
*
|
|
123
111
|
* @example
|
|
124
112
|
* ```ts
|
|
125
|
-
* await Spectra.getAll(".step-indicator").last().
|
|
113
|
+
* await Spectra.getAll(".step-indicator").last().shouldHaveClass("current");
|
|
126
114
|
* ```
|
|
127
115
|
* @returns `SingleElementRunner` for the last element.
|
|
128
116
|
*/
|
|
@@ -147,7 +135,7 @@ export class MultiElementRunner {
|
|
|
147
135
|
* @example
|
|
148
136
|
* ```ts
|
|
149
137
|
* await Spectra.getAll(".checkbox").each(async (item, index) => {
|
|
150
|
-
* await item.
|
|
138
|
+
* await item.shouldBeVisible();
|
|
151
139
|
* });
|
|
152
140
|
* ```
|
|
153
141
|
*/
|
package/dist/runner/single.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementReceiverAssertions, ElementTarget,
|
|
1
|
+
import { ElementReceiverAssertions, ElementTarget, TypeOptions } from '../types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Fluent interaction and assertion runner for a single element or browser context.
|
|
4
4
|
*
|
|
@@ -122,6 +122,7 @@ export declare class SingleElementRunner implements PromiseLike<void>, ElementRe
|
|
|
122
122
|
* Scrolls the target element into view.
|
|
123
123
|
*/
|
|
124
124
|
scrollIntoView(): this;
|
|
125
|
+
private _pushAssertion;
|
|
125
126
|
/**
|
|
126
127
|
* Asserts that the target element is displayed and visible to the user.
|
|
127
128
|
*/
|
|
@@ -226,33 +227,6 @@ export declare class SingleElementRunner implements PromiseLike<void>, ElementRe
|
|
|
226
227
|
* Asserts that the target element does not have the specified computed CSS property value.
|
|
227
228
|
*/
|
|
228
229
|
shouldNotHaveCss(property: string, value: string): this;
|
|
229
|
-
/**
|
|
230
|
-
* Queues an assertion matcher against the current target element or page.
|
|
231
|
-
*
|
|
232
|
-
* @param matcher - Single element matcher string (e.g. `'be.visible'`, `'have.text'`).
|
|
233
|
-
* @param args - Additional parameters for the matcher (e.g. expected text or value).
|
|
234
|
-
* @example
|
|
235
|
-
* ```ts
|
|
236
|
-
* await Spectra.get("#status-badge").should("be.visible");
|
|
237
|
-
* await Spectra.get("#username").should("have.value", "alice");
|
|
238
|
-
* await Spectra.get("#banner").should("have.class", "alert-success");
|
|
239
|
-
* ```
|
|
240
|
-
* @returns Current runner instance for method chaining.
|
|
241
|
-
*/
|
|
242
|
-
should(matcher: SingleElementMatcher, ...args: any[]): this;
|
|
243
|
-
/**
|
|
244
|
-
* Queues an assertion matcher targeting a specific element.
|
|
245
|
-
*
|
|
246
|
-
* @param target - Custom element target for this specific assertion.
|
|
247
|
-
* @param matcher - Single element matcher string.
|
|
248
|
-
* @param args - Additional parameters for the matcher.
|
|
249
|
-
* @example
|
|
250
|
-
* ```ts
|
|
251
|
-
* await Spectra.should(LoginPage.submitBtn, "be.enabled");
|
|
252
|
-
* ```
|
|
253
|
-
* @returns Current runner instance for method chaining.
|
|
254
|
-
*/
|
|
255
|
-
should(target: ElementTarget, matcher: SingleElementMatcher, ...args: any[]): this;
|
|
256
230
|
/**
|
|
257
231
|
* Standard Promise `then` implementation.
|
|
258
232
|
* Executes queued action first (if any), followed sequentially by all queued assertions.
|
package/dist/runner/single.js
CHANGED
|
@@ -242,191 +242,172 @@ export class SingleElementRunner {
|
|
|
242
242
|
};
|
|
243
243
|
return this;
|
|
244
244
|
}
|
|
245
|
+
_pushAssertion(matcher, args = []) {
|
|
246
|
+
this._assertions.push({
|
|
247
|
+
target: this._target,
|
|
248
|
+
matcher,
|
|
249
|
+
args,
|
|
250
|
+
});
|
|
251
|
+
return this;
|
|
252
|
+
}
|
|
245
253
|
// --- Fluent Assertion Matchers ---
|
|
246
254
|
/**
|
|
247
255
|
* Asserts that the target element is displayed and visible to the user.
|
|
248
256
|
*/
|
|
249
257
|
shouldBeVisible() {
|
|
250
|
-
return this.
|
|
258
|
+
return this._pushAssertion('be.visible');
|
|
251
259
|
}
|
|
252
260
|
/**
|
|
253
261
|
* Asserts that the target element is not displayed or hidden from view.
|
|
254
262
|
*/
|
|
255
263
|
shouldNotBeVisible() {
|
|
256
|
-
return this.
|
|
264
|
+
return this._pushAssertion('not.be.visible');
|
|
257
265
|
}
|
|
258
266
|
/**
|
|
259
267
|
* Asserts that the target element exists in the DOM.
|
|
260
268
|
*/
|
|
261
269
|
shouldExist() {
|
|
262
|
-
return this.
|
|
270
|
+
return this._pushAssertion('exist');
|
|
263
271
|
}
|
|
264
272
|
/**
|
|
265
273
|
* Asserts that the target element does not exist in the DOM.
|
|
266
274
|
*/
|
|
267
275
|
shouldNotExist() {
|
|
268
|
-
return this.
|
|
276
|
+
return this._pushAssertion('not.exist');
|
|
269
277
|
}
|
|
270
278
|
/**
|
|
271
279
|
* Asserts that the target element is clickable.
|
|
272
280
|
*/
|
|
273
281
|
shouldBeClickable() {
|
|
274
|
-
return this.
|
|
282
|
+
return this._pushAssertion('be.clickable');
|
|
275
283
|
}
|
|
276
284
|
/**
|
|
277
285
|
* Asserts that the target element is not clickable.
|
|
278
286
|
*/
|
|
279
287
|
shouldNotBeClickable() {
|
|
280
|
-
return this.
|
|
288
|
+
return this._pushAssertion('not.be.clickable');
|
|
281
289
|
}
|
|
282
290
|
/**
|
|
283
291
|
* Asserts that the target element is enabled (not disabled).
|
|
284
292
|
*/
|
|
285
293
|
shouldBeEnabled() {
|
|
286
|
-
return this.
|
|
294
|
+
return this._pushAssertion('be.enabled');
|
|
287
295
|
}
|
|
288
296
|
/**
|
|
289
297
|
* Asserts that the target element is disabled.
|
|
290
298
|
*/
|
|
291
299
|
shouldBeDisabled() {
|
|
292
|
-
return this.
|
|
300
|
+
return this._pushAssertion('be.disabled');
|
|
293
301
|
}
|
|
294
302
|
/**
|
|
295
303
|
* Asserts that the target checkbox or radio element is checked.
|
|
296
304
|
*/
|
|
297
305
|
shouldBeChecked() {
|
|
298
|
-
return this.
|
|
306
|
+
return this._pushAssertion('be.checked');
|
|
299
307
|
}
|
|
300
308
|
/**
|
|
301
309
|
* Asserts that the target checkbox or radio element is not checked.
|
|
302
310
|
*/
|
|
303
311
|
shouldNotBeChecked() {
|
|
304
|
-
return this.
|
|
312
|
+
return this._pushAssertion('not.be.checked');
|
|
305
313
|
}
|
|
306
314
|
/**
|
|
307
315
|
* Asserts that the target element currently has focus.
|
|
308
316
|
*/
|
|
309
317
|
shouldBeFocused() {
|
|
310
|
-
return this.
|
|
318
|
+
return this._pushAssertion('be.focused');
|
|
311
319
|
}
|
|
312
320
|
/**
|
|
313
321
|
* Asserts that the target element does not have focus.
|
|
314
322
|
*/
|
|
315
323
|
shouldNotBeFocused() {
|
|
316
|
-
return this.
|
|
324
|
+
return this._pushAssertion('not.be.focused');
|
|
317
325
|
}
|
|
318
326
|
/**
|
|
319
327
|
* Asserts that the target element has exact inner text matching the expected value.
|
|
320
328
|
*/
|
|
321
329
|
shouldHaveText(expected) {
|
|
322
|
-
return this.
|
|
330
|
+
return this._pushAssertion('have.text', [expected]);
|
|
323
331
|
}
|
|
324
332
|
/**
|
|
325
333
|
* Asserts that the target element does not have inner text matching the expected value.
|
|
326
334
|
*/
|
|
327
335
|
shouldNotHaveText(expected) {
|
|
328
|
-
return this.
|
|
336
|
+
return this._pushAssertion('not.have.text', [expected]);
|
|
329
337
|
}
|
|
330
338
|
/**
|
|
331
339
|
* Asserts that the target element's text contains the given substring.
|
|
332
340
|
*/
|
|
333
341
|
shouldContainText(substring) {
|
|
334
|
-
return this.
|
|
342
|
+
return this._pushAssertion('contain.text', [substring]);
|
|
335
343
|
}
|
|
336
344
|
/**
|
|
337
345
|
* Asserts that the target element's text does not contain the given substring.
|
|
338
346
|
*/
|
|
339
347
|
shouldNotContainText(substring) {
|
|
340
|
-
return this.
|
|
348
|
+
return this._pushAssertion('not.contain.text', [substring]);
|
|
341
349
|
}
|
|
342
350
|
/**
|
|
343
351
|
* Asserts that the target input element has the exact expected value.
|
|
344
352
|
*/
|
|
345
353
|
shouldHaveValue(value) {
|
|
346
|
-
return this.
|
|
354
|
+
return this._pushAssertion('have.value', [value]);
|
|
347
355
|
}
|
|
348
356
|
/**
|
|
349
357
|
* Asserts that the target input element does not have the expected value.
|
|
350
358
|
*/
|
|
351
359
|
shouldNotHaveValue(value) {
|
|
352
|
-
return this.
|
|
360
|
+
return this._pushAssertion('not.have.value', [value]);
|
|
353
361
|
}
|
|
354
362
|
/**
|
|
355
363
|
* Asserts that the target input element's value contains the given substring.
|
|
356
364
|
*/
|
|
357
365
|
shouldContainValue(substring) {
|
|
358
|
-
return this.
|
|
366
|
+
return this._pushAssertion('contain.value', [substring]);
|
|
359
367
|
}
|
|
360
368
|
/**
|
|
361
369
|
* Asserts that the target input element's value does not contain the given substring.
|
|
362
370
|
*/
|
|
363
371
|
shouldNotContainValue(substring) {
|
|
364
|
-
return this.
|
|
372
|
+
return this._pushAssertion('not.contain.value', [substring]);
|
|
365
373
|
}
|
|
366
374
|
/**
|
|
367
375
|
* Asserts that the target element has the specified HTML attribute and optional value.
|
|
368
376
|
*/
|
|
369
377
|
shouldHaveAttribute(name, value) {
|
|
370
|
-
return value !== undefined
|
|
378
|
+
return value !== undefined
|
|
379
|
+
? this._pushAssertion('have.attr', [name, value])
|
|
380
|
+
: this._pushAssertion('have.attr', [name]);
|
|
371
381
|
}
|
|
372
382
|
/**
|
|
373
383
|
* Asserts that the target element does not have the specified HTML attribute.
|
|
374
384
|
*/
|
|
375
385
|
shouldNotHaveAttribute(name) {
|
|
376
|
-
return this.
|
|
386
|
+
return this._pushAssertion('not.have.attr', [name]);
|
|
377
387
|
}
|
|
378
388
|
/**
|
|
379
389
|
* Asserts that the target element has the specified CSS class.
|
|
380
390
|
*/
|
|
381
391
|
shouldHaveClass(className) {
|
|
382
|
-
return this.
|
|
392
|
+
return this._pushAssertion('have.class', [className]);
|
|
383
393
|
}
|
|
384
394
|
/**
|
|
385
395
|
* Asserts that the target element does not have the specified CSS class.
|
|
386
396
|
*/
|
|
387
397
|
shouldNotHaveClass(className) {
|
|
388
|
-
return this.
|
|
398
|
+
return this._pushAssertion('not.have.class', [className]);
|
|
389
399
|
}
|
|
390
400
|
/**
|
|
391
401
|
* Asserts that the target element has the specified computed CSS property value.
|
|
392
402
|
*/
|
|
393
403
|
shouldHaveCss(property, value) {
|
|
394
|
-
return this.
|
|
404
|
+
return this._pushAssertion('have.css', [property, value]);
|
|
395
405
|
}
|
|
396
406
|
/**
|
|
397
407
|
* Asserts that the target element does not have the specified computed CSS property value.
|
|
398
408
|
*/
|
|
399
409
|
shouldNotHaveCss(property, value) {
|
|
400
|
-
return this.
|
|
401
|
-
}
|
|
402
|
-
should(a, b, ...rest) {
|
|
403
|
-
const isFirstArgMatcher = typeof a === 'string' &&
|
|
404
|
-
(a.includes('.') ||
|
|
405
|
-
a.includes('exist') ||
|
|
406
|
-
a.includes('visible') ||
|
|
407
|
-
a.includes('clickable') ||
|
|
408
|
-
a.includes('focused') ||
|
|
409
|
-
a.includes('enabled') ||
|
|
410
|
-
a.includes('disabled') ||
|
|
411
|
-
a.includes('selected') ||
|
|
412
|
-
a.includes('checked'));
|
|
413
|
-
if (b !== undefined && !isFirstArgMatcher) {
|
|
414
|
-
// Form: should(target, matcher, ...args)
|
|
415
|
-
this._assertions.push({
|
|
416
|
-
target: a,
|
|
417
|
-
matcher: b,
|
|
418
|
-
args: rest,
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
else {
|
|
422
|
-
// Form: should(matcher, ...args) -> on current target
|
|
423
|
-
this._assertions.push({
|
|
424
|
-
target: this._target,
|
|
425
|
-
matcher: a,
|
|
426
|
-
args: b !== undefined ? [b, ...rest] : rest,
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
return this;
|
|
410
|
+
return this._pushAssertion('not.have.css', [property, value]);
|
|
430
411
|
}
|
|
431
412
|
// --- Execution when awaited ---
|
|
432
413
|
/**
|
package/dist/spectra.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { MockHandle, InterceptRule } from './intercept/index.js';
|
|
|
15
15
|
* await Spectra.get("#username").type("admin");
|
|
16
16
|
*
|
|
17
17
|
* // Collection assertion
|
|
18
|
-
* await Spectra.getAll(".item").
|
|
18
|
+
* await Spectra.getAll(".item").shouldHaveLength(5);
|
|
19
19
|
*
|
|
20
20
|
* // Mobile touch swipe
|
|
21
21
|
* await Spectra.swipe({ direction: "left", distance: 350 });
|
|
@@ -29,7 +29,7 @@ export declare class SpectraStatic {
|
|
|
29
29
|
* @example
|
|
30
30
|
* ```ts
|
|
31
31
|
* await Spectra.get("#login-btn").click();
|
|
32
|
-
* await Spectra.get(LoginPage.submitButton).
|
|
32
|
+
* await Spectra.get(LoginPage.submitButton).shouldBeVisible();
|
|
33
33
|
* ```
|
|
34
34
|
* @returns `SingleElementRunner` for chaining actions and assertions.
|
|
35
35
|
*/
|
|
@@ -40,7 +40,7 @@ export declare class SpectraStatic {
|
|
|
40
40
|
* @param selector - Selector string matching multiple elements.
|
|
41
41
|
* @example
|
|
42
42
|
* ```ts
|
|
43
|
-
* await Spectra.getAll(".product-card").
|
|
43
|
+
* await Spectra.getAll(".product-card").shouldHaveLengthGreaterThan(0);
|
|
44
44
|
* await Spectra.getAll("li.tab").first().click();
|
|
45
45
|
* ```
|
|
46
46
|
* @returns `MultiElementRunner` for collection assertions and indexing.
|
package/dist/spectra.js
CHANGED
|
@@ -16,7 +16,7 @@ import { trackCommand } from './reporter.js';
|
|
|
16
16
|
* await Spectra.get("#username").type("admin");
|
|
17
17
|
*
|
|
18
18
|
* // Collection assertion
|
|
19
|
-
* await Spectra.getAll(".item").
|
|
19
|
+
* await Spectra.getAll(".item").shouldHaveLength(5);
|
|
20
20
|
*
|
|
21
21
|
* // Mobile touch swipe
|
|
22
22
|
* await Spectra.swipe({ direction: "left", distance: 350 });
|
|
@@ -30,7 +30,7 @@ export class SpectraStatic {
|
|
|
30
30
|
* @example
|
|
31
31
|
* ```ts
|
|
32
32
|
* await Spectra.get("#login-btn").click();
|
|
33
|
-
* await Spectra.get(LoginPage.submitButton).
|
|
33
|
+
* await Spectra.get(LoginPage.submitButton).shouldBeVisible();
|
|
34
34
|
* ```
|
|
35
35
|
* @returns `SingleElementRunner` for chaining actions and assertions.
|
|
36
36
|
*/
|
|
@@ -43,7 +43,7 @@ export class SpectraStatic {
|
|
|
43
43
|
* @param selector - Selector string matching multiple elements.
|
|
44
44
|
* @example
|
|
45
45
|
* ```ts
|
|
46
|
-
* await Spectra.getAll(".product-card").
|
|
46
|
+
* await Spectra.getAll(".product-card").shouldHaveLengthGreaterThan(0);
|
|
47
47
|
* await Spectra.getAll("li.tab").first().click();
|
|
48
48
|
* ```
|
|
49
49
|
* @returns `MultiElementRunner` for collection assertions and indexing.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testspectra/matchers",
|
|
3
|
-
"version": "1.1.8-rc.
|
|
3
|
+
"version": "1.1.8-rc.30",
|
|
4
4
|
"description": "Canonical TypeScript contracts and ambient type definitions for TestSpectra",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,16 +11,15 @@
|
|
|
11
11
|
"default": "./dist/index.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc",
|
|
16
|
-
"watch": "tsc -w",
|
|
17
|
-
"typecheck": "tsc --noEmit",
|
|
18
|
-
"prepublishOnly": "npm run build"
|
|
19
|
-
},
|
|
20
14
|
"devDependencies": {
|
|
21
|
-
"@types/node": "
|
|
22
|
-
"typescript": "
|
|
15
|
+
"@types/node": "^20.14.0",
|
|
16
|
+
"typescript": "^5.6.3"
|
|
23
17
|
},
|
|
24
18
|
"type": "module",
|
|
25
|
-
"license": "SEE LICENSE IN LICENSE.md"
|
|
26
|
-
|
|
19
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"watch": "tsc -w",
|
|
23
|
+
"typecheck": "tsc --noEmit"
|
|
24
|
+
}
|
|
25
|
+
}
|