@testspectra/skills 1.3.2 → 1.3.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.
|
@@ -35,6 +35,27 @@ interface MockHandle {
|
|
|
35
35
|
readonly callCount: number;
|
|
36
36
|
readonly calls: InterceptedRequest[];
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
interface InterceptedRequest {
|
|
40
|
+
url: string;
|
|
41
|
+
method: string;
|
|
42
|
+
headers?: Record<string, string>;
|
|
43
|
+
postData?: string; // the request body
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
A function `response` runs for each matching request and may forward it, so the real server
|
|
48
|
+
answers late (the page waits `delayMs` for the reply):
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
await Spectra.intercept({
|
|
52
|
+
url: '**/api/v1/brands/*',
|
|
53
|
+
method: 'PATCH',
|
|
54
|
+
response: async (request) => {
|
|
55
|
+
const reply = await fetch(request.url, { method: 'PATCH', headers: { 'content-type': 'application/json' }, body: request.postData });
|
|
56
|
+
return { status: reply.status, body: await reply.text(), delayMs: 3000 };
|
|
57
|
+
},
|
|
58
|
+
});
|
|
38
59
|
```
|
|
39
60
|
|
|
40
61
|
`Spectra.intercept(rule)` is `async` and returns a `MockHandle` — always `await` it before
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testspectra/skills",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
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",
|
|
@@ -35,6 +35,27 @@ interface MockHandle {
|
|
|
35
35
|
readonly callCount: number;
|
|
36
36
|
readonly calls: InterceptedRequest[];
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
interface InterceptedRequest {
|
|
40
|
+
url: string;
|
|
41
|
+
method: string;
|
|
42
|
+
headers?: Record<string, string>;
|
|
43
|
+
postData?: string; // the request body
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
A function `response` runs for each matching request and may forward it, so the real server
|
|
48
|
+
answers late (the page waits `delayMs` for the reply):
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
await Spectra.intercept({
|
|
52
|
+
url: '**/api/v1/brands/*',
|
|
53
|
+
method: 'PATCH',
|
|
54
|
+
response: async (request) => {
|
|
55
|
+
const reply = await fetch(request.url, { method: 'PATCH', headers: { 'content-type': 'application/json' }, body: request.postData });
|
|
56
|
+
return { status: reply.status, body: await reply.text(), delayMs: 3000 };
|
|
57
|
+
},
|
|
58
|
+
});
|
|
38
59
|
```
|
|
39
60
|
|
|
40
61
|
`Spectra.intercept(rule)` is `async` and returns a `MockHandle` — always `await` it before
|