saffron-ai 1.2.0 → 1.2.1
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/CHANGELOG.md +191 -1
- package/README.md +4 -4
- package/dist-pkg/cli.js +301 -302
- package/package.json +22 -7
- package/skills/saffron/references/api.md +6 -4
- package/skills/saffron/references/config.md +6 -5
- package/templates/playwright/saffron-helpers.ts +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,189 @@ the VS Code extension (`ChathurangaJayasinghe.saffron-vscode`) and the
|
|
|
5
5
|
JetBrains plugin (`ai.saffron.jetbrains`). Dates are publish dates. Each
|
|
6
6
|
release heading names its main feature: `## <version>: <title>`.
|
|
7
7
|
|
|
8
|
-
## 1.2.
|
|
8
|
+
## 1.2.1: Sturdier recordings, and API keys for Codex and Antigravity
|
|
9
|
+
|
|
10
|
+
Released 2026-10-28.
|
|
11
|
+
|
|
12
|
+
Runner
|
|
13
|
+
|
|
14
|
+
- **After a review of the unreleased work.**
|
|
15
|
+
- An Outline row's date that the page spells out (`Friday, October 30,
|
|
16
|
+
2026`) is recorded as that row's own date token, so another row never
|
|
17
|
+
replays on it and the same row follows the day without recording
|
|
18
|
+
again. A day the page works out from it (a checkout two days on)
|
|
19
|
+
follows the row too. A recording that kept the date as text records
|
|
20
|
+
once more. Such a recording is schema version 11, which 1.2.0 refuses.
|
|
21
|
+
Another row with a different date there fails with its reason; it
|
|
22
|
+
needs a Scenario of its own. A day shown in a step that does not use
|
|
23
|
+
the column (today's date in a banner) no longer ties the Outline to
|
|
24
|
+
one row.
|
|
25
|
+
- A date the scenario writes itself (`2026-10-30`) stays that date when
|
|
26
|
+
the page spells it otherwise ("Friday, October 30, 2026"), instead of
|
|
27
|
+
moving with the calendar from the next day on.
|
|
28
|
+
- A token used as a key in a whole-JSON Examples column is refused
|
|
29
|
+
instead of being sent as a broken field name.
|
|
30
|
+
- `saffron author` makes the checks a recording makes before it starts
|
|
31
|
+
the agent, except agy's rules for Saffron's tools, which it does not
|
|
32
|
+
use: with `antigravityApiKey` set and no key it refuses instead
|
|
33
|
+
of signing in with the Google login, and a failed session prints its
|
|
34
|
+
reason instead of a stack trace.
|
|
35
|
+
- A token outside any string in a whole-JSON Examples column
|
|
36
|
+
(`{"qty": {captured:count}}`) is a value of its own, so a secret
|
|
37
|
+
beside it can no longer add a field. A cell that is neither JSON nor
|
|
38
|
+
one whole token is refused instead of being filled in first. The same
|
|
39
|
+
holds in exported tests.
|
|
40
|
+
- Captured values in a proposal mask a credential an API handed out.
|
|
41
|
+
- A secret inside a whole-JSON Examples column can no longer rewrite
|
|
42
|
+
the payload.
|
|
43
|
+
- "Should differ" compares references and counts (`ABC-123`,
|
|
44
|
+
`1 night`) as text, refusing only amounts in different currencies or
|
|
45
|
+
a price against a label, and a brief bad reading no longer ends the
|
|
46
|
+
check.
|
|
47
|
+
- A heal that swaps a tick, untick, upload or drag for another input is
|
|
48
|
+
flagged as a behavior change.
|
|
49
|
+
- The sensitivity check gives each check a second, skips a `Then` with
|
|
50
|
+
no check or in a session not yet open, and cannot abort a run. The
|
|
51
|
+
report counts only the proposals it checked.
|
|
52
|
+
- `expectDisabled` is decided by the recorded element, not a fallback.
|
|
53
|
+
- Slashed dates are read in the locale's order, a UK date with its
|
|
54
|
+
weekday becomes a token, and a month the scenario names is not a
|
|
55
|
+
volatile locator.
|
|
56
|
+
- **The npm page says what Saffron is.** The package description no longer
|
|
57
|
+
calls it an AI-fallback test runner, its keywords cover the terms people
|
|
58
|
+
search for, it names its author, and the README names Antigravity among
|
|
59
|
+
the agents.
|
|
60
|
+
- **`prune --json` no longer calls a broken file's recordings orphans.**
|
|
61
|
+
While a feature file fails to parse, prune already deleted nothing, but
|
|
62
|
+
its JSON listed the hidden scenarios' live recordings as orphans. Now
|
|
63
|
+
they are in `orphanScan.ownershipUnknown`, beside the parse `errors`;
|
|
64
|
+
other files' orphans stay in `orphans`, and the JSON has the same shape
|
|
65
|
+
on a healthy project. `saffron status --json` splits them the same way,
|
|
66
|
+
where it listed no orphans at all.
|
|
67
|
+
- **Volatile locators are caught while recording.** A date the agent
|
|
68
|
+
picked that the app spells out (`October 30, 2026`, `30.10.2026`) is
|
|
69
|
+
recorded as a `{date}` token, as ISO dates already were, and a day the
|
|
70
|
+
scenario's own token wrote keeps that token. A generated id in a
|
|
71
|
+
selector, frame or test id, a UUID in a name, or a month heading is
|
|
72
|
+
refused once at `saffron_done` so the agent finds a stable target; what
|
|
73
|
+
is left gets a `volatile locator:` note, and `accept --all` leaves that
|
|
74
|
+
proposal to be accepted by file.
|
|
75
|
+
- **An Examples column can hold a whole JSON payload.** A request whose
|
|
76
|
+
body, or a part of it, is the JSON a column the step names holds is
|
|
77
|
+
recorded as that column, so each row sends its own payload. Before, the
|
|
78
|
+
payload was kept as fixed fields and every other row was refused. The
|
|
79
|
+
proposal names the body each row sends, and a cell that is not JSON fails
|
|
80
|
+
its row by name. Such a recording is schema version 10.
|
|
81
|
+
- **Comparisons compare like with like.** A "should differ" check between
|
|
82
|
+
two amounts compares the numbers, so the same price drawn in another
|
|
83
|
+
format has not changed. Two values of different kinds fail at once and
|
|
84
|
+
say why: `SEK 1,295` against `NOK 1,347` differ by currency alone, and a
|
|
85
|
+
whole button label against a price by its label. `saffron diff` and the
|
|
86
|
+
report show what each capture read in the proof replay beside its step.
|
|
87
|
+
A step that says an element is selectable, available or disabled records
|
|
88
|
+
an enabled or disabled check (`expectEnabled`, `expectDisabled`), where it
|
|
89
|
+
recorded visibility only; such a recording is schema version 9.
|
|
90
|
+
- **Recorded checks must be able to fail.** A proof shows a recording
|
|
91
|
+
replays, not that its checks notice anything. After a proof passes,
|
|
92
|
+
Saffron replays the scenario once more with no AI and runs each `Then`
|
|
93
|
+
on the page as it was just before the action step it follows. A check
|
|
94
|
+
that passes there too gets an `insensitive check:` note (picking the day
|
|
95
|
+
that was already picked, a price compared with a value it always had),
|
|
96
|
+
and `accept --all` leaves that proposal to be accepted by file. The
|
|
97
|
+
report shows "checks proven sensitive in N of M" beside the proofs that
|
|
98
|
+
passed.
|
|
99
|
+
- **Heals keep what the scenario tests.** A heal serves the scenario's
|
|
100
|
+
intent first, then the step's, and the step's wording last: it may change
|
|
101
|
+
how a step is done, never what the scenario exercises. The agent is told
|
|
102
|
+
never to replace typed data with a check of a hint, or a real payment or
|
|
103
|
+
sign-in route with a simulator's button, even when the final `Then`
|
|
104
|
+
passes, and to fail and name a missing prerequisite instead of working
|
|
105
|
+
around it. Saffron checks this itself: a healed step that no longer
|
|
106
|
+
enters, picks or uploads what the committed recording did gets a
|
|
107
|
+
`behavior change:` note naming what it checks instead, and
|
|
108
|
+
`accept --all` leaves that proposal to be accepted by file. A value moved
|
|
109
|
+
to another control (a text field that became a dropdown) is still
|
|
110
|
+
entered and raises no note.
|
|
111
|
+
- **iframes are recorded with their whole scope.** An element in an iframe
|
|
112
|
+
inside another iframe keeps both, and one of several alike iframes
|
|
113
|
+
(previews, cards) keeps its position, so replay acts in the iframe the
|
|
114
|
+
agent used. Before, an iframe picked with `first()` or `nth()` lost its
|
|
115
|
+
position and replay could act in another one, and an element in a nested
|
|
116
|
+
iframe recorded no action at all. Code the recorder cannot read, such as
|
|
117
|
+
an element reached through a variable or an iframe picked by a filter, now
|
|
118
|
+
fails the recording and names the interaction instead of being left out.
|
|
119
|
+
`saffron_assert` takes the same frame forms. A recording with a nested or
|
|
120
|
+
positioned iframe is written as schema version 8, which saffron-ai 1.2.0
|
|
121
|
+
and earlier ask to be updated for; others keep their version.
|
|
122
|
+
- **Codex and Antigravity on an API key.** A machine with no ChatGPT or
|
|
123
|
+
Google login, a CI job say, records and heals with Codex on
|
|
124
|
+
`CODEX_API_KEY` (or `OPENAI_API_KEY`) and with Antigravity on
|
|
125
|
+
`GEMINI_API_KEY` (or `GOOGLE_API_KEY`), billed to that API account. A
|
|
126
|
+
login on the machine wins over a key, so a key set for other tools never
|
|
127
|
+
moves your runs off your plan. Whether there is a login is asked only
|
|
128
|
+
when the first session starts, and only when a key is set, without
|
|
129
|
+
holding up other sessions; only the vendor saying you are not signed in
|
|
130
|
+
counts, so a timeout or a network error keeps the login. The run's first
|
|
131
|
+
line says how sessions will sign in, and the first session says which one
|
|
132
|
+
it used ("Codex: signed in with API key (CODEX_API_KEY)"); a key stored by
|
|
133
|
+
`codex login --with-api-key` reads as one, not as a ChatGPT login.
|
|
134
|
+
`saffron login codex` and `saffron login antigravity` say which sign-in
|
|
135
|
+
sessions will use. An expired login still counts as a login: the session
|
|
136
|
+
it fails says the login won over the key, and how to sign in again or use
|
|
137
|
+
the key. Codex's `forced_login_method` decides alone: a key never counts
|
|
138
|
+
as a sign-in under `"chatgpt"`, `"api"` with no key in the environment
|
|
139
|
+
or stored by `codex login --with-api-key` (a stored ChatGPT login does
|
|
140
|
+
not count) is reported as a missing key, and a refused session names the setting. Antigravity's
|
|
141
|
+
equivalent is `"antigravityApiKey": true` in `saffron.config.json`: the
|
|
142
|
+
key is used even beside an agy login, by every command, and a missing
|
|
143
|
+
key is reported and starts no session. A key reaches the
|
|
144
|
+
vendor alone: an error that quotes it, whole or cut short, shows its
|
|
145
|
+
variable's name, and it is never written into a recording or report.
|
|
146
|
+
Codex on a key is verified live; Antigravity on a key is not yet.
|
|
147
|
+
- **A numeric credential is never kept in a recording.** A login's token
|
|
148
|
+
that is only digits (a one-time code, a PIN) is written as its
|
|
149
|
+
`{captured:name}` in a form field, a multipart part or a JSON number
|
|
150
|
+
wherever it stands, whatever the field is called. Before, a field whose
|
|
151
|
+
name did not name an id kept the value.
|
|
152
|
+
- **An API is named by the words that call it.** The check that the APIs a
|
|
153
|
+
scenario needs are up reads a named API from its recording, or from steps
|
|
154
|
+
that call it one ("the orders API", "the orders service"): "I list orders
|
|
155
|
+
through the default API" no longer waits on a service named `orders`.
|
|
156
|
+
- **A changed contract the API breaks is red.** When a recording is checked
|
|
157
|
+
again against a changed API contract and the API no longer answers as the
|
|
158
|
+
new contract says, the scenario is red and the run exits 1, as before
|
|
159
|
+
1.2.0, with no proposal filed (nothing was recorded again). In 1.2.0 it
|
|
160
|
+
was filed as an unverified proposal and the run passed. One that passes is
|
|
161
|
+
filed for review as before, and its run line says it replayed from the
|
|
162
|
+
recording, not that an agent recorded it. `saffron status` says such a
|
|
163
|
+
recording is checked again on the next run instead of "will re-record",
|
|
164
|
+
and the Saffron skill describes it.
|
|
165
|
+
- **A malformed `{unique:...}` stops the run before it starts.** An
|
|
166
|
+
unclosed token, an empty or invalid name, or one an Examples row fills in
|
|
167
|
+
with an empty cell (`{unique:<id>}`) is named and the run exits 2, as a
|
|
168
|
+
bad `{data:...}` does, instead of costing an agent session per row.
|
|
169
|
+
- **Failure headings name the row's values.** `Check "the customer is on
|
|
170
|
+
the "Gold" plan" failed`, as the detail below it already did.
|
|
171
|
+
- **A form field that is only a number** is written as a captured value's
|
|
172
|
+
token only where its name names an id or the capture, as in a JSON body:
|
|
173
|
+
`quantity=100` beside order 100 stays 100.
|
|
174
|
+
- **A status code with its own reason** names that status whatever
|
|
175
|
+
follows: "expect 409 Conflict and a retry hint".
|
|
176
|
+
|
|
177
|
+
Editors (VS Code extension 0.7.4, JetBrains plugin 0.7.5)
|
|
178
|
+
|
|
179
|
+
- **Proposals Accept All skips are marked.** A proposal with a "behavior
|
|
180
|
+
change:", "insensitive check:" or "volatile locator:" note, or one
|
|
181
|
+
imported from a CI run or not verified, is marked as held (VS Code:
|
|
182
|
+
"held for review"; JetBrains: "held from Accept All").
|
|
183
|
+
- **Orphans while a file fails to parse.** The Orphans view lists the
|
|
184
|
+
other files' orphans and groups the broken file's recordings under
|
|
185
|
+
"Ownership unknown until it parses"; prune waits until it parses. Needs
|
|
186
|
+
saffron-ai 1.2.1.
|
|
187
|
+
- **No more endless Loading.** A status or diff that never answers stops
|
|
188
|
+
after 60 seconds with its error, and later refreshes run again.
|
|
189
|
+
|
|
190
|
+
## 1.2.0: API test automation (beta)
|
|
9
191
|
|
|
10
192
|
Released 2026-10-26.
|
|
11
193
|
|
|
@@ -171,6 +353,14 @@ Runner
|
|
|
171
353
|
proposals, proofs, heals and the verdict) and drives the browser and the
|
|
172
354
|
HTTP medium through one contract. Nothing changes for a project.
|
|
173
355
|
|
|
356
|
+
Editors (VS Code extension 0.7.3, JetBrains plugin 0.7.4)
|
|
357
|
+
|
|
358
|
+
- **An API scenario's requests in Last Run.** Last Run never opens an API
|
|
359
|
+
scenario's request transcript as a screenshot: only failure and
|
|
360
|
+
before-heal pictures open as one, as the runner picks them. Such a row
|
|
361
|
+
offers Open Replay, which steps through the requests it sent. Needs
|
|
362
|
+
saffron-ai 1.2.0.
|
|
363
|
+
|
|
174
364
|
## 1.1.0: Secrets the AI agent never sees
|
|
175
365
|
|
|
176
366
|
Released 2026-10-22.
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Free to use · [npm: saffron-ai](https://www.npmjs.com/package/saffron-ai) · [site](https://saffron-ai.io)
|
|
6
6
|
|
|
7
|
-
Write tests in plain language, as `.saffron` files or standard `.feature` files. `.saffron` is Saffron's own test language and goes further than Gherkin: step sets for reusable flows, `{env:VAR}` tokens that keep secrets out of recordings and reports, and `{data:...}` references to data files. There are no step definitions and no glue code. On the first run, an AI agent (Claude by default, or Codex,
|
|
7
|
+
Write tests in plain language, as `.saffron` files or standard `.feature` files. `.saffron` is Saffron's own test language and goes further than Gherkin: step sets for reusable flows, `{env:VAR}` tokens that keep secrets out of recordings and reports, and `{data:...}` references to data files. There are no step definitions and no glue code. On the first run, an AI agent (Claude by default, or Codex, Antigravity or Cursor on the subscription you already have, driving Playwright MCP) executes each scenario in a real browser and records what it did into a **cache**: a human-reviewable JSON action list committed to git. Every run after that, Saffron replays the cache in a real browser: **zero AI calls, zero tokens**, at the speed of the browser and your app. The cache is Saffron's own JSON, not a generated script; replay runs on Playwright's browser engine, and Playwright MCP is only how the agent operates the browser while it records or heals.
|
|
8
8
|
|
|
9
9
|
When the UI changes and a cached step fails at runtime, the agent takes over mid-execution with full scenario context, adapts, and finishes the run, then files a **cache proposal** you accept or reject, like a snapshot test update. Reports state exactly what was adapted and what it cost.
|
|
10
10
|
|
|
@@ -17,7 +17,7 @@ When the UI changes and a cached step fails at runtime, the agent takes over mid
|
|
|
17
17
|
- **Verified proposals.** Every recording/heal is proof-replayed zero-AI before it's filed (with one bounded refinement pass on failure), so proposals arrive stamped `verified ✓` or honestly `UNVERIFIED ✗`.
|
|
18
18
|
- **Honest cost reporting.** Reports break out prompt-cache reads/writes (the real bill of agent sessions) next to the in+out token count, per scenario and in totals, and name the models used. On an API key the dollars are what was billed; on a Claude subscription the headline is the 5-hour plan window before and after the run, with the dollars as the API-equivalent.
|
|
19
19
|
- **Your subscription, your choice of agent.** Recording and healing run on the plan already logged in on the machine: Claude (default), Codex on a ChatGPT plan, Google AI Pro/Ultra through the Antigravity CLI (experimental), or Cursor. Set `"provider"` in the config; each one runs through its vendor's official client, and every provider records through the same recorder, so the caches are identical in kind.
|
|
20
|
-
- **Trend memory.** Every run appends to `.saffron/history.jsonl`; reports show deltas vs the previous run and 20-run sparklines, and Saffron flags **chronic scenarios** (healing repeatedly
|
|
20
|
+
- **Trend memory.** Every run appends to `.saffron/history.jsonl`; reports show deltas vs the previous run and 20-run sparklines, and Saffron flags **chronic scenarios** (healing repeatedly: re-record instead of paying again) plus recurring failure themes.
|
|
21
21
|
|
|
22
22
|
## Step reuse: new scenarios get cheaper as your suite grows
|
|
23
23
|
|
|
@@ -128,8 +128,8 @@ Configuration lives in `saffron.config.json` at your project root:
|
|
|
128
128
|
```
|
|
129
129
|
|
|
130
130
|
`provider` (also `--provider`) picks whose agent records and heals:
|
|
131
|
-
`claude` (default), `codex` (ChatGPT plan
|
|
132
|
-
`antigravity` (Google AI Pro/Ultra through Google's `agy` CLI,
|
|
131
|
+
`claude` (default), `codex` (ChatGPT plan or `CODEX_API_KEY`; `npm i -D "@openai/codex-sdk@>=0.158.0"`),
|
|
132
|
+
`antigravity` (Google AI Pro/Ultra or `GEMINI_API_KEY`, through Google's `agy` CLI,
|
|
133
133
|
experimental; `npx saffron login antigravity` once) or `cursor`
|
|
134
134
|
(`npm i -D "@cursor/sdk@^1.0.32"`, then `npx saffron login cursor`). `model` takes
|
|
135
135
|
that provider's model names. `npx saffron login` says what a provider
|