11const { test, expect } = require ( "@playwright/test" ) ;
22const { spawn } = require ( "node:child_process" ) ;
3+ const fs = require ( "node:fs" ) ;
34const net = require ( "node:net" ) ;
45const path = require ( "node:path" ) ;
6+ const { createDocsCacheRoot } = require ( "./helpers/docs-content-root" ) ;
57
68const ROOT = path . resolve ( __dirname , ".." , ".." ) ;
9+ const SCREENSHOT_DIR = path . join ( ROOT , ".tmp" , "screenshots" , "issue-190" ) ;
10+ const FIXTURE_DOC_PATH = "content/overview/reference/schedule.md" ;
11+ const FIXTURE_DOC_TITLE = "Synthetic Characterization Schedule" ;
12+ const FIXTURE_DOC_SUMMARY = "Synthetic reference used only by browser characterization tests." ;
13+ // `buildOperationsReferenceLinks` indexes this exact path, so the docs surface
14+ // only lists this document when `GET /docs` really returned the spec's corpus.
15+ const FIXTURE_DOC = [
16+ "---" ,
17+ "id: ref.synthetic.characterization-schedule" ,
18+ `title: ${ FIXTURE_DOC_TITLE } ` ,
19+ `summary: ${ FIXTURE_DOC_SUMMARY } ` ,
20+ "doc_type: reference" ,
21+ "tags: [synthetic]" ,
22+ "systems: [dataops]" ,
23+ "---" ,
24+ "" ,
25+ `# ${ FIXTURE_DOC_TITLE } ` ,
26+ "" ,
27+ "Synthetic public-safe content for the characterization corpus." ,
28+ "" ,
29+ ] . join ( "\n" ) ;
730let server ;
831let baseURL ;
932
@@ -111,6 +134,10 @@ test.describe("pre-refactor frontend module characterization", () => {
111134 test . beforeAll ( async ( ) => {
112135 const port = await freePort ( ) ;
113136 baseURL = `http://127.0.0.1:${ port } ` ;
137+ const cacheRoot = createDocsCacheRoot ( "issue-190-frontend-characterization" , {
138+ [ FIXTURE_DOC_PATH ] : FIXTURE_DOC ,
139+ } ) ;
140+ fs . mkdirSync ( SCREENSHOT_DIR , { recursive : true } ) ;
114141 server = spawn ( path . join ( ROOT , "node_modules" , ".bin" , "tsx" ) , [ "scripts/test-server.ts" ] , {
115142 cwd : path . join ( ROOT , "backend" ) ,
116143 detached : true ,
@@ -122,6 +149,7 @@ test.describe("pre-refactor frontend module characterization", () => {
122149 SKIP_AUTH : "true" ,
123150 DATAOPS_DOCS_DOMAIN : "1" ,
124151 DTC_OFFLINE : "1" ,
152+ DTC_CACHE_ROOT : cacheRoot ,
125153 FRONTEND_ROOT : path . join ( ROOT , "frontend" ) ,
126154 E2E_TEMPLATE_ACTOR_ID : "00000000-0000-0000-0000-000000000001" ,
127155 CONVERSATIONAL_TELEGRAM_INGRESS_ENABLED : "false" ,
@@ -226,6 +254,15 @@ test.describe("pre-refactor frontend module characterization", () => {
226254 await expect ( page ) . toHaveURL ( `${ baseURL } /#${ route } ` ) ;
227255 await expect ( page . locator ( "#library-title" ) ) . toHaveText ( title ) ;
228256 await expect ( page . locator ( marker ) ) . toBeVisible ( ) ;
257+ if ( route === "/processes" ) {
258+ // The docs surface must list the spec's own corpus. Without this the
259+ // suite would pass just as happily against an empty or wrongly pointed
260+ // content root.
261+ await expect (
262+ page . locator ( ".ops-surface-docs .ops-reference-link" , { hasText : FIXTURE_DOC_TITLE } ) ,
263+ ) . toBeVisible ( ) ;
264+ await page . screenshot ( { path : path . join ( SCREENSHOT_DIR , "processes.png" ) , fullPage : true } ) ;
265+ }
229266 await expectNoHorizontalOverflow ( page , route ) ;
230267 }
231268 await page . goto ( `${ baseURL } /#/templates` ) ;
0 commit comments