waygraph 0.15.43 → 0.15.44

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.
Files changed (58) hide show
  1. package/dist/analysis/coverage-gap.d.ts +11 -0
  2. package/dist/analysis/coverage-gap.js +119 -0
  3. package/dist/analysis/graph.d.ts +92 -0
  4. package/dist/analysis/graph.js +467 -0
  5. package/dist/analysis/map-check.d.ts +18 -0
  6. package/dist/analysis/map-check.js +140 -0
  7. package/dist/analysis/practices-check.d.ts +14 -0
  8. package/dist/analysis/practices-check.js +195 -0
  9. package/dist/auto-explore.d.ts +1 -1
  10. package/dist/auto-explore.js +1 -1
  11. package/dist/auto-session/session.js +2 -2
  12. package/dist/cli/util.d.ts +8 -1
  13. package/dist/cli/util.js +9 -2
  14. package/dist/commands/check.js +2 -2
  15. package/dist/commands/map.js +1 -1
  16. package/dist/commands/session.js +2 -2
  17. package/dist/commands/traverse.js +2 -2
  18. package/dist/engine/branch-regression.js +2 -1
  19. package/dist/engine/compose.js +3 -2
  20. package/dist/engine/core.js +5 -4
  21. package/dist/engine/engine-class.js +13 -12
  22. package/dist/engine/flow.js +4 -3
  23. package/dist/engine/run-graph.js +4 -3
  24. package/dist/errors.d.ts +122 -0
  25. package/dist/errors.js +125 -0
  26. package/dist/highlights/shorthand.d.ts +24 -0
  27. package/dist/highlights/shorthand.js +30 -0
  28. package/dist/index.d.ts +9 -7
  29. package/dist/index.js +5 -4
  30. package/dist/mem-page.js +2 -1
  31. package/dist/pilot.d.ts +1 -1
  32. package/dist/pilot.js +1 -1
  33. package/dist/traverse/coverage.d.ts +59 -0
  34. package/dist/traverse/coverage.js +127 -0
  35. package/dist/traverse/lease.d.ts +18 -0
  36. package/dist/traverse/lease.js +62 -0
  37. package/dist/traverse/run.d.ts +47 -0
  38. package/dist/traverse/run.js +439 -0
  39. package/examples/saucedemo/.waygraph-auto/050e5b55.log +0 -0
  40. package/examples/saucedemo/.waygraph-auto/096fea05.log +20 -0
  41. package/examples/saucedemo/.waygraph-auto/123d1cad.log +5 -0
  42. package/examples/saucedemo/.waygraph-auto/12ed8e28.log +0 -0
  43. package/examples/saucedemo/.waygraph-auto/1cb6f44c.log +5 -0
  44. package/examples/saucedemo/.waygraph-auto/1fdb2100.log +0 -0
  45. package/examples/saucedemo/.waygraph-auto/573abedd.log +0 -0
  46. package/examples/saucedemo/.waygraph-auto/9a26134c.log +20 -0
  47. package/examples/saucedemo/.waygraph-auto/aa226dd0.log +22 -0
  48. package/examples/saucedemo/.waygraph-auto/ac5dde3d.log +0 -0
  49. package/examples/saucedemo/.waygraph-auto/cae91469.log +0 -0
  50. package/examples/saucedemo/.waygraph-auto/d846cd78.log +0 -0
  51. package/examples/saucedemo/.waygraph-auto/eb38d92e.log +22 -0
  52. package/examples/saucedemo/.waygraph-auto/ee86203e.log +0 -0
  53. package/package.json +1 -1
  54. package/templates/scaffold/scripts/README.md +13 -0
  55. package/templates/scaffold/src/flows/README.md +18 -0
  56. package/templates/scaffold/src/map/README.md +31 -0
  57. package/templates/scaffold/src/states/README.md +15 -0
  58. package/templates/scaffold/tests/README.md +10 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waygraph",
3
- "version": "0.15.43",
3
+ "version": "0.15.44",
4
4
  "type": "module",
5
5
  "description": "A typed graph of reusable Blocks for driving a browser through E2E flows.",
6
6
  "license": "MIT",
@@ -0,0 +1,13 @@
1
+ # `scripts/`
2
+
3
+ - `fixture-server.mjs` - serves the offline `.html` fixture pages under `src/map/` on
4
+ `127.0.0.1:4177` (override with `WAYGRAPH_FIXTURE_PORT`/`WAYGRAPH_FIXTURE_HOST`). This is
5
+ what makes `npm test` pass with no network and no real app running.
6
+ - `with-fixture.mjs` - starts `fixture-server.mjs`, runs whatever command you give it
7
+ (`waygraph auto`, `waygraph demo --blocks ...`), then tears the server down when that command
8
+ exits. Every `npm run demo*`/`auto*` script in `package.json` goes through this wrapper -
9
+ don't run `waygraph demo`/`auto` directly against this scaffold's own fixture pages without it.
10
+
11
+ Pointing this scaffold at a real app instead of the offline fixtures: change `_nav.block.ts`'s
12
+ `url`/`homeOrigin` to the real one and drop `with-fixture.mjs` from the scripts that no longer
13
+ need it.
@@ -0,0 +1,18 @@
1
+ # `src/flows/`
2
+
3
+ A `*.flow.ts` composes Blocks from `src/map/` into a runnable path - `waygraph run`/`demo`/`test`
4
+ all point at an export here by name (`waygraph run --blocks shopFlow`).
5
+
6
+ - Prefer `new Engine().map()...end()` (the Map builder: `.gotoPage()`/`.method()`/`.assert()`/
7
+ `.branch()`) over hand-composing raw Blocks - it checks each step's Block kind at runtime and
8
+ the Checkpoint chain at compile time, so a wrong step is a build/test failure, not a
9
+ mid-run surprise.
10
+ - `withTitle`/`withHighlightFixtures`/`withSessionReset`/etc. are non-destructive wrappers -
11
+ `someFlow.withTitle("...")` doesn't mutate `someFlow`, it returns a new one. Compose them
12
+ around the finished `.end()` result, not inside the Map chain itself.
13
+ - One flow, one scenario. A flow that needs a genuinely different starting session
14
+ (re-entering the login page mid-chain) wraps that segment in `withSessionReset`, rather than
15
+ hand-clearing cookies inside a Block.
16
+
17
+ New flow → new file here, named for the scenario (`checkout.flow.ts`), not for the Blocks it
18
+ happens to use.
@@ -0,0 +1,31 @@
1
+ # `src/map/`
2
+
3
+ The Waygraph Map: one folder per page, mirroring your app's real URLs. See the root
4
+ [`STRUCTURE.md`](../../STRUCTURE.md) for the full picture; this file is the local, one-screen
5
+ version for whoever is inside this directory.
6
+
7
+ ## The fixed names, every page folder
8
+
9
+ | File | Kind | Job |
10
+ |---|---|---|
11
+ | `_nav.block.ts` | Nav | How to get here - `url` (goto) or `click` (in-app link). One per page. |
12
+ | `_page.block.ts` | Page | "You have arrived" - the hub other pages navigate to. One per page. |
13
+ | `_sel.ts` | data | Every selector this page's Blocks use, in one object. Never inline a selector when this file exists - `waygraph check` warns on it. |
14
+ | `_methods/` | folder | One file per action, one action per file (`add-item.effect.block.ts`, not one file with three `.fill()` calls). |
15
+
16
+ Never rename these, never combine them into one file, never add a `_selectors/` folder in
17
+ place of `_sel.ts` - one page, one selector file, same as every other page in the Map.
18
+
19
+ ## `(group)` folders
20
+
21
+ A parenthesized folder (`(app_base)`, `(external)`) is organizational only - like a Next.js
22
+ route group. It groups pages by origin/base URL and never appears in a Checkpoint name or a
23
+ real URL. `waygraph map`/`waygraph check` fail loudly if a page folder's real URL stops
24
+ matching its own name - that's the point of this layout: drift becomes a build failure, not a
25
+ silent surprise months later.
26
+
27
+ ## Adding a page
28
+
29
+ Copy an existing page folder, keep the four fixed names, update `_nav`/`_page`/`_sel` for the
30
+ new page, then add `_methods/` files for its actions. Don't invent a new folder shape - every
31
+ page in this Map looks the same on purpose.
@@ -0,0 +1,15 @@
1
+ # `src/states/`
2
+
3
+ Checkpoint types and Mem keys - the typed vocabulary every Block in `src/map/` is written
4
+ against. Nothing here drives the browser; this is pure data shape.
5
+
6
+ - `*.states.ts` - `type X = Checkpoint<"X">` declarations. One per real app state
7
+ (`LoginPage`, `LoggedIn`), never `Checkpoint<string>` (a wildcard - `waygraph check` warns
8
+ on it; a Block should say exactly which states it moves between).
9
+ - `*.mem-keys.ts` - `key<T>("...")` / `keyGroup<T>("...")` declarations. A Mem key stores a
10
+ *value* a Block needs (credentials, a selected row's id) - never a selector (those live in
11
+ `_sel.ts` next to the page) and never something a Block could instead read straight off the
12
+ live page.
13
+
14
+ Add a new Checkpoint or Mem key here before writing the Block that needs it - Blocks import
15
+ from this directory, this directory never imports from `src/map/`.
@@ -0,0 +1,10 @@
1
+ # `tests/`
2
+
3
+ Real `@playwright/test` specs, run through `waygraph test` (an alias for `playwright test`,
4
+ plus `waygraph test ui`/`report`/`show-trace` for Playwright's own UI Mode/HTML report/trace
5
+ viewer). These run against the offline fixture server (see `scripts/README.md`), not a live
6
+ network - that's what makes `npm test` green immediately after `waygraph init`.
7
+
8
+ A spec here typically runs a `*.flow.ts` from `src/flows/` and asserts on its result, rather
9
+ than driving the page directly - the flow already encodes the real path and its own `verify`
10
+ checks; the spec is proving the flow itself still works end to end, not re-deriving selectors.