@testspectra/skills 1.2.44 → 1.2.46

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.
@@ -152,6 +152,18 @@ answered after the spy is made count. `requestBody` and `responseBody` are cut t
152
152
  expect a part of a long body as a string. `responseBody` is recorded for text Fetch/XHR responses
153
153
  only; any other fails the assertion saying why.
154
154
 
155
+ A live update over SSE (`new EventSource(url)`, web e2e): spy on the stream's URL before the page
156
+ opens it, then assert the event and what the UI made of it. `data` matches as a substring (string)
157
+ or a JSON subset (object); `event` is the event's name (`message` when the server names none):
158
+
159
+ ```typescript
160
+ const stream = await Spectra.spy('**/api/live-updates**');
161
+ await Spectra.browser.url('/settings');
162
+ await stream.shouldHaveReceivedEvent({ event: 'settings-updated', data: { key: 'timezone' } });
163
+ await SettingsPage.timezone.shouldHaveText('Asia/Jakarta');
164
+ stream.serverEvents(); // [{ event, id, data, receivedAt }]
165
+ ```
166
+
155
167
  Intercept with `delayMs` only when the step reads the page while the request is in flight; then
156
168
  `waitForResponse()` before checking the result:
157
169
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testspectra/skills",
3
- "version": "1.2.44",
3
+ "version": "1.2.46",
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",
@@ -152,6 +152,18 @@ answered after the spy is made count. `requestBody` and `responseBody` are cut t
152
152
  expect a part of a long body as a string. `responseBody` is recorded for text Fetch/XHR responses
153
153
  only; any other fails the assertion saying why.
154
154
 
155
+ A live update over SSE (`new EventSource(url)`, web e2e): spy on the stream's URL before the page
156
+ opens it, then assert the event and what the UI made of it. `data` matches as a substring (string)
157
+ or a JSON subset (object); `event` is the event's name (`message` when the server names none):
158
+
159
+ ```typescript
160
+ const stream = await Spectra.spy('**/api/live-updates**');
161
+ await Spectra.browser.url('/settings');
162
+ await stream.shouldHaveReceivedEvent({ event: 'settings-updated', data: { key: 'timezone' } });
163
+ await SettingsPage.timezone.shouldHaveText('Asia/Jakarta');
164
+ stream.serverEvents(); // [{ event, id, data, receivedAt }]
165
+ ```
166
+
155
167
  Intercept with `delayMs` only when the step reads the page while the request is in flight; then
156
168
  `waitForResponse()` before checking the result:
157
169