Align spatial browser regression with read-only Context Maps

This commit is contained in:
Atlas Development Worker 2026-12-01 12:42:19 +00:00
parent 6c9106131c
commit 628a147c65

View File

@ -16,8 +16,8 @@ step='maps floor';await page.selectOption(tab(0),'maps');await pane(0).locator('
step='same building retains renderer and viewport';await page.evaluate(()=>{window.spatialFrame=document.querySelector('[data-context-pane="0"] iframe');spatialFrame.contentWindow.PlotDirectorMapWorkspace.setView({x:-250,y:-200,w:900,h:600});document.querySelector('[data-context-workspace]').contextController.setPosition({projectId:7,bookId:12,chapterId:10,sceneId:24});});await pane(0).locator('[data-scene-position="0"] button').filter({hasText:'Lounge'}).waitFor();assert.equal(await page.evaluate(()=>window.spatialFrame===document.querySelector('[data-context-pane="0"] iframe')),true);assert.equal(await page.evaluate(()=>window.spatialFrame.contentWindow.PlotDirectorMapWorkspace.view.w),900);await shot('10-repeated-location');await page.evaluate(()=>document.querySelector('[data-context-workspace]').contextController.setPosition({projectId:7,bookId:12,chapterId:10,sceneId:22}));await pane(0).locator('[data-scene-position="0"] button').filter({hasText:'Bedroom'}).waitFor();
step='paragraph no loading';const before=requests.length;await page.evaluate(()=>document.querySelector('[data-context-workspace]').contextController.setPosition({projectId:7,bookId:12,chapterId:10,sceneId:22,paragraphId:'a-paragraph'}));await page.waitForTimeout(100);assert.equal(requests.length,before);
step='active edit stays pinned';await page.selectOption('[data-context-layout]','columns');await page.selectOption(tab(0),'locations');await pane(0).getByRole('button',{name:'Edit description'}).click();await pane(0).locator('textarea').fill('Unsaved author draft');await page.evaluate(()=>document.querySelector('[data-context-workspace]').contextController.setPosition({projectId:7,bookId:12,chapterId:10,sceneId:23}));assert.equal(await pane(0).locator('textarea').inputValue(),'Unsaved author draft');assert.equal(await pane(0).locator('[data-spatial-context]').getAttribute('data-scene-id'),'22');for(const close of await page.locator('[data-toast-host] button').all())await close.click();await pane(0).getByRole('button',{name:'Cancel',exact:true}).click();await pane(0).getByText('This scene has no assigned location.',{exact:false}).waitFor();await shot('15-unassigned');
step='placement cancellation and rejected write';await page.evaluate(()=>document.querySelector('[data-context-workspace]').contextController.setPosition({projectId:7,bookId:12,chapterId:10,sceneId:22}));await pane(0).getByRole('heading',{name:'Bedroom',exact:true}).waitFor();await page.selectOption(tab(1),'maps');await pane(1).locator('iframe').waitFor();await page.waitForFunction(()=>document.querySelector('[data-context-pane="1"] iframe')?.contentWindow?.PlotDirectorMapWorkspace?.document.features.length===2);await pane(0).getByRole('button',{name:'Place on map',exact:true}).click();await pane(1).locator('[data-spatial-operation]').filter({hasText:'Place existing location: Bedroom'}).waitFor();await shot('13-map-placement');let attempted;await page.route('**/SpatialContext/Mutate',route=>{attempted=route.request().postDataJSON();return route.fulfill({status:409,json:{message:'Synthetic concurrent change; previous geometry retained.'}});});const mapFrame=page.frames().find(f=>f.url().includes('/SpatialContext/Map'));await mapFrame.locator('#mapsCanvas').click({position:{x:100,y:100}});await pane(1).getByText('Synthetic concurrent change; previous geometry retained.').waitFor();assert.equal(attempted.locationID,103);assert.equal(attempted.sceneID,22);assert.equal(attempted.kind,'map');assert.equal(await mapFrame.evaluate(()=>PlotDirectorMapWorkspace.document.features.length),2);await pane(1).getByRole('button',{name:'Cancel',exact:true}).click();
step='native cross-pane location drop';const dragSource=await pane(0).getByRole('heading',{name:'Bedroom',exact:true}).boundingBox(),dropTarget=await mapFrame.locator('#mapsCanvas').boundingBox();await page.mouse.move(dragSource.x+30,dragSource.y+10);await page.mouse.down();await page.mouse.move(dragSource.x+60,dragSource.y+12,{steps:5});await page.mouse.move(dropTarget.x+100,dropTarget.y+100,{steps:25});await page.mouse.up();await pane(1).getByRole('button',{name:'Confirm',exact:true}).waitFor();await shot('13-native-cross-pane-drop');await pane(1).getByRole('button',{name:'Cancel',exact:true}).click();
step='read-only map browsing';await page.evaluate(()=>document.querySelector('[data-context-workspace]').contextController.setPosition({projectId:7,bookId:12,chapterId:10,sceneId:22}));await pane(0).getByRole('heading',{name:'Bedroom',exact:true}).waitFor();await page.selectOption(tab(1),'maps');await pane(1).locator('iframe').waitFor();await page.waitForFunction(()=>document.querySelector('[data-context-pane="1"] iframe')?.contentWindow?.PlotDirectorMapWorkspace?.document.features.length===2);assert.equal(await pane(1).locator('[data-spatial-place]').count(),0);assert.equal(await pane(0).getByRole('link',{name:'Place in Maps',exact:true}).count(),1);let attempted;await page.route('**/SpatialContext/Mutate',route=>{attempted=route.request().postDataJSON();return route.fulfill({status:409,json:{message:'Synthetic concurrent change; previous geometry retained.'}});});const mapFrame=page.frames().find(f=>f.url().includes('/SpatialContext/Map'));await mapFrame.locator('#mapsCanvas').click({position:{x:100,y:100}});assert.equal(attempted,undefined);assert.equal(await mapFrame.evaluate(()=>PlotDirectorMapWorkspace.mode),'explore');await shot('13-read-only-map');
step='native cross-pane map drop is ignored';const dragSource=await pane(0).getByRole('heading',{name:'Bedroom',exact:true}).boundingBox(),dropTarget=await mapFrame.locator('#mapsCanvas').boundingBox();await page.mouse.move(dragSource.x+30,dragSource.y+10);await page.mouse.down();await page.mouse.move(dragSource.x+60,dragSource.y+12,{steps:5});await page.mouse.move(dropTarget.x+100,dropTarget.y+100,{steps:25});await page.mouse.up();assert.equal(await pane(1).getByRole('button',{name:'Confirm',exact:true}).count(),0);assert.equal(attempted,undefined);assert.equal(await mapFrame.evaluate(()=>PlotDirectorMapWorkspace.document.features.length),2);
step='room association reviewed conflict';await page.selectOption(tab(1),'floorplans');await pane(1).locator('[data-block="52"]').waitFor();await pane(1).locator('[data-block="52"]').click();await page.route('**/LocationWorkspace/Picker?*',route=>route.fulfill({json:{locations:[{id:102,name:'The old house',parent:null,type:'4'},{id:103,name:'Bedroom',parent:102,type:'4'},{id:104,name:'Lounge',parent:102,type:'4'}],types:[]}}));await pane(1).getByRole('button',{name:'Associate existing location',exact:true}).click();await page.locator('dialog [data-picker-id="103"]').waitFor();await page.locator('dialog [data-picker-id="103"] .pd-location-picker-name').click();await page.getByRole('button',{name:'Choose',exact:true}).click();await pane(1).getByRole('button',{name:'Confirm',exact:true}).waitFor();await shot('14-room-association');await pane(1).getByRole('button',{name:'Confirm',exact:true}).click();await pane(1).getByText('Synthetic concurrent change; previous geometry retained.').waitFor();assert.equal(attempted.kind,'room');assert.equal(attempted.locationID,103);assert.equal(attempted.geometryID,'52');assert.equal(attempted.replace,true);assert.equal(await pane(1).locator('[data-block="52"]').getAttribute('data-location-id'),'104');await pane(1).getByRole('button',{name:'Cancel',exact:true}).click();
step='native room drop';const roomSource=await pane(0).getByRole('heading',{name:'Lounge',exact:true}).boundingBox(),roomTarget=await pane(1).locator('[data-block="51"]').boundingBox();await page.mouse.move(roomSource.x+25,roomSource.y+10);await page.mouse.down();await page.mouse.move(roomSource.x+55,roomSource.y+12,{steps:5});await page.mouse.move(roomTarget.x+40,roomTarget.y+40,{steps:25});await page.mouse.up();await pane(1).getByRole('button',{name:'Confirm',exact:true}).waitFor();await shot('14-native-room-drop');await pane(1).getByRole('button',{name:'Cancel',exact:true}).click();
step='unmapped location';await page.evaluate(()=>document.querySelector('[data-context-workspace]').contextController.setPosition({projectId:7,bookId:12,chapterId:10,sceneId:26}));await pane(0).getByRole('heading',{name:'Remote valley',exact:true}).waitFor();await shot('12-unmapped-location');await page.evaluate(()=>document.querySelector('[data-context-workspace]').contextController.setPosition({projectId:7,bookId:12,chapterId:10,sceneId:22}));await pane(0).getByRole('heading',{name:'Bedroom',exact:true}).waitFor();