docs(context): record navigation acceptance and Development evidence
This commit is contained in:
parent
9dcd29d423
commit
5168535457
107
Docs/Writer/Context-External-Navigation-20261127.md
Normal file
107
Docs/Writer/Context-External-Navigation-20261127.md
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
# Context external workspace navigation
|
||||||
|
|
||||||
|
## Root cause and correction
|
||||||
|
|
||||||
|
Characters already used `context-main-window.js`, the `workspace.open` interaction,
|
||||||
|
the existing Context registry and the main page's shared presence connection.
|
||||||
|
Spatial anchors and several Overview/expanded-detail links were ordinary links and
|
||||||
|
bypassed that handler. Some links opened independent tabs; others replaced Context.
|
||||||
|
|
||||||
|
The shared handler now delegates same-origin main-page anchors throughout the
|
||||||
|
Context document, including both panes, dynamically refreshed partials, expanded details
|
||||||
|
and dialogs. Existing Characters/Names/Relationships entity commands retain their
|
||||||
|
resolver. Other links carry their exact local URL through an optional workspace URL
|
||||||
|
contract, preserving project/book/scene parameters, map IDs, feature IDs and selected
|
||||||
|
floor blocks. The server admits only a central allowlist of read-only main-page
|
||||||
|
routes; existing destination authorisation remains in force.
|
||||||
|
|
||||||
|
Main discovery, activation, fallback and dirty-work protection are reused. Rapid
|
||||||
|
requests coalesce to the latest queued link, and another Context waits for an opening
|
||||||
|
main's registration. Main registration clears its launch reservation, allowing an
|
||||||
|
immediately closed replacement to reopen. Blocked popups stay intercepted instead
|
||||||
|
of falling through to Context navigation. There is no new registry or connection.
|
||||||
|
|
||||||
|
## Audit
|
||||||
|
|
||||||
|
| Context feature | Main application actions covered |
|
||||||
|
|---|---|
|
||||||
|
| Overview | Calendar, Story Maps, linked floor plan, Plot Lines, thread editing, Relationships and source scenes |
|
||||||
|
| Characters in Scene | Full Characters directory, character details and source scenes |
|
||||||
|
| Names / expanded identity | Character details and previously unmarked Edit Character |
|
||||||
|
| Relationships | Editor links, selected relationship context, character details and source scenes |
|
||||||
|
| Locations | Location Details and Edit Location |
|
||||||
|
| Maps | Open in Maps, including exact feature reveal and unassociated-feature links |
|
||||||
|
| Floor Plans | Open in Floor Plans, including selected block |
|
||||||
|
| Context shell, connection dialog / legacy map partial | Scene editor, main Writer link, book workspace, manuscript structure/evidence and full Maps link |
|
||||||
|
|
||||||
|
Fragment links and Context routes are excluded. Buttons for tabs, scene movement,
|
||||||
|
Hold/Follow, related-location inspection, Show on map/floor plan, dialogs, inline
|
||||||
|
editing, zoom/pan, placement, association and cross-pane drops are unchanged.
|
||||||
|
Main application Back buttons are unchanged.
|
||||||
|
|
||||||
|
## Verification and delivery
|
||||||
|
|
||||||
|
The clean committed candidate built with **0 warnings and 0 errors** (40.85 s),
|
||||||
|
passed **892** executable-harness checks (102.79 s), and published successfully
|
||||||
|
(30.39 s). No SQL, schema, Back-button, layout or spatial-resolution changes were
|
||||||
|
introduced.
|
||||||
|
|
||||||
|
| Check | Result |
|
||||||
|
|---|---|
|
||||||
|
| Central read-only destination validation and registry lifecycle | Passed |
|
||||||
|
| Existing Characters navigation, main dirty-work refusal and named fallback | Passed — rendered shared Context regression |
|
||||||
|
| Header, dynamic links, exact feature/block URLs, keyboard, Ctrl-click and middle-click | Passed — compiled browser/real registry fixtures |
|
||||||
|
| Closed main, rapid requests, multiple Context windows and blocked-popup preservation | Passed — compiled browser/real registry fixtures |
|
||||||
|
| Location Details / Edit, Maps / Floor Plans, Character Details / Edit and Overview links | Passed — authenticated Development browser and installed Chromium PWA |
|
||||||
|
| Normal main-window Back history | Passed — authenticated browser and PWA |
|
||||||
|
| Held and following windows, split layout, selected location and map/floor viewports | Passed — authenticated browser and PWA state assertions |
|
||||||
|
| Unrelated inline description draft survives external navigation | Passed — authenticated browser and PWA |
|
||||||
|
| Manuscript-focus navigation writes / Context SignalR connections | **0 / 1** in both authenticated runs |
|
||||||
|
| Spatial selection, local editing/placement/association interactions | Passed — rendered spatial regression, including seven themes |
|
||||||
|
| Persisted spatial mutations, Undo and live updates | Passed — final authenticated Development spatial suite, including geometry preservation and main consumers |
|
||||||
|
| Physical Windows / Word Companion | Not verified — Linux host |
|
||||||
|
|
||||||
|
The authenticated Edit Character check inserts the same unmarked dynamic href used
|
||||||
|
by the shared Name Details partial; it does not claim a separate end-to-end Names
|
||||||
|
search/association workflow. Main-page activation was requested through the existing
|
||||||
|
mechanism; OS foreground focus is not guaranteed by the browser.
|
||||||
|
|
||||||
|
Screenshots after external navigation:
|
||||||
|
|
||||||
|
- [Browser: Locations + Maps](ContextNavigationEvidence/browser-locations-maps-preserved.png).
|
||||||
|
- [Browser: Locations + Floor Plans](ContextNavigationEvidence/browser-locations-floorplans-preserved.png).
|
||||||
|
- [Installed PWA: Locations + Maps](ContextNavigationEvidence/pwa-locations-maps-preserved.png).
|
||||||
|
- [Installed PWA: Locations + Floor Plans](ContextNavigationEvidence/pwa-locations-floorplans-preserved.png).
|
||||||
|
|
||||||
|
[Browser assertions](ContextNavigationEvidence/browser-results.json),
|
||||||
|
[PWA assertions](ContextNavigationEvidence/pwa-results.json), and
|
||||||
|
[sanitised release/gate evidence](ContextNavigationEvidence/release-summary.json).
|
||||||
|
|
||||||
|
## Development activation
|
||||||
|
|
||||||
|
Activated **27 November 2026, 20:12 UTC**, through the guarded Atlas Development
|
||||||
|
worker, with a verified COPY_ONLY/CHECKSUM backup and no activation failures.
|
||||||
|
Health confirmed `Development`, `PlotDirector_Development` and the exact source
|
||||||
|
commit. This release executed **zero migrations**; the unchanged immutable SQL plan
|
||||||
|
and its prior schema qualification were reused.
|
||||||
|
|
||||||
|
- Application source: `9dcd29d423b20e373e49fb28180d993c40aa165d`.
|
||||||
|
- Implementation commits: `121a49b0`, `16eeed01`, `9dcd29d4`.
|
||||||
|
- Release: `development-context-navigation-9dcd29d423b2-20261127T201127Z`.
|
||||||
|
- Deployment receipt: `20261127T201227Z-0cb5cdeff9f9`.
|
||||||
|
- Production: **untouched**.
|
||||||
|
|
||||||
|
Documentation establishes this standard in the unified Context foundation and
|
||||||
|
shared spatial architecture. Subsequent report/test-only commits do not change the
|
||||||
|
deployed application. The dedicated disposable account and owned project were removed through the normal account-deletion workflow. Its private credential file was deleted, and a read-only Development check confirmed zero remaining fixture scenes. No author records were used or modified for testing.
|
||||||
|
|
||||||
|
Browser/OS window activation is discretionary. PlotDirector requests focus; some
|
||||||
|
browsers require the author to switch windows manually. Popup creation may require
|
||||||
|
site permission. A blocked attempt retains Context and gives shared-toast feedback.
|
||||||
|
Physical Windows/Word testing is not available on this Linux host.
|
||||||
|
|
||||||
|
Automated protection includes route acceptance/rejection (external URLs, traversal,
|
||||||
|
mutation routes and Context redirects are refused), delegated-link coverage and a
|
||||||
|
launch-register-close-relaunch registry contract. The isolated compiled browser
|
||||||
|
host's spatial route is now constrained to its three names so it no longer shadows
|
||||||
|
the real OpenWorkspace endpoint during navigation tests.
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 208 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 200 KiB |
25
Docs/Writer/ContextNavigationEvidence/browser-results.json
Normal file
25
Docs/Writer/ContextNavigationEvidence/browser-results.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"passed": true,
|
||||||
|
"authenticated": true,
|
||||||
|
"installedPwa": false,
|
||||||
|
"checks": [
|
||||||
|
"/Writer",
|
||||||
|
"/Locations/Details/5721",
|
||||||
|
"/Locations/Edit/5721",
|
||||||
|
"normal main-window Back history",
|
||||||
|
"/Maps?projectId=10316&id=112&featureId=0505780e-efca-4da2-bf84-6326892a827d",
|
||||||
|
"/FloorPlans/Edit/19?selectedBlockId=33",
|
||||||
|
"/Characters/Details/7290",
|
||||||
|
"/Characters/Edit/7290",
|
||||||
|
"/StoryCalendar?projectId=10316&bookId=12391",
|
||||||
|
"/Maps?projectId=10316&mode=story&sceneId=12453",
|
||||||
|
"independent held/following Context windows",
|
||||||
|
"/FloorPlans/Edit/19?selectedBlockId=33",
|
||||||
|
"closed-main fallback reused",
|
||||||
|
"/Locations/Details/5721"
|
||||||
|
],
|
||||||
|
"focusWrites": 0,
|
||||||
|
"signalRConnections": 1,
|
||||||
|
"errors": [],
|
||||||
|
"physicalWindowsWord": false
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 208 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 200 KiB |
25
Docs/Writer/ContextNavigationEvidence/pwa-results.json
Normal file
25
Docs/Writer/ContextNavigationEvidence/pwa-results.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"passed": true,
|
||||||
|
"authenticated": true,
|
||||||
|
"installedPwa": true,
|
||||||
|
"checks": [
|
||||||
|
"/Writer",
|
||||||
|
"/Locations/Details/5721",
|
||||||
|
"/Locations/Edit/5721",
|
||||||
|
"normal main-window Back history",
|
||||||
|
"/Maps?projectId=10316&id=112&featureId=0505780e-efca-4da2-bf84-6326892a827d",
|
||||||
|
"/FloorPlans/Edit/19?selectedBlockId=33",
|
||||||
|
"/Characters/Details/7290",
|
||||||
|
"/Characters/Edit/7290",
|
||||||
|
"/StoryCalendar?projectId=10316&bookId=12391",
|
||||||
|
"/Maps?projectId=10316&mode=story&sceneId=12453",
|
||||||
|
"independent held/following Context windows",
|
||||||
|
"/FloorPlans/Edit/19?selectedBlockId=33",
|
||||||
|
"closed-main fallback reused",
|
||||||
|
"/Locations/Details/5721"
|
||||||
|
],
|
||||||
|
"focusWrites": 0,
|
||||||
|
"signalRConnections": 1,
|
||||||
|
"errors": [],
|
||||||
|
"physicalWindowsWord": false
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"normalHarnessPassCount": 892,
|
||||||
|
"failed": 0,
|
||||||
|
"compiledContextNavigation": "passed; main reuse, exact URLs, header/dialog routes, dynamic links, keyboard, Ctrl/middle-click, closed-main fallback, rapid requests, multiple Contexts, viewport preservation, simulated blocked popup",
|
||||||
|
"charactersSharedNavigation": "passed; existing navigation and main dirty-work refusal",
|
||||||
|
"spatialRendered": "passed; coordination, drafts, local operations, seven themes",
|
||||||
|
"authenticatedSpatial": "passed; targeted edits, assignment, placement/reveal, room association, protected Undo, geometry preservation, main consumers, live updates, one SignalR connection",
|
||||||
|
"cleanup": "normal dedicated-account hard delete completed; private credential file removed; remaining fixture scenes=0",
|
||||||
|
"physicalWindowsWord": "not verified"
|
||||||
|
}
|
||||||
46
Docs/Writer/ContextNavigationEvidence/release-summary.json
Normal file
46
Docs/Writer/ContextNavigationEvidence/release-summary.json
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"release": {
|
||||||
|
"application_sha256": "9d1aaf9cc2b945e11b25b70a24d00679da086af6df6ea03f10d7d569472e02a9",
|
||||||
|
"dll_sha256": "7fc84cb642bba8ddd9726acdcc5fed9566544b4adcff3a4ec09f37d47df3aa29",
|
||||||
|
"id": "development-context-navigation-9dcd29d423b2-20261127T201127Z",
|
||||||
|
"manifest_sha256": "0a20855b684d19e331c8e54c06d6a7745f9de56b87b743625f60b0ef395cda12",
|
||||||
|
"package_sha256": "0e3a92cfdd0108a306743c9a285ea41992ee3e2975b92bd4d5a16c9dfb6ef8e0",
|
||||||
|
"source_commit": "9dcd29d423b20e373e49fb28180d993c40aa165d",
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
|
"deploymentID": "20261127T201227Z-0cb5cdeff9f9",
|
||||||
|
"status": "activated",
|
||||||
|
"health": {
|
||||||
|
"database": "PlotDirector_Development",
|
||||||
|
"environment": "Development",
|
||||||
|
"healthy": true,
|
||||||
|
"sourceCommit": "9dcd29d423b20e373e49fb28180d993c40aa165d",
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
|
"verifiedBackup": true,
|
||||||
|
"executedMigrations": 0,
|
||||||
|
"schema": "3d6e163f7cb8fff6bd17834ae8097dcf68be03894ce644844621dc191336cb7a",
|
||||||
|
"gates": {
|
||||||
|
"source_commit": "9dcd29d423b20e373e49fb28180d993c40aa165d",
|
||||||
|
"results": [
|
||||||
|
{
|
||||||
|
"gate": "build",
|
||||||
|
"exit_code": 0,
|
||||||
|
"seconds": 40.85
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gate": "regression",
|
||||||
|
"exit_code": 0,
|
||||||
|
"seconds": 102.79
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gate": "publish",
|
||||||
|
"exit_code": 0,
|
||||||
|
"seconds": 30.39
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"regressionPassCount": 892,
|
||||||
|
"failures": [],
|
||||||
|
"productionAccess": false
|
||||||
|
}
|
||||||
@ -158,3 +158,18 @@ The new opt-in live smoke requires private disposable identity/scope files via `
|
|||||||
8. Interrupt/reconnect the notification connection and restore Word. Verify authoritative scene recovery and same-scene revalidation. Try an unsaved/missing mapping and confirm saved browsing/recovery explanations remain available.
|
8. Interrupt/reconnect the notification connection and restore Word. Verify authoritative scene recovery and same-scene revalidation. Try an unsaved/missing mapping and confirm saved browsing/recovery explanations remain available.
|
||||||
9. Open `?pinned=true&sceneId=<saved scene>&bookId=<book>` and verify Word movement does not retarget it. Manual scene navigation still works. Check an old Intent link redirects to Context with its scope/session intact.
|
9. Open `?pinned=true&sceneId=<saved scene>&bookId=<book>` and verify Word movement does not retarget it. Manual scene navigation still works. Check an old Intent link redirects to Context with its scope/session intact.
|
||||||
10. At 1366×768, a narrow browser and 125–200% browser zoom, check both orientations, scroll, labels and keyboard focus. Repeat in the installed PWA and physical Word environment when available. Signing out/expiring a session must produce sign-in/access feedback rather than nesting a login page in a pane.
|
10. At 1366×768, a narrow browser and 125–200% browser zoom, check both orientations, scroll, labels and keyboard focus. Repeat in the installed PWA and physical Word environment when available. Signing out/expiring a session must produce sign-in/access feedback rather than nesting a login page in a pane.
|
||||||
|
|
||||||
|
## Persistent companion navigation standard
|
||||||
|
|
||||||
|
Context remains open while the author visits full application pages. Every Context
|
||||||
|
feature must delegate main-page navigation through `context-main-window.js`, using
|
||||||
|
the existing `workspace.open` registry/interaction contract. Same-origin page links
|
||||||
|
in the Context document are delegated automatically, including refreshed partials
|
||||||
|
and expanded details. New destinations extend the central
|
||||||
|
`ContextWorkspaceNavigation` read-only route allowlist. Feature-specific discovery,
|
||||||
|
window creation and additional SignalR connections are prohibited.
|
||||||
|
|
||||||
|
Context-local interactions (tabs, scene navigation, Hold/Follow, spatial inspection,
|
||||||
|
Show on map/floor plan, edits and placement) remain within Context. Main application
|
||||||
|
Back buttons keep their normal behaviour. See the [shared navigation contract](Spatial-Context.md#main-application-navigation-from-context)
|
||||||
|
for exact destinations, legacy entity commands, launch fallback and browser limits.
|
||||||
|
|||||||
@ -4,21 +4,21 @@ const file=process.argv[2],pwa=process.argv.includes('--pwa'),base='https://dev.
|
|||||||
assert(file?.startsWith('/tmp/pd-dev-browser-'));const i=JSON.parse(fs.readFileSync(file)),f=i.SpatialFixture;assert(i.Database==='PlotDirector_Development'&&i.Email.startsWith('pwa-browser-')&&f&&i.NavigationCharacterID);fs.mkdirSync(out,{recursive:true});
|
assert(file?.startsWith('/tmp/pd-dev-browser-'));const i=JSON.parse(fs.readFileSync(file)),f=i.SpatialFixture;assert(i.Database==='PlotDirector_Development'&&i.Email.startsWith('pwa-browser-')&&f&&i.NavigationCharacterID);fs.mkdirSync(out,{recursive:true});
|
||||||
(async()=>{let browser,c,cdp,profile,step='login';const errors=[],checks=[];let focusWrites=0;try{
|
(async()=>{let browser,c,cdp,profile,step='login';const errors=[],checks=[];let focusWrites=0;try{
|
||||||
if(pwa){profile=fs.mkdtempSync('/tmp/pd-context-nav-pwa-');c=await chromium.launchPersistentContext(profile,{headless:false,viewport:{width:1600,height:1050}});cdp=await c.browser().newBrowserCDPSession();}else{browser=await chromium.launch();c=await browser.newContext({viewport:{width:1600,height:1050}});}
|
if(pwa){profile=fs.mkdtempSync('/tmp/pd-context-nav-pwa-');c=await chromium.launchPersistentContext(profile,{headless:false,viewport:{width:1600,height:1050}});cdp=await c.browser().newBrowserCDPSession();}else{browser=await chromium.launch();c=await browser.newContext({viewport:{width:1600,height:1050}});}
|
||||||
c.on('page',p=>p.on('pageerror',e=>errors.push(e.message)));c.on('request',r=>{if(/\/(?:SharedFocus|Writing\/Context|WriterWord)\/Navigate$/i.test(new URL(r.url()).pathname))focusWrites++;});let main=c.pages()[0]||await c.newPage();await main.goto(base+'/Account/Login');await main.locator('#Email').fill(i.Email);await main.locator('#Password').fill(i.Password);await Promise.all([main.waitForURL('**/Projects'),main.locator('form button[type=submit]').click()]);await main.goto(base+'/Projects/Details/'+i.ProjectID);
|
c.on('page',p=>p.on('pageerror',e=>errors.push(e.message)));c.on('request',r=>{if(/\/(?:SharedFocus|Writing\/Context|WriterWord)\/Navigate$/i.test(new URL(r.url()).pathname))focusWrites++;});let main=c.pages()[0]||await c.newPage();await main.goto(base+'/Account/Login');await main.locator('#Email').fill(i.Email);await main.locator('#Password').fill(i.Password);await Promise.all([main.waitForURL('**/Projects'),main.locator('form button[type=submit]').click()]);await main.goto(base+'/Scenes/Edit/'+f.scenes[1]);await main.goto(base+'/Projects/Details/'+i.ProjectID);focusWrites=0;
|
||||||
const url=base+`/Writing/Context?projectId=${i.ProjectID}&bookId=${i.BookID}&sceneId=${f.scenes[1]}&pinned=true`;let p;
|
const url=base+`/Writing/Context?projectId=${i.ProjectID}&bookId=${i.BookID}&sceneId=${f.scenes[1]}&pinned=true`;let p;
|
||||||
if(pwa){await cdp.send('PWA.install',{manifestId:base+'/Projects',installUrlOrBundleUrl:base+'/Projects'});await cdp.send('PWA.changeAppUserSettings',{manifestId:base+'/Projects',displayMode:'standalone'});const opened=c.waitForEvent('page');await cdp.send('PWA.launch',{manifestId:base+'/Projects',url});p=await opened;await p.waitForLoadState();assert(await p.evaluate(()=>matchMedia('(display-mode: standalone)').matches));}else{p=await c.newPage();await p.goto(url);}
|
if(pwa){await cdp.send('PWA.install',{manifestId:base+'/Projects',installUrlOrBundleUrl:base+'/Projects'});await cdp.send('PWA.changeAppUserSettings',{manifestId:base+'/Projects',displayMode:'standalone'});const opened=c.waitForEvent('page');await cdp.send('PWA.launch',{manifestId:base+'/Projects',url});p=await opened;await p.waitForLoadState();assert(await p.evaluate(()=>matchMedia('(display-mode: standalone)').matches));}else{p=await c.newPage();await p.goto(url);}
|
||||||
const tabs=n=>`[data-context-pane="${n}"] [data-context-tab]`;await p.selectOption(tabs(0),'locations');await p.getByRole('heading',{name:'Bedroom',exact:true}).waitFor();await p.selectOption('[data-context-layout]','columns');await p.selectOption(tabs(1),'maps');await p.waitForFunction(()=>document.querySelector('iframe')?.contentWindow?.PlotDirectorMapWorkspace?.document.features.length>0);await p.evaluate(()=>document.querySelector('iframe').contentWindow.PlotDirectorMapWorkspace.setView({x:10,y:20,w:900,h:650}));
|
const tabs=n=>`[data-context-pane="${n}"] [data-context-tab]`;await p.selectOption(tabs(0),'locations');await p.getByRole('heading',{name:'Bedroom',exact:true}).waitFor();await p.selectOption('[data-context-layout]','columns');await p.selectOption(tabs(1),'maps');await p.waitForFunction(()=>document.querySelector('iframe')?.contentWindow?.PlotDirectorMapWorkspace?.document.features.length>0);await p.evaluate(()=>document.querySelector('iframe').contentWindow.PlotDirectorMapWorkspace.setView({x:10,y:20,w:900,h:650}));
|
||||||
const snap=()=>p.evaluate(()=>({url:location.href,layout:document.querySelector('[data-context-layout]').value,tabs:[...document.querySelectorAll('[data-context-tab]')].map(n=>n.value),scene:document.querySelector('[data-context-scene]').value,position:document.querySelector('[data-context-workspace]').contextController.position,hold:document.querySelector('[data-shared-focus-hold]').getAttribute('aria-pressed'),selection:document.querySelector('[data-spatial-details] h2')?.textContent,view:document.querySelector('iframe')?.contentWindow?.PlotDirectorMapWorkspace?.view,scroll:[...document.querySelectorAll('[data-context-pane-body], [data-spatial-details]')].map(n=>[n.scrollLeft,n.scrollTop])}));
|
const snap=()=>p.evaluate(()=>({url:location.href,layout:document.querySelector('[data-context-layout]').value,tabs:[...document.querySelectorAll('[data-context-tab]')].map(n=>n.value),scene:document.querySelector('[data-context-scene]').value,position:document.querySelector('[data-context-workspace]').contextController.position,hold:document.querySelector('[data-shared-focus-hold]').getAttribute('aria-pressed'),selection:document.querySelector('[data-spatial-details] h2')?.textContent,floorView:document.querySelector('[data-spatial-floor-world]')?.style.transform,view:document.querySelector('iframe')?.contentWindow?.PlotDirectorMapWorkspace?.view,scroll:[...document.querySelectorAll('[data-context-pane-body], [data-spatial-details]')].map(n=>[n.scrollLeft,n.scrollTop])}));
|
||||||
const ready=async()=>{await p.waitForFunction(book=>document.querySelector('[data-context-workspace]').contextController.connection?.state==='Connected'&&document.querySelector('[data-context-workspace]').contextController.connection.invoke('MyContextWindows',book).then(rows=>rows.some(r=>r.kind==='main'&&r.environmentID===window.PlotDirectorContextEnvironment)),i.BookID);await p.waitForTimeout(600);};
|
const ready=async()=>{await p.waitForFunction(book=>document.querySelector('[data-context-workspace]').contextController.connection?.state==='Connected'&&document.querySelector('[data-context-workspace]').contextController.connection.invoke('MyContextWindows',book).then(rows=>rows.some(r=>r.kind==='main'&&r.environmentID===window.PlotDirectorContextEnvironment)),i.BookID);await p.waitForTimeout(600);};
|
||||||
async function follow(link,expected){step=expected;await ready();await link.scrollIntoViewIfNeeded();const before=await snap(),count=c.pages().length;await link.click();await main.waitForURL(u=>u.pathname+u.search===expected);assert.equal(c.pages().length,count);assert.deepEqual(await snap(),before);checks.push(expected);}
|
async function follow(link,expected){step=expected;await ready();await link.scrollIntoViewIfNeeded();const before=await snap(),count=c.pages().length;await link.click();await main.waitForURL(u=>u.pathname+u.search===expected);assert.equal(c.pages().length,count);assert.deepEqual(await snap(),before);checks.push(expected);}
|
||||||
step='existing spatial main reuse';await follow(p.getByRole('link',{name:'Location Details',exact:true}),`/Locations/Details/${f.locations[1]}`);await follow(p.getByRole('link',{name:'Edit Location',exact:true}),`/Locations/Edit/${f.locations[1]}`);const mapped=new URL(await p.getByRole('link',{name:'Open in Maps',exact:true}).getAttribute('href'),base);assert(mapped.searchParams.get('featureId'));await follow(p.getByRole('link',{name:'Open in Maps',exact:true}),mapped.pathname+mapped.search);await p.screenshot({path:out+`/${pwa?'pwa':'browser'}-locations-maps-preserved.png`});
|
step='companion chrome main reuse';await follow(p.getByRole('link',{name:'PlotDirector',exact:true}),'/Writer');step='existing spatial main reuse';await follow(p.getByRole('link',{name:'Location Details',exact:true}),`/Locations/Details/${f.locations[1]}`);await follow(p.getByRole('link',{name:'Edit Location',exact:true}),`/Locations/Edit/${f.locations[1]}`);const backState=await snap();await main.goBack();await main.waitForURL('**/Locations/Details/'+f.locations[1]);assert.deepEqual(await snap(),backState);checks.push('normal main-window Back history');const mapped=new URL(await p.getByRole('link',{name:'Open in Maps',exact:true}).getAttribute('href'),base);assert(mapped.searchParams.get('featureId'));await follow(p.getByRole('link',{name:'Open in Maps',exact:true}),mapped.pathname+mapped.search);await p.screenshot({path:out+`/${pwa?'pwa':'browser'}-locations-maps-preserved.png`});
|
||||||
step='floor exact block and split preservation';await p.selectOption(tabs(1),'floorplans');await p.locator('[data-block]').first().waitFor();const floorUrl=new URL(await p.getByRole('link',{name:'Open in Floor Plans',exact:true}).getAttribute('href'),base);assert(floorUrl.searchParams.get('selectedBlockId'));await follow(p.getByRole('link',{name:'Open in Floor Plans',exact:true}),floorUrl.pathname+floorUrl.search);await p.screenshot({path:out+`/${pwa?'pwa':'browser'}-locations-floorplans-preserved.png`});
|
step='floor exact block and split preservation';await p.selectOption(tabs(1),'floorplans');await p.locator('[data-block]').first().waitFor();const floorUrl=new URL(await p.getByRole('link',{name:'Open in Floor Plans',exact:true}).getAttribute('href'),base);assert(floorUrl.searchParams.get('selectedBlockId'));await follow(p.getByRole('link',{name:'Open in Floor Plans',exact:true}),floorUrl.pathname+floorUrl.search);await p.screenshot({path:out+`/${pwa?'pwa':'browser'}-locations-floorplans-preserved.png`});
|
||||||
step='Characters and expanded details';await p.selectOption(tabs(0),'characters');const row=p.locator(`[data-context-character="${i.NavigationCharacterID}"]`);await row.waitFor();if(!await row.evaluate(n=>n.open))await row.locator('summary').click();await follow(p.locator(`a[data-context-workspace-target="characters"][data-context-entity="${i.NavigationCharacterID}"]`).last(),`/Characters/Details/${i.NavigationCharacterID}`);
|
step='Characters and expanded details';await p.selectOption(tabs(0),'characters');const row=p.locator(`[data-context-character="${i.NavigationCharacterID}"]`);await row.waitFor();if(!await row.evaluate(n=>n.open))await row.locator('summary').click();await follow(p.locator(`a[data-context-workspace-target="characters"][data-context-entity="${i.NavigationCharacterID}"]`).last(),`/Characters/Details/${i.NavigationCharacterID}`);
|
||||||
// Edit Character is supplied by the shared Name Details partial; dynamic-anchor
|
// Edit Character is supplied by the shared Name Details partial; dynamic-anchor
|
||||||
// coverage uses exactly its unmarked href contract without changing author data.
|
// coverage uses exactly its unmarked href contract without changing author data.
|
||||||
await p.evaluate(id=>{const a=document.createElement('a');a.textContent='Edit fixture Character';a.href='/Characters/Edit/'+id;document.querySelector('[data-character-explorer]').append(a);},i.NavigationCharacterID);await follow(p.getByRole('link',{name:'Edit fixture Character',exact:true}),`/Characters/Edit/${i.NavigationCharacterID}`);
|
await p.evaluate(id=>{const a=document.createElement('a');a.textContent='Edit fixture Character';a.href='/Characters/Edit/'+id;document.querySelector('[data-character-explorer]').append(a);},i.NavigationCharacterID);await follow(p.getByRole('link',{name:'Edit fixture Character',exact:true}),`/Characters/Edit/${i.NavigationCharacterID}`);
|
||||||
step='Overview main links';await p.selectOption(tabs(0),'overview');const calendar=p.locator('a[href^="/StoryCalendar"]').first();await calendar.waitFor();const cal=new URL(await calendar.getAttribute('href'),base);await follow(calendar,cal.pathname+cal.search);const storyMaps=p.locator('a[href^="/Maps"]').first(),storyUrl=new URL(await storyMaps.getAttribute('href'),base);await follow(storyMaps,storyUrl.pathname+storyUrl.search);
|
step='Overview main links';await p.selectOption(tabs(0),'overview');const calendar=p.locator('a[href^="/StoryCalendar"]').first();await calendar.waitFor();const cal=new URL(await calendar.getAttribute('href'),base);await follow(calendar,cal.pathname+cal.search);const storyMaps=p.locator('a[href^="/Maps"]').first(),storyUrl=new URL(await storyMaps.getAttribute('href'),base);await follow(storyMaps,storyUrl.pathname+storyUrl.search);
|
||||||
step='multiple Context and following';const second=await c.newPage();await second.goto(url.replace('&pinned=true',''));await second.selectOption(tabs(0),'locations');await second.getByRole('heading',{name:'Bedroom',exact:true}).waitFor();await ready();const original=await snap();await second.getByRole('link',{name:'Location Details',exact:true}).click();await main.waitForURL('**/Locations/Details/'+f.locations[1]);assert.deepEqual(await snap(),original);assert.equal(await second.locator('[data-context-scene]').inputValue(),String(f.scenes[1]));checks.push('independent held/following Context windows');
|
step='multiple Context and following';const second=await c.newPage();await second.goto(url.replace('&pinned=true',''));await second.selectOption(tabs(0),'locations');await second.getByRole('heading',{name:'Bedroom',exact:true}).waitFor();await ready();const original=await snap();await second.getByRole('link',{name:'Location Details',exact:true}).click();await main.waitForURL('**/Locations/Details/'+f.locations[1]);assert.deepEqual(await snap(),original);assert.equal(await second.locator('[data-context-scene]').inputValue(),String(f.scenes[1]));assert.equal(await second.locator('[data-shared-focus-hold]').getAttribute('aria-pressed'),'false');checks.push('independent held/following Context windows');
|
||||||
step='closed main location fallback and rapid reuse';await p.selectOption(tabs(0),'locations');await p.getByRole('heading',{name:'Bedroom',exact:true}).waitFor();await main.close();await p.waitForTimeout(700);const pop=p.waitForEvent('popup');await p.getByRole('link',{name:'Location Details',exact:true}).click();main=await pop;await main.waitForURL('**/Locations/Details/'+f.locations[1]);await follow(p.getByRole('link',{name:'Open in Floor Plans',exact:true}),floorUrl.pathname+floorUrl.search);checks.push('closed-main fallback reused');
|
step='closed main location fallback and rapid reuse';await p.selectOption(tabs(0),'locations');await p.getByRole('heading',{name:'Bedroom',exact:true}).waitFor();await main.close();await p.waitForTimeout(700);const pop=p.waitForEvent('popup');await p.getByRole('link',{name:'Location Details',exact:true}).click();main=await pop;await main.waitForURL('**/Locations/Details/'+f.locations[1]);await follow(p.getByRole('link',{name:'Open in Floor Plans',exact:true}),floorUrl.pathname+floorUrl.search);checks.push('closed-main fallback reused');
|
||||||
step='Context internal editing';await p.getByRole('button',{name:'Edit description',exact:true}).click();await p.locator('[data-spatial-operation] textarea').waitFor();await follow(p.getByRole('link',{name:'Location Details',exact:true}),`/Locations/Details/${f.locations[1]}`);assert(await p.locator('[data-spatial-operation] textarea').isVisible());await p.getByRole('button',{name:'Cancel',exact:true}).click();
|
step='Context internal editing';await p.getByRole('button',{name:'Edit description',exact:true}).click();await p.locator('[data-spatial-operation] textarea').waitFor();await follow(p.getByRole('link',{name:'Location Details',exact:true}),`/Locations/Details/${f.locations[1]}`);assert(await p.locator('[data-spatial-operation] textarea').isVisible());await p.getByRole('button',{name:'Cancel',exact:true}).click();
|
||||||
assert.deepEqual(errors,[]);assert.equal(focusWrites,0);const signalRConnections=await p.evaluate(()=>performance.getEntriesByType('resource').filter(r=>r.name.includes('/hubs/native-companion/negotiate')).length);assert.equal(signalRConnections,1);fs.writeFileSync(out+`/${pwa?'pwa':'browser'}-results.json`,JSON.stringify({passed:true,authenticated:true,installedPwa:pwa,checks,focusWrites,signalRConnections,errors,physicalWindowsWord:false},null,2));console.log('PASS authenticated '+(pwa?'installed PWA':'browser')+' external Context navigation: exact routes, existing/closed-main reuse, two held/following windows, split/map viewport retained, inline draft retained.');
|
assert.deepEqual(errors,[]);assert.equal(focusWrites,0);const signalRConnections=await p.evaluate(()=>performance.getEntriesByType('resource').filter(r=>r.name.includes('/hubs/native-companion/negotiate')).length);assert.equal(signalRConnections,1);fs.writeFileSync(out+`/${pwa?'pwa':'browser'}-results.json`,JSON.stringify({passed:true,authenticated:true,installedPwa:pwa,checks,focusWrites,signalRConnections,errors,physicalWindowsWord:false},null,2));console.log('PASS authenticated '+(pwa?'installed PWA':'browser')+' external Context navigation: exact routes, existing/closed-main reuse, two held/following windows, split/map viewport retained, inline draft retained.');
|
||||||
|
|||||||
@ -3,13 +3,13 @@ const {chromium}=require('playwright'),assert=require('node:assert/strict'),fs=r
|
|||||||
const base='http://127.0.0.1:5238';
|
const base='http://127.0.0.1:5238';
|
||||||
(async()=>{const browser=await chromium.launch();let step='setup';try{const c=await browser.newContext({viewport:{width:1500,height:1000}});const errors=[];c.on('page',p=>p.on('pageerror',e=>errors.push(e.message)));
|
(async()=>{const browser=await chromium.launch();let step='setup';try{const c=await browser.newContext({viewport:{width:1500,height:1000}});const errors=[];c.on('page',p=>p.on('pageerror',e=>errors.push(e.message)));
|
||||||
for(const route of ['**/native-companion/status','**/native-companion/connection-state'])await c.route(route,r=>r.fulfill({json:[]}));await c.route('**/Writing/Context/Position?*',r=>r.fulfill({json:{connected:false}}));await c.route('**/Writing/Context/Tabs/*',r=>r.fulfill({body:'<div data-context-tab-fragment data-book-id="12" data-scene-id="22">Existing tool</div>',contentType:'text/html'}));
|
for(const route of ['**/native-companion/status','**/native-companion/connection-state'])await c.route(route,r=>r.fulfill({json:[]}));await c.route('**/Writing/Context/Position?*',r=>r.fulfill({json:{connected:false}}));await c.route('**/Writing/Context/Tabs/*',r=>r.fulfill({body:'<div data-context-tab-fragment data-book-id="12" data-scene-id="22">Existing tool</div>',contentType:'text/html'}));
|
||||||
for(const route of ['/Locations/**','/Characters/Details/**','/Characters/Edit/**','/FloorPlans/Edit/**','/StoryCalendar*','/PlotThreads/Edit/**','/RelationshipMap*','/Books/Details/**','/manuscript/paragraphs*'])await c.route(base+route,async r=>{if(r.request().isNavigationRequest())await r.fulfill({response:await r.fetch({url:base+'/fixture?layout=full'})});else await r.continue();});
|
for(const route of ['/Locations/**','/Characters/Details/**','/Characters/Edit/**','/FloorPlans/Edit/**','/StoryCalendar*','/PlotThreads/Edit/**','/RelationshipMap*','/Books/Details/**','/manuscript/paragraphs*','/Writer'])await c.route(base+route,async r=>{if(r.request().isNavigationRequest())await r.fulfill({response:await r.fetch({url:base+'/fixture?layout=full'})});else await r.continue();});
|
||||||
await c.route(base+'/Maps?*',async r=>{if(r.request().isNavigationRequest())await r.fulfill({response:await r.fetch({url:base+'/fixture?layout=full'})});else await r.continue();});
|
await c.route(base+'/Maps?*',async r=>{if(r.request().isNavigationRequest())await r.fulfill({response:await r.fetch({url:base+'/fixture?layout=full'})});else await r.continue();});
|
||||||
let main=await c.newPage();await main.goto(base+'/fixture?layout=full');const p=await c.newPage();await p.goto(base+'/Writing/Context?pinned=true');await p.selectOption('[data-context-pane="0"] [data-context-tab]','locations');await p.getByRole('heading',{name:'Bedroom',exact:true}).waitFor();await p.selectOption('[data-context-layout]','columns');await p.selectOption('[data-context-pane="1"] [data-context-tab]','maps');await p.waitForFunction(()=>document.querySelector('iframe')?.contentWindow?.PlotDirectorMapWorkspace?.document.features.length===2);await p.evaluate(()=>document.querySelector('iframe').contentWindow.PlotDirectorMapWorkspace.setView({x:50,y:60,w:900,h:700}));
|
let main=await c.newPage();await main.goto(base+'/fixture?layout=full');const p=await c.newPage();await p.goto(base+'/Writing/Context?pinned=true');await p.selectOption('[data-context-pane="0"] [data-context-tab]','locations');await p.getByRole('heading',{name:'Bedroom',exact:true}).waitFor();await p.selectOption('[data-context-layout]','columns');await p.selectOption('[data-context-pane="1"] [data-context-tab]','maps');await p.waitForFunction(()=>document.querySelector('iframe')?.contentWindow?.PlotDirectorMapWorkspace?.document.features.length===2);await p.evaluate(()=>document.querySelector('iframe').contentWindow.PlotDirectorMapWorkspace.setView({x:50,y:60,w:900,h:700}));
|
||||||
const snapshot=()=>p.evaluate(()=>({url:location.href,layout:document.querySelector('[data-context-layout]').value,tabs:[...document.querySelectorAll('[data-context-tab]')].map(n=>n.value),position:document.querySelector('[data-context-workspace]').contextController.position,held:document.querySelector('[data-context-workspace]').contextController.held,heading:document.querySelector('[data-spatial-details] h2')?.textContent,view:document.querySelector('iframe')?.contentWindow?.PlotDirectorMapWorkspace?.view}));
|
const snapshot=()=>p.evaluate(()=>({url:location.href,layout:document.querySelector('[data-context-layout]').value,tabs:[...document.querySelectorAll('[data-context-tab]')].map(n=>n.value),position:document.querySelector('[data-context-workspace]').contextController.position,held:document.querySelector('[data-context-workspace]').contextController.held,heading:document.querySelector('[data-spatial-details] h2')?.textContent,view:document.querySelector('iframe')?.contentWindow?.PlotDirectorMapWorkspace?.view}));
|
||||||
const before=await snapshot(),count=c.pages().length;const ready=async()=>{await p.waitForFunction(()=>document.querySelector('[data-context-workspace]').contextController.connection?.state==='Connected'&&document.querySelector('[data-context-workspace]').contextController.connection.invoke('MyContextWindows',12).then(rows=>rows.some(r=>r.kind==='main')));await p.waitForTimeout(600);};
|
const before=await snapshot(),count=c.pages().length;const ready=async()=>{await p.waitForFunction(()=>document.querySelector('[data-context-workspace]').contextController.connection?.state==='Connected'&&document.querySelector('[data-context-workspace]').contextController.connection.invoke('MyContextWindows',12).then(rows=>rows.some(r=>r.kind==='main')));await p.waitForTimeout(600);};
|
||||||
async function go(label,expected){console.log("CHECK",label,expected);await ready();await p.getByRole('link',{name:label,exact:true}).click();await main.waitForURL(u=>u.pathname+u.search===expected);assert.equal(c.pages().length,count);assert.deepEqual(await snapshot(),before);}
|
async function go(label,expected){console.log("CHECK",label,expected);await ready();const link=p.getByRole('link',{name:label,exact:true});if(label==='Calendar')await link.click({modifiers:['Control']});else if(label==='Thread'){await link.focus();await p.keyboard.press('Enter');}else if(label==='Book')await link.click({button:'middle'});else await link.click();await main.waitForURL(u=>u.pathname+u.search===expected);assert.equal(c.pages().length,count);assert.deepEqual(await snapshot(),before);}
|
||||||
step='spatial exact URLs in existing main';await go('Location Details','/Locations/Details/103');await go('Edit Location','/Locations/Edit/103');const mapUrl=new URL(await p.getByRole('link',{name:'Open in Maps',exact:true}).getAttribute('href'),base);await go('Open in Maps',mapUrl.pathname+mapUrl.search);
|
step='companion header main link';await go('PlotDirector','/Writer');step='spatial exact URLs in existing main';await go('Location Details','/Locations/Details/103');await go('Edit Location','/Locations/Edit/103');const mapUrl=new URL(await p.getByRole('link',{name:'Open in Maps',exact:true}).getAttribute('href'),base);await go('Open in Maps',mapUrl.pathname+mapUrl.search);
|
||||||
step='dynamic links, modifiers, keyboard and selected blocks';const links=[['Floor editor','/FloorPlans/Edit/9?selectedBlockId=51'],['Edit Character','/Characters/Edit/5'],['Character Details','/Characters/Details/5'],['Calendar','/StoryCalendar?projectId=7&bookId=12'],['Thread','/PlotThreads/Edit/6'],['Book','/Books/Details/12'],['Structure','/manuscript/paragraphs?bookId=12']];for(const [label,url] of links){await p.evaluate(([text,href])=>{const a=document.createElement('a');a.textContent=text;a.href=href;document.querySelector('[data-context-pane="1"]').append(a);},[label,url]);await go(label,url);}
|
step='dynamic links, modifiers, keyboard and selected blocks';const links=[['Floor editor','/FloorPlans/Edit/9?selectedBlockId=51'],['Edit Character','/Characters/Edit/5'],['Character Details','/Characters/Details/5'],['Calendar','/StoryCalendar?projectId=7&bookId=12'],['Thread','/PlotThreads/Edit/6'],['Book','/Books/Details/12'],['Structure','/manuscript/paragraphs?bookId=12']];for(const [label,url] of links){await p.evaluate(([text,href])=>{const a=document.createElement('a');a.textContent=text;a.href=href;document.querySelector('[data-context-pane="1"]').append(a);},[label,url]);await go(label,url);}
|
||||||
step='multiple Context windows';const second=await c.newPage();await second.goto(base+'/Writing/Context?pinned=true');await second.selectOption('[data-context-pane="0"] [data-context-tab]','locations');await second.getByRole('heading',{name:'Bedroom',exact:true}).waitFor();await ready();await second.getByRole('link',{name:'Edit Location',exact:true}).click();await main.waitForURL('**/Locations/Edit/103');assert.deepEqual(await snapshot(),before);
|
step='multiple Context windows';const second=await c.newPage();await second.goto(base+'/Writing/Context?pinned=true');await second.selectOption('[data-context-pane="0"] [data-context-tab]','locations');await second.getByRole('heading',{name:'Bedroom',exact:true}).waitFor();await ready();await second.getByRole('link',{name:'Edit Location',exact:true}).click();await main.waitForURL('**/Locations/Edit/103');assert.deepEqual(await snapshot(),before);
|
||||||
step='closed main and rapid requests';await main.close();await p.waitForTimeout(600);await p.evaluate(()=>{const a=document.createElement('a');a.textContent='Fallback main';a.href='/Characters?projectId=7';document.querySelector('[data-spatial-details]').append(a);});const popup=p.waitForEvent('popup');await p.getByRole('link',{name:'Fallback main',exact:true}).click();main=await popup;await main.waitForURL('**/Characters?projectId=7');await p.getByRole('link',{name:'Open in Maps',exact:true}).click();await main.waitForURL(u=>u.pathname+u.search===mapUrl.pathname+mapUrl.search);assert.equal(c.pages().length,count+1);assert.deepEqual(await snapshot(),before);
|
step='closed main and rapid requests';await main.close();await p.waitForTimeout(600);await p.evaluate(()=>{const a=document.createElement('a');a.textContent='Fallback main';a.href='/Characters?projectId=7';document.querySelector('[data-spatial-details]').append(a);});const popup=p.waitForEvent('popup');await p.getByRole('link',{name:'Fallback main',exact:true}).click();main=await popup;await main.waitForURL('**/Characters?projectId=7');await p.getByRole('link',{name:'Open in Maps',exact:true}).click();await main.waitForURL(u=>u.pathname+u.search===mapUrl.pathname+mapUrl.search);assert.equal(c.pages().length,count+1);assert.deepEqual(await snapshot(),before);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user