diff --git a/PlotLine.Tests/Browser/context-locations-development.cjs b/PlotLine.Tests/Browser/context-locations-development.cjs index 5e55d59f..c0464b17 100644 --- a/PlotLine.Tests/Browser/context-locations-development.cjs +++ b/PlotLine.Tests/Browser/context-locations-development.cjs @@ -8,7 +8,7 @@ let session,stage='login'; const book=await session.create('Books','?projectId='+project,{BookTitle:'Directional acceptance',BookNumber:1}); const chapter=await session.create('Chapters','?bookId='+book,{ChapterTitle:'Test chapter',ChapterNumber:1}); await session.goto('/Scenes/Create?chapterId='+chapter);await p.locator('#SceneTitle').fill('Sight and sound');await p.locator('#PrimaryLocationID').selectOption(String(room));await p.getByRole('button',{name:'Create scene',exact:true}).click();await p.waitForURL('**/Scenes/Edit/*');const scene=Number(new URL(p.url()).pathname.split('/').at(-1)); - stage='directional relationship form';await session.goto('/Locations/Details/'+room);const form=p.locator('form[action="/Locations/AddRelationship"]');await form.locator('[name=ToLocationID]').selectOption(String(yard));await form.locator('[name=CanSeeMovement]').check();await form.locator('[name=CanHearLoudNoise]').check();await form.locator('[name=IsBidirectional]').check();await form.locator('[name=Notes]').fill('Directional saved evidence');await form.locator('button[type=submit]').click();await p.waitForURL('**/Locations/Details/'+room); + stage='directional relationship form';await session.goto('/Locations/Details/'+room);const form=p.locator('form[action="/Locations/AddRelationship"]');await form.getByRole('button',{name:'Choose related location',exact:true}).click();await p.locator('dialog').getByRole('button',{name:'Courtyard',exact:true}).click();await p.locator('dialog').getByRole('button',{name:'Choose location',exact:true}).click();await form.locator('[name=CanSeeMovement]').check();await form.locator('[name=CanHearLoudNoise]').check();await form.locator('[name=IsBidirectional]').check();await form.locator('[name=Notes]').fill('Directional saved evidence');await form.locator('button[type=submit]').click();await p.waitForURL('**/Locations/Details/'+room); stage='recorded character form';const character=await session.create('Characters','?projectId='+project,{CharacterName:'Recorded observer'},async page=>{const custom=page.locator('[name=CustomSex]');if(await custom.count()&&await custom.isEnabled())await custom.fill('Unspecified');}); await session.goto('/Scenes/SceneCharactersEditor?sceneId='+scene);await session.post('/Scenes/SaveSceneCharacters',{SceneID:scene,'NewCharacter.CharacterID':character,'NewCharacter.LocationID':room}); const feature=`/Writing/Context?projectId=${project}&bookId=${book}&chapterId=${chapter}&sceneId=${scene}&pinned=true`; @@ -21,7 +21,7 @@ let session,stage='login'; stage='incoming direction without reciprocity';const state=await p.evaluate(async url=>{const response=await fetch(url,{cache:'no-store'});if(!response.ok)throw Error('State unavailable');return response.json();},`/SpatialContext/State?bookId=${book}&sceneId=${scene}&locationId=${yard}`);assert.equal(state.sensoryRelationships.length,1);assert.equal(state.sensoryRelationships[0].fromLocationID,room);assert.equal(state.sensoryRelationships[0].toLocationID,yard); // Inspect the destination through the existing window-local spatial bus. await p.evaluate(id=>{const root=document.querySelector('[data-context-workspace]');window.PlotDirectorSpatialContext.inspect(root,id,'acceptance');},yard);await p.locator('[data-spatial-details] h2').filter({hasText:'Courtyard'}).waitFor();const host=p.locator('[data-spatial-details]');assert.equal(await host.getByRole('link',{name:'Observation room',exact:true}).count(),2);assert.equal(await host.getByText('Unknown / unset: no relationship recorded in this direction.',{exact:true}).count(),2); - console.log(JSON.stringify({passed:true,project,book,scene,checks:['normal relationship and character saves','four directional groups','unset flags','no reciprocal inference despite both-ways flag','recorded presence','split layout','narrow viewport','fresh-login persistence','incoming inspection'],featureUrl:'https://dev.plotdirector.com'+feature})); + console.log(JSON.stringify({passed:true,project,book,scene,checks:['normal relationship and character saves','four directional groups','unset flags','no reciprocal inference despite both-ways flag','recorded presence','existing main-window navigation','split layout','narrow viewport','fresh-login persistence','incoming inspection'],featureUrl:'https://dev.plotdirector.com'+feature})); }catch{console.error('Locations acceptance failed at '+stage+'; no credentials logged.');process.exitCode=1;} finally{if(session){try{await session.cleanup();console.log('PASS disposable project cleanup');}catch{console.error('Cleanup incomplete; preserve journal.');process.exitCode=1;}finally{await session.close();}}} })();