@testspectra/skills 1.3.21 → 1.3.22
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.
|
@@ -140,33 +140,43 @@ collection carry the scope forward too. No behavior difference on web vs. Androi
|
|
|
140
140
|
|
|
141
141
|
## 5. Global `Spectra.*` Commands
|
|
142
142
|
|
|
143
|
-
| Category | Syntax
|
|
144
|
-
| :------------- |
|
|
145
|
-
| Navigation | `await Spectra.navigate("/login")` / `.back()` / `.forward()` / `.refresh()`
|
|
143
|
+
| Category | Syntax |
|
|
144
|
+
| :------------- | :----------------------------------------------------------------------------------------------------------------------------------- |
|
|
145
|
+
| Navigation | `await Spectra.navigate("/login")` / `.back()` / `.forward()` / `.refresh()` |
|
|
146
146
|
| Step group | `await Spectra.step('TC-12: Sort by name', async () => { … })` — nests the actions under the spec's step title; returns `fn`'s value |
|
|
147
|
-
| Element query | `Spectra.get(selector)` / `Spectra.getAll(selector)` — chain `.get()`/`.getAll()` on the result to scope a lookup, see section 4
|
|
148
|
-
| Focus | `await Spectra.focus(target)` / `await Spectra.blur(target)`
|
|
149
|
-
| Coordinate | `await Spectra.clickAt(x, y)` — absolute viewport click
|
|
150
|
-
| Window | `await Spectra.setViewport(1920, 1080)`
|
|
151
|
-
| Timing | `await Spectra.wait(1000)`
|
|
152
|
-
| Keyboard | `await Spectra.pressKey("Enter")`
|
|
153
|
-
| Scroll | `await Spectra.scroll({ direction: "down", pixels: 400 })`
|
|
154
|
-
| Mobile gesture | `await Spectra.swipe({ direction: "left", distance: 300 })`
|
|
155
|
-
| Network mock | `const mock = await Spectra.intercept({ url, method, response })` — see the `network-interception` skill
|
|
147
|
+
| Element query | `Spectra.get(selector)` / `Spectra.getAll(selector)` — chain `.get()`/`.getAll()` on the result to scope a lookup, see section 4 |
|
|
148
|
+
| Focus | `await Spectra.focus(target)` / `await Spectra.blur(target)` |
|
|
149
|
+
| Coordinate | `await Spectra.clickAt(x, y)` — absolute viewport click |
|
|
150
|
+
| Window | `await Spectra.setViewport(1920, 1080)` |
|
|
151
|
+
| Timing | `await Spectra.wait(1000)` |
|
|
152
|
+
| Keyboard | `await Spectra.pressKey("Enter")` |
|
|
153
|
+
| Scroll | `await Spectra.scroll({ direction: "down", pixels: 400 })` |
|
|
154
|
+
| Mobile gesture | `await Spectra.swipe({ direction: "left", distance: 300 })` |
|
|
155
|
+
| Network mock | `const mock = await Spectra.intercept({ url, method, response })` — see the `network-interception` skill |
|
|
156
156
|
|
|
157
157
|
## 6. `Spectra.browser.*` — Browser/Context Level
|
|
158
158
|
|
|
159
|
-
| Syntax
|
|
160
|
-
|
|
|
161
|
-
| `await Spectra.browser.clickAt(x, y)`
|
|
162
|
-
| `await Spectra.browser.clearCookies()`
|
|
163
|
-
| `await Spectra.browser.clearLocalStorage()`
|
|
164
|
-
| `await Spectra.browser.shouldHaveUrl(url)`
|
|
165
|
-
| `await Spectra.browser.shouldContainUrl(substr)`
|
|
166
|
-
| `await Spectra.browser.shouldHaveTitle(title)`
|
|
167
|
-
| `await Spectra.browser.shouldContainTitle(substr)`
|
|
168
|
-
| `await Spectra.browser.shouldBeLoaded()`
|
|
169
|
-
| `await Spectra.browser.shouldHaveNoConsoleErrors()`
|
|
159
|
+
| Syntax | Purpose |
|
|
160
|
+
| :--------------------------------------------------- | :----------------------------------------------------------------- |
|
|
161
|
+
| `await Spectra.browser.clickAt(x, y)` | Click at viewport coordinates |
|
|
162
|
+
| `await Spectra.browser.clearCookies()` | Clear all cookies |
|
|
163
|
+
| `await Spectra.browser.clearLocalStorage()` | Clear localStorage |
|
|
164
|
+
| `await Spectra.browser.shouldHaveUrl(url)` | Assert exact URL |
|
|
165
|
+
| `await Spectra.browser.shouldContainUrl(substr)` | Assert URL contains substring |
|
|
166
|
+
| `await Spectra.browser.shouldHaveTitle(title)` | Assert exact document title |
|
|
167
|
+
| `await Spectra.browser.shouldContainTitle(substr)` | Assert title contains substring |
|
|
168
|
+
| `await Spectra.browser.shouldBeLoaded()` | Assert page fully loaded |
|
|
169
|
+
| `await Spectra.browser.shouldHaveNoConsoleErrors()` | Assert zero console errors |
|
|
170
|
+
| `await Spectra.browser.openTab(url?)` | Open a tab in the same session and act on it |
|
|
171
|
+
| `await Spectra.browser.switchToTab(index)` | Act on tab `index` (0 = first; tabs the app opens follow in order) |
|
|
172
|
+
| `await Spectra.browser.closeTab()` | Close the active tab, act on the one before |
|
|
173
|
+
| `await Spectra.browser.shouldHaveTabCount(n)` | Assert `n` tabs open |
|
|
174
|
+
| `await Spectra.browser.installClock()` | Fake page clock, before the page loads |
|
|
175
|
+
| `await Spectra.browser.advanceClock(ms)` | Jump the clock; timers that fall due run |
|
|
176
|
+
| `await Spectra.browser.shouldHaveOpenedDialog(msg?)` | Assert a JS dialog opened (each is answered as it opens) |
|
|
177
|
+
| `await Spectra.browser.shouldNotHaveOpenedDialog()` | Assert none opened, nor opens for 500ms |
|
|
178
|
+
|
|
179
|
+
Tabs, the clock and dialogs are web only, and reset when the next test case starts: one tab, no fake clock, no dialogs recorded. Install the clock before `Spectra.navigate`: timers the current document started earlier do not move.
|
|
170
180
|
|
|
171
181
|
---
|
|
172
182
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testspectra/skills",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.22",
|
|
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",
|
|
@@ -140,33 +140,43 @@ collection carry the scope forward too. No behavior difference on web vs. Androi
|
|
|
140
140
|
|
|
141
141
|
## 5. Global `Spectra.*` Commands
|
|
142
142
|
|
|
143
|
-
| Category | Syntax
|
|
144
|
-
| :------------- |
|
|
145
|
-
| Navigation | `await Spectra.navigate("/login")` / `.back()` / `.forward()` / `.refresh()`
|
|
143
|
+
| Category | Syntax |
|
|
144
|
+
| :------------- | :----------------------------------------------------------------------------------------------------------------------------------- |
|
|
145
|
+
| Navigation | `await Spectra.navigate("/login")` / `.back()` / `.forward()` / `.refresh()` |
|
|
146
146
|
| Step group | `await Spectra.step('TC-12: Sort by name', async () => { … })` — nests the actions under the spec's step title; returns `fn`'s value |
|
|
147
|
-
| Element query | `Spectra.get(selector)` / `Spectra.getAll(selector)` — chain `.get()`/`.getAll()` on the result to scope a lookup, see section 4
|
|
148
|
-
| Focus | `await Spectra.focus(target)` / `await Spectra.blur(target)`
|
|
149
|
-
| Coordinate | `await Spectra.clickAt(x, y)` — absolute viewport click
|
|
150
|
-
| Window | `await Spectra.setViewport(1920, 1080)`
|
|
151
|
-
| Timing | `await Spectra.wait(1000)`
|
|
152
|
-
| Keyboard | `await Spectra.pressKey("Enter")`
|
|
153
|
-
| Scroll | `await Spectra.scroll({ direction: "down", pixels: 400 })`
|
|
154
|
-
| Mobile gesture | `await Spectra.swipe({ direction: "left", distance: 300 })`
|
|
155
|
-
| Network mock | `const mock = await Spectra.intercept({ url, method, response })` — see the `network-interception` skill
|
|
147
|
+
| Element query | `Spectra.get(selector)` / `Spectra.getAll(selector)` — chain `.get()`/`.getAll()` on the result to scope a lookup, see section 4 |
|
|
148
|
+
| Focus | `await Spectra.focus(target)` / `await Spectra.blur(target)` |
|
|
149
|
+
| Coordinate | `await Spectra.clickAt(x, y)` — absolute viewport click |
|
|
150
|
+
| Window | `await Spectra.setViewport(1920, 1080)` |
|
|
151
|
+
| Timing | `await Spectra.wait(1000)` |
|
|
152
|
+
| Keyboard | `await Spectra.pressKey("Enter")` |
|
|
153
|
+
| Scroll | `await Spectra.scroll({ direction: "down", pixels: 400 })` |
|
|
154
|
+
| Mobile gesture | `await Spectra.swipe({ direction: "left", distance: 300 })` |
|
|
155
|
+
| Network mock | `const mock = await Spectra.intercept({ url, method, response })` — see the `network-interception` skill |
|
|
156
156
|
|
|
157
157
|
## 6. `Spectra.browser.*` — Browser/Context Level
|
|
158
158
|
|
|
159
|
-
| Syntax
|
|
160
|
-
|
|
|
161
|
-
| `await Spectra.browser.clickAt(x, y)`
|
|
162
|
-
| `await Spectra.browser.clearCookies()`
|
|
163
|
-
| `await Spectra.browser.clearLocalStorage()`
|
|
164
|
-
| `await Spectra.browser.shouldHaveUrl(url)`
|
|
165
|
-
| `await Spectra.browser.shouldContainUrl(substr)`
|
|
166
|
-
| `await Spectra.browser.shouldHaveTitle(title)`
|
|
167
|
-
| `await Spectra.browser.shouldContainTitle(substr)`
|
|
168
|
-
| `await Spectra.browser.shouldBeLoaded()`
|
|
169
|
-
| `await Spectra.browser.shouldHaveNoConsoleErrors()`
|
|
159
|
+
| Syntax | Purpose |
|
|
160
|
+
| :--------------------------------------------------- | :----------------------------------------------------------------- |
|
|
161
|
+
| `await Spectra.browser.clickAt(x, y)` | Click at viewport coordinates |
|
|
162
|
+
| `await Spectra.browser.clearCookies()` | Clear all cookies |
|
|
163
|
+
| `await Spectra.browser.clearLocalStorage()` | Clear localStorage |
|
|
164
|
+
| `await Spectra.browser.shouldHaveUrl(url)` | Assert exact URL |
|
|
165
|
+
| `await Spectra.browser.shouldContainUrl(substr)` | Assert URL contains substring |
|
|
166
|
+
| `await Spectra.browser.shouldHaveTitle(title)` | Assert exact document title |
|
|
167
|
+
| `await Spectra.browser.shouldContainTitle(substr)` | Assert title contains substring |
|
|
168
|
+
| `await Spectra.browser.shouldBeLoaded()` | Assert page fully loaded |
|
|
169
|
+
| `await Spectra.browser.shouldHaveNoConsoleErrors()` | Assert zero console errors |
|
|
170
|
+
| `await Spectra.browser.openTab(url?)` | Open a tab in the same session and act on it |
|
|
171
|
+
| `await Spectra.browser.switchToTab(index)` | Act on tab `index` (0 = first; tabs the app opens follow in order) |
|
|
172
|
+
| `await Spectra.browser.closeTab()` | Close the active tab, act on the one before |
|
|
173
|
+
| `await Spectra.browser.shouldHaveTabCount(n)` | Assert `n` tabs open |
|
|
174
|
+
| `await Spectra.browser.installClock()` | Fake page clock, before the page loads |
|
|
175
|
+
| `await Spectra.browser.advanceClock(ms)` | Jump the clock; timers that fall due run |
|
|
176
|
+
| `await Spectra.browser.shouldHaveOpenedDialog(msg?)` | Assert a JS dialog opened (each is answered as it opens) |
|
|
177
|
+
| `await Spectra.browser.shouldNotHaveOpenedDialog()` | Assert none opened, nor opens for 500ms |
|
|
178
|
+
|
|
179
|
+
Tabs, the clock and dialogs are web only, and reset when the next test case starts: one tab, no fake clock, no dialogs recorded. Install the clock before `Spectra.navigate`: timers the current document started earlier do not move.
|
|
170
180
|
|
|
171
181
|
---
|
|
172
182
|
|