waygraph 0.15.42 → 0.15.43
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/dist/practices-check.js
CHANGED
|
@@ -130,17 +130,19 @@ export function collectPracticeWarnings(projectDir, walkDir, opts) {
|
|
|
130
130
|
warnings.push({
|
|
131
131
|
kind: "overcomplex-selector",
|
|
132
132
|
file: rel,
|
|
133
|
-
detail: `uses ${via} — reach for a plain CSS selector (id/class/data-attribute, via a .
|
|
134
|
-
"export) instead of a regex/XPath match unless the DOM genuinely has no stable selector",
|
|
133
|
+
detail: `uses ${via} — reach for a plain CSS selector (id/class/data-attribute, via a _sel.ts/` +
|
|
134
|
+
"*.sel.ts export) instead of a regex/XPath match unless the DOM genuinely has no stable selector",
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
if (!isIgnored("inline-selector-should-use-sel-file", ignore) && INLINE_SIMPLE_SELECTOR.test(src)) {
|
|
138
|
-
|
|
138
|
+
// Two real, coexisting conventions: the Map layout's own `_sel.ts` (one per page folder, next
|
|
139
|
+
// to `_nav`/`_page`/`_methods`) and the freeform layout's per-concern `<name>.sel.ts`.
|
|
140
|
+
const siblingSelFile = readdirSync(dirname(file)).some((f) => f === "_sel.ts" || f.endsWith(".sel.ts"));
|
|
139
141
|
if (siblingSelFile) {
|
|
140
142
|
warnings.push({
|
|
141
143
|
kind: "inline-selector-should-use-sel-file",
|
|
142
144
|
file: rel,
|
|
143
|
-
detail: "a selector string is inlined here, but this directory already has a *.sel.ts file — " +
|
|
145
|
+
detail: "a selector string is inlined here, but this directory already has a _sel.ts / *.sel.ts file — " +
|
|
144
146
|
"add/reuse the selector there instead of a new one-off literal",
|
|
145
147
|
});
|
|
146
148
|
}
|
|
@@ -171,7 +173,7 @@ export function practiceKindLabel(kind) {
|
|
|
171
173
|
case "overcomplex-selector":
|
|
172
174
|
return "regex/XPath selector where a plain one would do";
|
|
173
175
|
case "inline-selector-should-use-sel-file":
|
|
174
|
-
return "inline selector — a .sel.ts file already exists here";
|
|
176
|
+
return "inline selector — a _sel.ts/*.sel.ts file already exists here";
|
|
175
177
|
default: {
|
|
176
178
|
const _exhaustive = kind;
|
|
177
179
|
return _exhaustive;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "waygraph",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.43",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A typed graph of reusable Blocks for driving a browser through E2E flows.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,11 +42,13 @@
|
|
|
42
42
|
"test": "npm run check:structure && npm run test:unit && playwright test",
|
|
43
43
|
"test:ui": "playwright test --ui",
|
|
44
44
|
"test:unit": "node --import tsx/esm --test tests/unit/*.spec.ts",
|
|
45
|
-
"docs:preview": "python3 -m http.server 4173 --directory docs",
|
|
46
45
|
"example:saucedemo:install": "npm --prefix examples/saucedemo install",
|
|
47
46
|
"example:saucedemo:test": "npm --prefix examples/saucedemo test",
|
|
48
47
|
"example:saucedemo:auto": "npm --prefix examples/saucedemo run auto",
|
|
49
|
-
"check:structure": "node scripts/check-structure.mjs"
|
|
48
|
+
"check:structure": "node scripts/check-structure.mjs",
|
|
49
|
+
"docs:dev": "vitepress dev docs",
|
|
50
|
+
"docs:build": "vitepress build docs",
|
|
51
|
+
"docs:preview": "vitepress preview docs"
|
|
50
52
|
},
|
|
51
53
|
"peerDependencies": {
|
|
52
54
|
"@playwright/test": "^1.40.0"
|
|
@@ -58,6 +60,7 @@
|
|
|
58
60
|
"devDependencies": {
|
|
59
61
|
"@playwright/test": "^1.63.0",
|
|
60
62
|
"@types/node": "^26.0.0",
|
|
61
|
-
"typescript": "^5.6.0"
|
|
63
|
+
"typescript": "^5.6.0",
|
|
64
|
+
"vitepress": "^1.6.4"
|
|
62
65
|
}
|
|
63
66
|
}
|
|
@@ -17,10 +17,12 @@ against a live site, use `--skill-pilot-blind`.
|
|
|
17
17
|
2. **Navigation only inside Nav.** `page.goto` / NavBlock `click` live in
|
|
18
18
|
`defineNavBlock` / `defineNavClickBlock` only. Method/Effect `act` uses ActionPage
|
|
19
19
|
(no goto) even when the app changes URL as a side effect of a button click.
|
|
20
|
-
3. **Selectors in `*Sel`, never inline.** DOM strings live in a `*Sel` next to the page
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
3. **Selectors in `*Sel`, never inline.** DOM strings live in a `*Sel` next to the page - `_sel.ts`
|
|
21
|
+
in the Map layout (one per page folder, next to `_nav`/`_page`/`_methods`), `<name>.sel.ts` in a
|
|
22
|
+
freeform layout (one per concern) - never a fresh file-naming convention per project (`_sel.ts`,
|
|
23
|
+
not `_selectors.ts` or a `_selectors/` folder). Mem keys store values, not selectors. `waygraph
|
|
24
|
+
check` warns on inline selector literals in `Trait.visible` / `Trait.text`, and separately on any
|
|
25
|
+
inline selector literal (`.locator("#x")`, `click: "#x"`) in a directory that already has a `_sel.ts`/`*.sel.ts`.
|
|
24
26
|
**Plain CSS first, always.** An id, a class, or `[data-testid=…]` is the selector for
|
|
25
27
|
almost everything real apps have - reach for that before anything else. Don't invent a
|
|
26
28
|
regex/XPath match (`:has-text(/…/)`, `:text-matches(…)`, an XPath locator) for something a
|