@taqwright/lime-cli 0.28.0 → 0.30.0
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/README.md +30 -0
- package/dist/index.js +281 -221
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -243,6 +243,36 @@ under test are always applied last and **cannot** be overridden from the file.
|
|
|
243
243
|
Run `lime-cli --help` for the full flag list. Exit codes: `0` done/help, `1`
|
|
244
244
|
stuck/error/cancelled, `2` bad invocation.
|
|
245
245
|
|
|
246
|
+
### Test data from your own API (goal hooks)
|
|
247
|
+
|
|
248
|
+
A goal can create the data it needs before the journey starts — a fresh user, a coupon,
|
|
249
|
+
a listing — by calling a step declared in `.lime/hooks.json`:
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
lime-cli --goal 'Call createCoupon with percentOff 25, add a dress to the cart, apply ${PROMO_CODE} and verify the total is 25% lower' …
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
```json
|
|
256
|
+
{
|
|
257
|
+
"createCoupon": {
|
|
258
|
+
"params": { "percentOff": { "type": "integer", "min": 1, "max": 100 } },
|
|
259
|
+
"http": { "method": "POST", "url": "https://api.example.com/coupons",
|
|
260
|
+
"headers": { "X-Api-Key": "${env.TEST_DATA_KEY}" },
|
|
261
|
+
"body": { "percentOff": "${percentOff}" } },
|
|
262
|
+
"outputs": { "PROMO_CODE": "code" }
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
lime-cli runs the request on your machine (or CI runner) after LIME has checked the goal
|
|
268
|
+
and **before** connecting the device, then passes each output as a secret `${NAME}` for
|
|
269
|
+
the rest of the goal. Only the declarations (names, params, output names) are sent to
|
|
270
|
+
LIME — never the URL, headers or key; the key is read from the environment
|
|
271
|
+
(`${env.NAME}`) at the moment of the call. A parameter counts only when the goal writes
|
|
272
|
+
it. `lime-cli hooks check` validates the file; `lime-cli hooks --help` has the details.
|
|
273
|
+
|
|
274
|
+
Goal hooks need the `goal_hooks` feature on your LIME account.
|
|
275
|
+
|
|
246
276
|
## Making the test fit your project (`adapt` / `verify`)
|
|
247
277
|
|
|
248
278
|
LIME's recorded spec is plain and self-contained: it runs, but it does not know your
|