@testspectra/skills 1.2.31 → 1.2.32
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.
|
@@ -173,7 +173,12 @@ collection carry the scope forward too. No behavior difference on web vs. Androi
|
|
|
173
173
|
| `await Spectra.browser.openTab(url?, { isolated: true })` | Open a tab as a second browser: own cookies and storage |
|
|
174
174
|
| `await Spectra.browser.switchToTab(index)` | Act on tab `index` (0 = first; tabs the app opens follow in order) |
|
|
175
175
|
| `await Spectra.browser.closeTab()` | Close the active tab (any but the last), act on the one before |
|
|
176
|
+
| `await Spectra.browser.openTab({ userAgent })` | Open a tab whose user agent is `userAgent` (also with `isolated`) |
|
|
176
177
|
| `await Spectra.browser.shouldHaveTabCount(n)` | Assert `n` tabs open |
|
|
178
|
+
| `await Spectra.browser.getClipboardText()` | Read the page clipboard (origin granted `clipboardReadWrite`) |
|
|
179
|
+
| `await Spectra.browser.shouldHaveClipboardText(text)` | Assert the clipboard text, polling |
|
|
180
|
+
| `await Spectra.browser.getPageLoadCount(tab?)` | Loads of a tab since the test case began / the tab attached |
|
|
181
|
+
| `await Spectra.browser.shouldHavePageLoadCount(n, { tab? })` | Assert a tab's load count: only the refreshed tab grew |
|
|
177
182
|
| `await Spectra.browser.installClock()` | Fake page clock, before the page loads |
|
|
178
183
|
| `await Spectra.browser.advanceClock(ms)` | Jump the clock; timers that fall due run |
|
|
179
184
|
| `await Spectra.browser.shouldHaveOpenedDialog(msg?)` | Assert a JS dialog opened (each is answered as it opens) |
|
|
@@ -35,6 +35,7 @@ interface MockHandle {
|
|
|
35
35
|
shouldHaveCallCount(count: number, options?: { timeout?: number }): Promise<void>; // polls; 0 proves no request went out
|
|
36
36
|
shouldHaveStatus(status: number, options?: { count?: number; timeout?: number }): Promise<void>; // default: the last answer
|
|
37
37
|
shouldHaveRequestBody(expected: string | object, options?: { timeout?: number }): Promise<void>; // object: JSON subset; string: substring
|
|
38
|
+
shouldHaveResponseBody(expected: string | object, options?: { count?: number; timeout?: number }): Promise<void>; // the answer's body; default: the last
|
|
38
39
|
readonly callCount: number;
|
|
39
40
|
readonly calls: InterceptedRequest[];
|
|
40
41
|
}
|
|
@@ -141,12 +142,15 @@ await OtpPage.boxes.setValue('000000');
|
|
|
141
142
|
await verify.waitForResponse(); // default timeout: the implicit wait
|
|
142
143
|
await verify.shouldHaveStatus(422);
|
|
143
144
|
await verify.shouldHaveRequestBody({ code: '000000' });
|
|
145
|
+
await verify.shouldHaveResponseBody({ reason: 'invalid_code' }); // the response body: JSON subset or substring
|
|
144
146
|
await OtpPage.error.shouldHaveText('Invalid code');
|
|
145
147
|
```
|
|
146
148
|
|
|
147
149
|
The spy handle has the same `waitForResponse` / `shouldHaveCallCount` / `shouldHaveStatus` /
|
|
148
|
-
`shouldHaveRequestBody` / `callCount` / `calls` as above. Only requests
|
|
149
|
-
made count. `requestBody`
|
|
150
|
+
`shouldHaveRequestBody` / `shouldHaveResponseBody` / `callCount` / `calls` as above. Only requests
|
|
151
|
+
answered after the spy is made count. `requestBody` and `responseBody` are cut to 500 characters:
|
|
152
|
+
expect a part of a long body as a string. `responseBody` is recorded for text Fetch/XHR responses
|
|
153
|
+
only; any other fails the assertion saying why.
|
|
150
154
|
|
|
151
155
|
Intercept with `delayMs` only when the step reads the page while the request is in flight; then
|
|
152
156
|
`waitForResponse()` before checking the result:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testspectra/skills",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.32",
|
|
4
4
|
"description": "Installer & manager for modular AI agent skills that standardize TestSpectra script authoring (specs, page objects, steps, actions, hooks, fixtures, matchers)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -173,7 +173,12 @@ collection carry the scope forward too. No behavior difference on web vs. Androi
|
|
|
173
173
|
| `await Spectra.browser.openTab(url?, { isolated: true })` | Open a tab as a second browser: own cookies and storage |
|
|
174
174
|
| `await Spectra.browser.switchToTab(index)` | Act on tab `index` (0 = first; tabs the app opens follow in order) |
|
|
175
175
|
| `await Spectra.browser.closeTab()` | Close the active tab (any but the last), act on the one before |
|
|
176
|
+
| `await Spectra.browser.openTab({ userAgent })` | Open a tab whose user agent is `userAgent` (also with `isolated`) |
|
|
176
177
|
| `await Spectra.browser.shouldHaveTabCount(n)` | Assert `n` tabs open |
|
|
178
|
+
| `await Spectra.browser.getClipboardText()` | Read the page clipboard (origin granted `clipboardReadWrite`) |
|
|
179
|
+
| `await Spectra.browser.shouldHaveClipboardText(text)` | Assert the clipboard text, polling |
|
|
180
|
+
| `await Spectra.browser.getPageLoadCount(tab?)` | Loads of a tab since the test case began / the tab attached |
|
|
181
|
+
| `await Spectra.browser.shouldHavePageLoadCount(n, { tab? })` | Assert a tab's load count: only the refreshed tab grew |
|
|
177
182
|
| `await Spectra.browser.installClock()` | Fake page clock, before the page loads |
|
|
178
183
|
| `await Spectra.browser.advanceClock(ms)` | Jump the clock; timers that fall due run |
|
|
179
184
|
| `await Spectra.browser.shouldHaveOpenedDialog(msg?)` | Assert a JS dialog opened (each is answered as it opens) |
|
|
@@ -35,6 +35,7 @@ interface MockHandle {
|
|
|
35
35
|
shouldHaveCallCount(count: number, options?: { timeout?: number }): Promise<void>; // polls; 0 proves no request went out
|
|
36
36
|
shouldHaveStatus(status: number, options?: { count?: number; timeout?: number }): Promise<void>; // default: the last answer
|
|
37
37
|
shouldHaveRequestBody(expected: string | object, options?: { timeout?: number }): Promise<void>; // object: JSON subset; string: substring
|
|
38
|
+
shouldHaveResponseBody(expected: string | object, options?: { count?: number; timeout?: number }): Promise<void>; // the answer's body; default: the last
|
|
38
39
|
readonly callCount: number;
|
|
39
40
|
readonly calls: InterceptedRequest[];
|
|
40
41
|
}
|
|
@@ -141,12 +142,15 @@ await OtpPage.boxes.setValue('000000');
|
|
|
141
142
|
await verify.waitForResponse(); // default timeout: the implicit wait
|
|
142
143
|
await verify.shouldHaveStatus(422);
|
|
143
144
|
await verify.shouldHaveRequestBody({ code: '000000' });
|
|
145
|
+
await verify.shouldHaveResponseBody({ reason: 'invalid_code' }); // the response body: JSON subset or substring
|
|
144
146
|
await OtpPage.error.shouldHaveText('Invalid code');
|
|
145
147
|
```
|
|
146
148
|
|
|
147
149
|
The spy handle has the same `waitForResponse` / `shouldHaveCallCount` / `shouldHaveStatus` /
|
|
148
|
-
`shouldHaveRequestBody` / `callCount` / `calls` as above. Only requests
|
|
149
|
-
made count. `requestBody`
|
|
150
|
+
`shouldHaveRequestBody` / `shouldHaveResponseBody` / `callCount` / `calls` as above. Only requests
|
|
151
|
+
answered after the spy is made count. `requestBody` and `responseBody` are cut to 500 characters:
|
|
152
|
+
expect a part of a long body as a string. `responseBody` is recorded for text Fetch/XHR responses
|
|
153
|
+
only; any other fails the assertion saying why.
|
|
150
154
|
|
|
151
155
|
Intercept with `delayMs` only when the step reads the page while the request is in flight; then
|
|
152
156
|
`waitForResponse()` before checking the result:
|