You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(docs-tests): tighten 404 detector to handle '404 | site' title and prose mentions
The previous three-signal detector (`.NotFound` element, `document.title
=== '404'`, body text contains `PAGE NOT FOUND`) had two real failure
modes on the VitePress build:
- The negative test on `/this-route-does-not-exist` returned no
indicator. VitePress emits `<title>404 | MTConnect.NET</title>` into
the static `404.html`, so the strict `=== '404'` equality never
matches; the `.NotFound` element only appears once Vue hydrates which
is fine but was the only remaining signal.
- The positive walk reported `/development/docs-site — body text
contains 'PAGE NOT FOUND'`. The page legitimately quotes the phrase
in prose (the section that documents the detector itself), so the
body-text signal fired a false positive.
Switch to a two-signal detector — `.NotFound` element + `document.title`
starting with `404` — and update the docs-site page to describe the new
scheme. The title prefix match is robust because VitePress always emits
`<title>404 | <site-title></title>` for unmapped routes regardless of
the configured site title, and prose mentions of the literal phrase
`PAGE NOT FOUND` no longer trip the walk.
Copy file name to clipboardExpand all lines: docs/development/docs-site.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ dotnet test tests/MTConnect.NET-Docs-Tests --filter Category=E2E
71
71
72
72
On the first run the fixture installs the chromium binary the Playwright .NET binding drives (~150 MB; cached on subsequent runs) and — if `docs/.vitepress/dist/` is missing — invokes `npm ci && npm run build` from `docs/` to produce a preview-able site. Subsequent runs reuse both, so a warm working tree completes in a couple of minutes; a cold checkout takes longer because the build artefact is rebuilt from scratch.
73
73
74
-
Failure output names every route that surfaced as a 404 along with which of the three signals fired — the `.NotFound` element, `document.title === '404'`, or body text containing `PAGE NOT FOUND`. Typical fixes:
74
+
Failure output names every route that surfaced as a 404 along with which of the two signals fired—the `.NotFound` element rendered by the VitePress default theme's NotFound component, or `document.title` starting with `404` (the static `404.html` emits `<title>404 | MTConnect.NET</title>`, so a prefix match catches it regardless of the trailing site-title suffix). Typical fixes:
75
75
76
76
| Symptom | Probable cause | Fix |
77
77
| --- | --- | --- |
@@ -80,7 +80,7 @@ Failure output names every route that surfaced as a 404 along with which of the
80
80
| "playwright install chromium exited NNN" | The chromium download was blocked or interrupted. | Re-run; if the install fails again, run `dotnet tool restore && npx playwright install chromium` manually and re-try. |
81
81
| "port NNNN already in use" hang | Another process grabbed the free port between selection and bind (rare; mitigated by the banner-parse fallback). | Re-run the test — the next free port avoids the contended one. |
82
82
83
-
The negative companion test (`A_Synthetic_Unmapped_Route_Surfaces_As_A_404`) pins the detector itself: a future Playwright or VitePress upgrade that breaks one of the three 404 signals would still see every real route render fine, but the negative test would go red and surface the regression before a real 404 slipped past.
83
+
The negative companion test (`A_Synthetic_Unmapped_Route_Surfaces_As_A_404`) pins the detector itself: a future Playwright or VitePress upgrade that breaks one of the two 404 signals would still see every real route render fine, but the negative test would go red and surface the regression before a real 404 slipped past.
0 commit comments