@somewhere-cloud/cli 0.38.151 → 0.38.153
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 +12 -0
- package/README.md +20 -0
- package/dist/lib/bundle.js +1324 -450
- package/dist/lib/bundle.js.map +3 -3
- package/dist/testing.js +1 -1
- package/dist/types/lib/app-test.d.ts +1 -20
- package/dist/types/lib/client.d.ts +2 -0
- package/dist/types/lib/preview-credential.d.ts +3 -1
- package/dist/types/lib/test-control.d.ts +5 -0
- package/dist/types/lib/test-identities.d.ts +9 -2
- package/dist/types/lib/test-response-capture.d.ts +24 -0
- package/dist/types/lib/test-session.d.ts +43 -0
- package/dist/types/lib/testing-app.d.ts +22 -0
- package/dist/types/lib/testing-jobs.d.ts +20 -0
- package/dist/types/testing.d.ts +10 -35
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -3
- package/src/testing.ts +14 -78
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.38.153
|
|
4
|
+
|
|
5
|
+
- Write signed-in app tests with `@somewhere-cloud/cli/testing`. Generated starters include a test, and test sessions renew when the access token nears expiry.
|
|
6
|
+
- Run one part of the app smoke check with `somewhere test --only access`, `--only crawl`, or a saved check path. The report lists the parts it skipped.
|
|
7
|
+
- When deployment is still pending, the CLI checks the exact release without uploading source again.
|
|
8
|
+
- Hosted smoke checks and explicit job waits check for early results sooner.
|
|
9
|
+
|
|
10
|
+
## 0.38.152
|
|
11
|
+
|
|
12
|
+
- Run a scheduled job twice in a preview with `somewhere cron run <name> --preview --twice` and see each result and table row-count change.
|
|
13
|
+
- Use a Playwright session from `somewhere test-users prepare` with the data testing helper.
|
|
14
|
+
|
|
3
15
|
## 0.38.151
|
|
4
16
|
|
|
5
17
|
- The generated project guide shows where to declare data access and how to check it with signed-in users.
|
package/README.md
CHANGED
|
@@ -329,6 +329,12 @@ MIT © Somewhere HQ, Inc.
|
|
|
329
329
|
|
|
330
330
|
## Test any Somewhere app
|
|
331
331
|
|
|
332
|
+
Use the supported `@somewhere-cloud/cli/testing` import from Node or Playwright.
|
|
333
|
+
`openTestApp()` opens the linked app, `app.users(3)` returns signed-in sessions,
|
|
334
|
+
and `app.cleanup()` removes this test's fixtures. For a saved preview use
|
|
335
|
+
`openTestApp({ preview: true })`. See [Testing your app](https://somewhere.cloud/docs/test)
|
|
336
|
+
for the complete example.
|
|
337
|
+
|
|
332
338
|
Add the CLI with `npm install --save-dev @somewhere-cloud/cli`, then import
|
|
333
339
|
`createUser`, `signIn`, `UserSession`, `expectRefusal`, and `waitForApp` from
|
|
334
340
|
`@somewhere-cloud/cli/testing` in Node tests. No starter is required.
|
|
@@ -346,6 +352,20 @@ From the linked app folder, `session.data('notes', { operation: 'list' })` sends
|
|
|
346
352
|
the signed-in session, app Origin and deployed contract. For a shell probe, run
|
|
347
353
|
`somewhere test-users prepare alice`, then `somewhere data list notes --as alice`.
|
|
348
354
|
The command prints the HTTP status, outcome and rows or error as JSON.
|
|
355
|
+
|
|
356
|
+
To reuse the prepared user in your own Playwright script, run
|
|
357
|
+
`somewhere test-users prepare alice` in the linked app folder:
|
|
358
|
+
|
|
359
|
+
```ts
|
|
360
|
+
import { data } from '@somewhere-cloud/cli/testing';
|
|
361
|
+
const alice = await browser.newContext({ storageState: '.somewhere/test/alice.state.json' });
|
|
362
|
+
const response = await data(alice.request, 'notes', { operation: 'list' });
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
`data()` uses the linked app's contract and the context's own session. Save the
|
|
366
|
+
context's storage state back to the same file if the app refreshes the session.
|
|
367
|
+
Run `somewhere test-users cleanup` when finished.
|
|
368
|
+
|
|
349
369
|
`expectRefusal(response, 403, 'DATA_ACCESS_DENIED')` checks the exact status and
|
|
350
370
|
code. For an empty scoped read, also check that the owner can read the same fixture.
|
|
351
371
|
|