diff --git a/Docs/Locations/Refinements.md b/Docs/Locations/Refinements.md index 0a5f19ab..4b4c6406 100644 --- a/Docs/Locations/Refinements.md +++ b/Docs/Locations/Refinements.md @@ -55,7 +55,9 @@ icon key (or add SVG geometry to ApplicationRibbon), and specify order/tone/assi renumber canonical IDs, change existing records or infer specialisations from manuscript text. The reader and UI consume metadata; no feature-specific taxonomy switch/list is required. -LocationWorkspace exposes `types` (assignable choices) and `taxonomy` (all nodes). The presentation +LocationWorkspace preserves `types` as the older flat canonical-ID/name list (non-null IDs only) +and adds `taxonomy` for all nodes, including NULL Unclassified. The enhanced workspace derives its +choices from taxonomy metadata; older open clients keep their original response contract. The presentation adapter resolves metadata icon keys through ApplicationRibbon. Details, type context menus and traditional forms consume the same taxonomy. Parent-type filtering/counts include the category's own value and all descendants using sets of assigned IDs; each location counts once. Grouping diff --git a/PlotLine.Tests/Browser/location-refinements-dev-pwa.cjs b/PlotLine.Tests/Browser/location-refinements-dev-pwa.cjs new file mode 100644 index 00000000..4a8e27e9 --- /dev/null +++ b/PlotLine.Tests/Browser/location-refinements-dev-pwa.cjs @@ -0,0 +1,5 @@ +// Installed Chromium PWA, real Development endpoints, dedicated fixture only. Read/navigation checks. +const{chromium}=require('playwright'),fs=require('fs'),assert=require('node:assert/strict');const base='https://dev.plotdirector.com',file=process.argv[2],out='/tmp/pd-refinements-evidence';if(!file?.startsWith('/tmp/pd-dev-browser-'))throw Error('Dedicated private identity required');const identity=JSON.parse(fs.readFileSync(file));assert.equal(identity.Database,'PlotDirector_Development');assert(identity.Email.startsWith('pwa-browser-')&&identity.RefinementFixture); +(async()=>{const profile=fs.mkdtempSync('/tmp/pd-refinements-dev-pwa-'),context=await chromium.launchPersistentContext(profile,{headless:false,viewport:{width:1440,height:1000}}),cdp=await context.browser().newBrowserCDPSession(),manifestId=base+'/Projects';try{const tab=context.pages()[0];await tab.goto(base+'/Account/Login');await tab.locator('[name=Email]').fill(identity.Email);await tab.locator('[name=Password]').fill(identity.Password);await tab.locator('form button[type=submit]').click();await tab.waitForURL(base+'/Projects');await cdp.send('PWA.install',{manifestId,installUrlOrBundleUrl:base+'/Projects'});await cdp.send('PWA.changeAppUserSettings',{manifestId,displayMode:'standalone'});const opened=context.waitForEvent('page');await cdp.send('PWA.launch',{manifestId,url:base+`/Locations?projectId=${identity.ProjectID}`});const page=await opened;await page.waitForLoadState();assert(await page.evaluate(()=>matchMedia('(display-mode: standalone)').matches));await page.locator('[data-location-records][aria-busy=false]').waitFor();const q=`projectId=${identity.ProjectID}`,response=await page.request.get(base+`/LocationWorkspace/Directory?${q}`),data=await response.json();assert.equal(response.status(),200);assert.equal(data.taxonomy.length,105);assert.equal(data.types.length,97);assert(data.types.every(t=>t.value!==''));const north=identity.RefinementFixture.north;await page.locator(`[data-location-id="${north}"] [data-location-name]`).click();await page.locator('[data-details]').getByRole('button',{name:'Location type',exact:true}).click();let dialog=page.locator('dialog.pd-location-picker-dialog');await dialog.getByRole('searchbox',{name:'Search location types'}).fill('Office');assert.equal(await dialog.getByRole('button',{name:'Office',exact:true}).count(),2);await page.screenshot({path:out+'/development-pwa-type-picker.png'});await dialog.getByRole('button',{name:'Cancel',exact:true}).click();await page.getByRole('button',{name:'Change parent',exact:true}).click();dialog=page.locator('[data-location-dialog]');await dialog.getByRole('searchbox',{name:'Search locations'}).fill('Old ledger lodging');assert(await dialog.locator(`[data-picker-id="${identity.RefinementFixture.home}"]`).count());await page.screenshot({path:out+'/development-pwa-location-picker.png'});await dialog.locator('[data-dialog-cancel]').click();await page.locator('[data-value="@premises"] .pd-attribute-expand').click();const residential=data.taxonomy.find(t=>t.key==='residential').value;await page.locator(`[data-attribute=type][data-value="${residential}"] .pd-attribute-expand`).click();await page.getByRole('button',{name:'Cards',exact:true}).click();await page.screenshot({path:out+'/development-pwa-locations.png'});const before=context.pages().length;await page.locator('[data-details]').getByRole('link',{name:'Full details',exact:true}).click();await page.waitForURL(/\/Locations\/Details\/\d+/);assert.equal(context.pages().length,before); + await page.goto(base+`/Characters?${q}`);await page.locator('[data-attribute=importance]').first().waitFor();assert.equal(await page.locator('.character-card').count(),2);assert((await page.locator('.character-card').first().textContent()).includes('A complete synthetic biography.'));const divider=page.getByRole('separator',{name:'Resize Attributes panel'});await divider.press('ArrowRight');await page.screenshot({path:out+'/development-pwa-characters.png'});fs.writeFileSync(out+'/development-refinements-pwa.json',JSON.stringify({status:'passed',target:'Development',installed:true,checks:['real installed Chromium PWA','canonical taxonomy and legacy flat API contract','type picker disambiguates Office','alias/path containment picker','shared Locations taxonomy palette','same-window Details','shared Characters palette, resize and two unchanged biographies']},null,2));console.log('PASS authenticated installed Development PWA, canonical/legacy APIs, both pickers, both shared palettes and same-window navigation.'); + }finally{await cdp.send('PWA.uninstall',{manifestId}).catch(()=>{});await context.close();fs.rmSync(profile,{recursive:true,force:true});}})().catch(e=>{console.error(e);process.exitCode=1;}); diff --git a/PlotLine.Tests/Browser/location-refinements-dev.cjs b/PlotLine.Tests/Browser/location-refinements-dev.cjs new file mode 100644 index 00000000..df85b0f0 --- /dev/null +++ b/PlotLine.Tests/Browser/location-refinements-dev.cjs @@ -0,0 +1,27 @@ +// Development-only operational verification. Requires the dedicated empty project from --setup. +const {chromium}=require('playwright'),fs=require('fs'),assert=require('node:assert/strict');const base='https://dev.plotdirector.com',file=process.argv[2],out='/tmp/pd-refinements-evidence'; +if(!file?.startsWith('/tmp/pd-dev-browser-'))throw Error('Dedicated private fixture identity required');const identity=JSON.parse(fs.readFileSync(file));assert.equal(identity.Database,'PlotDirector_Development');assert(identity.Email.startsWith('pwa-browser-')&&identity.Email.endsWith('@example.invalid'));assert(identity.ProjectID&&identity.BookID); +(async()=>{const browser=await chromium.launch(),context=await browser.newContext({viewport:{width:1440,height:1000}});await context.addInitScript(user=>localStorage.setItem(`plotdirector.desktop.v1.${user}`,JSON.stringify({dismissedAt:Date.now()})),identity.UserID);const page=await context.newPage(),errors=[];page.on('pageerror',e=>errors.push(e.message));try{ + await page.goto(base+'/Account/Login');await page.locator('[name=Email]').fill(identity.Email);await page.locator('[name=Password]').fill(identity.Password);await page.locator('form button[type=submit]').click();await page.waitForURL(base+'/Projects');const q=`projectId=${identity.ProjectID}`,directory=async()=>{const r=await page.request.get(base+`/LocationWorkspace/Directory?${q}`);assert.equal(r.status(),200);return r.json();}; + await page.goto(base+`/Locations?${q}`);await page.locator('[data-location-records][aria-busy=false]').waitFor();let data=await directory();assert.equal(data.locations.length,0,'Only an empty dedicated fixture may be populated');assert.equal(data.taxonomy.length,105);assert.equal(data.types.length,97);assert(data.types.every(t=>t.value!==''));const type=key=>data.taxonomy.find(t=>t.key===key).value; + const api=async(action,body)=>page.evaluate(async({action,body})=>{const r=await fetch('/LocationWorkspace/'+action,{method:'POST',headers:{'Content-Type':'application/json','RequestVerificationToken':document.querySelector('[data-location-token] [name=__RequestVerificationToken]').value},body:JSON.stringify(body)});return{status:r.status,body:await r.json()};},{action,body}); + const create=async(name,parentId)=>{const r=await api('Create',{projectId:identity.ProjectID,name,parentId});assert.equal(r.status,200);return r.body.id;}; + const north=await create('Northland acceptance',null),harbour=await create('Harbour acceptance',north),south=await create('Southland acceptance',null),home=await create('Ledger house acceptance',harbour); + const load=async()=>{await page.goto(base+`/Locations?${q}`);await page.locator('[data-location-records][aria-busy=false]').waitFor();await page.getByRole('button',{name:'Expand all',exact:true}).click();};const row=id=>page.locator(`[data-location-id="${id}"]`); + const selectType=async(id,key)=>{await row(id).locator('[data-location-name]').click();await page.locator('[data-details]').getByRole('button',{name:'Location type',exact:true}).click();const dialog=page.locator('dialog.pd-location-picker-dialog');await dialog.getByRole('searchbox',{name:'Search location types'}).fill(data.taxonomy.find(t=>t.key===key).label);await dialog.locator(`[data-picker-id="${key}"] .pd-location-picker-name`).click();const saved=page.waitForResponse(r=>r.url().endsWith('/LocationWorkspace/Assign'));await dialog.getByRole('button',{name:'Choose type',exact:true}).click();const result=await saved;assert.equal(result.status(),200,await result.text());await dialog.waitFor({state:'hidden'});await page.waitForFunction(label=>document.querySelector('[data-details] [aria-label="Location type"]')?.textContent===label,data.taxonomy.find(t=>t.key===key).label);data=await directory();assert.equal(data.locations.find(r=>r.id===id).type,type(key));}; + await load();await selectType(north,'city');await selectType(harbour,'residential');await selectType(home,'house'); + const expand=async locator=>{if(await locator.locator('.pd-attribute-expand').getAttribute('aria-expanded')==='false')await locator.locator('.pd-attribute-expand').click();};const attr=key=>page.locator(`[data-attribute=type][data-value="${type(key)}"]`);await expand(page.locator('[data-value="@premises"]'));await expand(attr('residential'));assert.equal(await attr('residential').locator('[data-count]').textContent(),'2'); + await row(harbour).locator('[data-select-location]').check();await row(home).locator('[data-select-location]').check();await expand(attr('commercial'));await attr('pub').locator('[data-assign]').click();await page.waitForTimeout(200);data=await directory();assert(data.locations.filter(r=>[home,harbour].includes(r.id)).every(r=>r.type===type('pub')));await page.locator('[data-undo]').click();await page.waitForTimeout(200);data=await directory();assert.equal(data.locations.find(r=>r.id===home).type,type('house'));assert.equal(data.locations.find(r=>r.id===harbour).type,type('residential')); + await attr('residential').locator('[data-attribute-filter]').click();assert.match(await page.locator('[data-result-count]').textContent(),/^2 of 4/);await page.getByRole('button',{name:'Cards',exact:true}).click();assert.equal(await page.locator('[data-location-id]').count(),2);await page.locator('[data-clear-filters]').click();await page.getByRole('button',{name:'Hierarchy',exact:true}).click();await page.locator('[data-clear-selection]').click(); + await page.goto(base+`/Locations/Edit/${home}`);await page.locator('[data-alias-input]').fill('Old ledger lodging');await page.locator('[data-add-alias]').click();await page.getByRole('button',{name:'Choose parent location',exact:true}).click();let dialog=page.locator('dialog.pd-location-picker-dialog');await dialog.getByRole('searchbox',{name:'Search locations'}).fill('Southland');await dialog.locator(`[data-picker-id="${south}"] .pd-location-picker-name`).click();await dialog.getByRole('button',{name:'Choose location',exact:true}).click();assert.equal(await page.locator('[name=ParentLocationID]').inputValue(),String(south));await page.getByRole('button',{name:'Save location',exact:true}).click();await page.waitForURL(/\/Locations\/Details\/\d+/);data=await directory();assert.equal(data.locations.find(r=>r.id===home).parent,south);assert(data.locations.find(r=>r.id===home).aliases.includes('Old ledger lodging')); + await page.goto(base+`/Locations/Create?${q}`);await page.locator('[name=LocationName]').fill('Archive room acceptance');await page.getByRole('button',{name:'Choose parent location',exact:true}).click();dialog=page.locator('dialog.pd-location-picker-dialog');await dialog.getByRole('searchbox',{name:'Search locations'}).fill('Southland');await dialog.locator(`[data-picker-id="${south}"] .pd-location-picker-name`).click();await dialog.getByRole('button',{name:'Choose location',exact:true}).click();await page.getByRole('button',{name:'Location type',exact:true}).click();dialog=page.locator('dialog.pd-location-picker-dialog');await dialog.getByRole('searchbox',{name:'Search location types'}).fill('Kitchen');await dialog.locator('[data-picker-id=kitchen] .pd-location-picker-name').click();await dialog.getByRole('button',{name:'Choose type',exact:true}).click();await page.getByRole('button',{name:'Save location',exact:true}).click();await page.waitForURL(/\/Locations\/Details\/\d+/);const kitchen=Number(page.url().split('/').pop());data=await directory();assert.equal(data.locations.find(r=>r.id===kitchen).type,type('kitchen'));assert.equal(data.locations.find(r=>r.id===kitchen).parent,south); + await page.goto(base+`/Locations/Details/${home}`);await page.getByRole('button',{name:'Choose related location',exact:true}).click();dialog=page.locator('dialog.pd-location-picker-dialog');assert.equal(await dialog.locator(`[data-picker-id="${home}"]`).getAttribute('aria-disabled'),'true');await dialog.getByRole('searchbox',{name:'Search locations'}).fill('Archive room');await dialog.locator(`[data-picker-id="${kitchen}"] .pd-location-picker-name`).click();await dialog.getByRole('button',{name:'Choose location',exact:true}).click();await page.locator('[name=Notes]').fill('Disposable picker relationship');await page.getByRole('button',{name:'Add relationship',exact:true}).click();await page.waitForLoadState();assert(await page.getByText('Disposable picker relationship',{exact:true}).count()); + await load();await row(home).locator('[data-location-name]').click();await page.getByRole('button',{name:'Change parent',exact:true}).click();dialog=page.locator('[data-location-dialog]');await dialog.getByRole('searchbox',{name:'Search locations'}).fill('Harbour');await dialog.locator(`[data-picker-id="${harbour}"] .pd-location-picker-name`).click();await dialog.locator('[data-dialog-save]').click();await dialog.waitFor({state:'hidden'});data=await directory();assert.equal(data.locations.find(r=>r.id===home).parent,harbour);await page.getByRole('button',{name:'Reveal selected',exact:true}).click(); + await row(home).locator('[data-location-name]').click();await page.getByRole('button',{name:'Change parent',exact:true}).click();dialog=page.locator('[data-location-dialog]');await dialog.getByRole('searchbox',{name:'Search locations'}).fill('Old ledger lodging');assert.equal(await dialog.locator(`[data-picker-id="${home}"]`).getAttribute('aria-disabled'),'true');await page.screenshot({path:out+'/development-picker.png'});await dialog.locator('[data-dialog-cancel]').click(); + await page.locator('[data-clear-selection]').click();await expand(page.locator('[data-value="@premises"]'));await expand(attr('residential'));await attr('house').locator('[data-attribute-filter]').dragTo(row(kitchen));await page.waitForTimeout(200);data=await directory();assert.equal(data.locations.find(r=>r.id===kitchen).type,type('house'));await page.locator('[data-undo]').click();await page.waitForTimeout(200);data=await directory();assert.equal(data.locations.find(r=>r.id===kitchen).type,type('kitchen'));await row(kitchen).locator('[data-drag-location]').dragTo(attr('house'));await page.waitForTimeout(200);data=await directory();assert.equal(data.locations.find(r=>r.id===kitchen).type,type('house'));await page.locator('[data-undo]').click();await page.waitForTimeout(200); + data=await directory();let r=data.locations.find(r=>r.id===north);assert.equal((await api('Assign',{projectId:identity.ProjectID,attribute:'parent',changes:[{id:north,value:String(home),version:r.version}]})).status,409);r=data.locations.find(r=>r.id===home);assert.equal((await api('Assign',{projectId:identity.ProjectID,attribute:'type',changes:[{id:home,value:'@premises',version:r.version}]})).status,409); + const duplicate=await create('Ledger alternate acceptance',null);await load();await row(duplicate).getByRole('button',{name:/Actions for/}).click();await page.getByRole('menuitem',{name:'Merge with another location…',exact:true}).click();dialog=page.locator('[data-location-dialog]');await dialog.getByRole('searchbox',{name:'Search locations'}).fill('Old ledger lodging');await dialog.locator(`[data-picker-id="${home}"] .pd-location-picker-name`).click();await dialog.locator('input[type=checkbox]').check();const merged=page.waitForResponse(r=>r.url().endsWith('/LocationWorkspace/Merge'));await dialog.locator('[data-dialog-save]').click();assert.equal((await merged).status(),200);await dialog.waitFor({state:'hidden'});data=await directory();assert.equal(data.locations.length,5);assert.equal(data.locations.find(r=>r.id===home).type,type('house'));assert.equal(data.locations.find(r=>r.id===home).parent,harbour);await page.evaluate(()=>document.querySelectorAll('[data-toast-host] button[aria-label^=Dismiss]').forEach(b=>b.click()));await page.screenshot({path:out+'/development-taxonomy.png'}); + for(const [name,bio]of [['Acceptance cast one','A complete synthetic biography.'],['Acceptance cast two','A complete synthetic biography. '.repeat(16)]]){await page.goto(base+`/Characters/Create?${q}`);await page.locator('[name=CharacterName]').fill(name);await page.locator('[name=DefaultDescription]').fill(bio);await page.getByRole('button',{name:'Save character',exact:true}).click();await page.waitForURL(/\/Characters\/Details\/\d+/);} + await page.goto(base+`/Characters?${q}`);await page.locator('[data-attribute=importance]').first().waitFor();const characters=async()=>{const r=await page.request.get(base+`/CharacterAttributes/Directory?${q}`);assert.equal(r.status(),200);return r.json();};const before=(await characters()).characters;assert.equal(before.length,2);await page.locator('[data-select-visible]').click();await page.locator('[data-attribute=importance][data-value="10"] [data-assign]').click();await page.waitForTimeout(200);assert((await characters()).characters.every(r=>r.values.importance==='10'));await page.locator('[data-attribute=importance][data-value="10"] [data-attribute-filter]').click();assert.equal(await page.locator('.character-card:not([hidden])').count(),2);await page.locator('[data-clear-filter]').click();await page.locator('[data-undo]').click();await page.waitForTimeout(200);assert.deepEqual((await characters()).characters.map(r=>r.values),before.map(r=>r.values));assert((await page.locator('.character-card').first().textContent()).includes('A complete synthetic biography.'));const heights=await page.locator('.character-card').evaluateAll(ns=>ns.map(n=>Math.round(n.getBoundingClientRect().height)));assert(new Set(heights).size>1);await page.evaluate(()=>document.querySelectorAll('[data-toast-host] button[aria-label^=Dismiss]').forEach(b=>b.click()));await page.screenshot({path:out+'/development-characters.png'}); + assert.deepEqual(errors,[]);identity.RefinementFixture={north,harbour,south,home,kitchen};fs.writeFileSync(file,JSON.stringify(identity),{mode:0o600});fs.writeFileSync(out+'/development-refinements.json',JSON.stringify({status:'passed',target:'Development',checks:['real canonical 105-entry API','generic and specialised type selection','parent counts include descendants','actual bulk type assignment and exact Undo','type filtering and cards','Edit parent picker and aliases','Create parent/type pickers','Details relationship target picker','workspace parent and alias search','native bidirectional attribute drag and Undo','server cycle and heading rejection','alias-based reviewed merge','real Characters bulk attributes/filter/Undo','unchanged variable character biographies']},null,2));console.log('PASS authenticated Development picker/taxonomy/shared Attributes forms, mutations and safeguards; dedicated fixture only.'); + }finally{await context.close();await browser.close();}})().catch(e=>{console.error(e);process.exitCode=1;}); diff --git a/PlotLine.Tests/Browser/workspace-refinements.cjs b/PlotLine.Tests/Browser/workspace-refinements.cjs index 9064f6d7..03856657 100644 --- a/PlotLine.Tests/Browser/workspace-refinements.cjs +++ b/PlotLine.Tests/Browser/workspace-refinements.cjs @@ -30,7 +30,7 @@ const type=key=>taxonomy.find(t=>t.key===key).value; await page.locator('[data-expand=true]').click();await row(1).locator('[data-location-name]').click();await page.getByRole('button',{name:'Change parent',exact:true}).click();dialog=page.locator('[data-location-dialog]');await dialog.getByRole('searchbox',{name:'Search locations'}).fill('nothing matches this');assert(await dialog.getByText(/No matching locations/).isVisible());await dialog.getByRole('button',{name:'Clear search',exact:true}).click();await dialog.locator('[data-picker-id=""]').focus();await page.keyboard.press('ArrowDown');await page.keyboard.press('Enter');assert.match(await dialog.locator('[role=status]').textContent(),/Alpha country/);await dialog.locator('[data-picker-id=""]').click();await page.locator('[data-dialog-save]').click();await page.waitForTimeout(100);assert.equal(records[0].parent,null);assert.equal(records[2].parent,1); await row(1).locator('[data-location-name]').click();await page.locator('[data-details]').getByRole('button',{name:'Location type',exact:true}).click();await typeDialog.getByRole('searchbox',{name:'Search location types'}).fill('house');await typeDialog.getByRole('button',{name:'House',exact:true}).click();await typeDialog.getByRole('button',{name:'Choose type',exact:true}).click(); // Existing value is a no-op. await row(1).evaluate(n=>n.scrollIntoView({block:'center',behavior:'instant'}));await page.evaluate(()=>new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(resolve))));await row(1).click({button:'right'});await page.getByRole('menuitem',{name:'Location type',exact:true}).hover();await page.getByRole('menuitem',{name:'Buildings and premises',exact:true}).hover();await page.getByRole('menuitem',{name:'Residential',exact:true}).hover();await page.getByRole('menuitemradio',{name:'Assign Residential',exact:true}).click();await page.waitForTimeout(100);assert.equal(records[0].type,type('residential')); - await page.locator('[data-sort]').selectOption('desc');await row(1).evaluate(n=>n.scrollIntoView({block:'center',behavior:'instant'}));await page.evaluate(()=>new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(resolve))));await row(1).click({button:'right'});await page.getByRole('menuitem',{name:'Merge with another location…',exact:true}).click();dialog=page.locator('[data-location-dialog]');await dialog.getByRole('searchbox',{name:'Search locations'}).fill('Control room');assert.equal(await dialog.getByRole('button',{name:'Control room',exact:true}).count(),2);assert.equal(await dialog.locator('[data-picker-id="3"]').getAttribute('aria-disabled'),'true');await dialog.locator('[data-picker-id="2"]>button').click();await dialog.locator('[data-picker-id="4"]>button').click();assert.deepEqual(await dialog.locator('[aria-level="3"] .pd-location-picker-name').allTextContents(),['Amber bay','Birch lane','Control room','Zebra gate']);await dialog.locator('[data-picker-id="5"] .pd-location-picker-name').click();await page.locator('[data-dialog-save]').click();assert.match(await page.locator('[data-dialog-error]').textContent(),/confirm/);await dialog.locator('input[type=checkbox]').check();await page.locator('[data-dialog-save]').click();await dialog.waitFor({state:'hidden'});assert(requests.some(r=>r.merge?.targetId===5)); + await page.locator('[data-sort]').selectOption('desc');await row(1).evaluate(n=>n.scrollIntoView({block:'center',behavior:'instant'}));await page.evaluate(()=>new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(resolve))));await row(1).click({button:'right'});await page.getByRole('menuitem',{name:'Merge with another location…',exact:true}).click();dialog=page.locator('[data-location-dialog]');await dialog.getByRole('searchbox',{name:'Search locations'}).fill('Control room');assert.equal(await dialog.getByRole('button',{name:'Control room',exact:true}).count(),2);assert.equal(await dialog.locator('[data-picker-id="3"]').getAttribute('aria-disabled'),'true');await dialog.locator('[data-picker-id="5"] .pd-location-picker-name').click();await page.locator('[data-dialog-save]').click();assert.match(await page.locator('[data-dialog-error]').textContent(),/confirm/);await dialog.locator('input[type=checkbox]').check();await page.locator('[data-dialog-save]').click();await dialog.waitFor({state:'hidden'});assert(requests.some(r=>r.merge?.targetId===5)); } if(count>50){await row(1).locator('[data-location-name]').click();const pickerStart=performance.now();await page.getByRole('button',{name:'Change parent',exact:true}).click();const dialog=page.locator('[data-location-dialog]');await dialog.getByRole('searchbox',{name:'Search locations'}).fill('Level 0105');const deep=dialog.locator('[data-picker-id="105"]');await deep.waitFor();assert(Number(await deep.getAttribute('aria-level'))>=99);await deep.locator('.pd-location-picker-name').click();assert((await dialog.locator('[role=status]').textContent()).length>1000);assert(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+1));if(count===1000)await page.screenshot({path:`${out}/picker-large-${installed?'pwa':'browser'}.png`});await page.locator('[data-dialog-save]').click();await page.waitForTimeout(100);assert.equal(records[0].parent,105);assert.equal(records[2].parent,1);console.log('Large/deep picker',count,Math.round(performance.now()-pickerStart),'ms');} await page.locator('[data-clear-filters]').click();await page.getByRole('button',{name:'Cards',exact:true}).click();const heights=await page.locator('.location-record').evaluateAll(ns=>ns.slice(0,10).map(n=>Math.round(n.getBoundingClientRect().height)));assert(new Set(heights).size>1); diff --git a/PlotLine/Controllers/LocationWorkspaceController.cs b/PlotLine/Controllers/LocationWorkspaceController.cs index 8b521dfe..3efbfe1b 100644 --- a/PlotLine/Controllers/LocationWorkspaceController.cs +++ b/PlotLine/Controllers/LocationWorkspaceController.cs @@ -41,10 +41,11 @@ public sealed class LocationWorkspaceController(ISqlConnectionFactory connection var maps = (await result.ReadAsync()).ToLookup(a => a.LocationID); var floors = (await result.ReadAsync()).ToLookup(a => a.LocationID); var usage = (await result.ReadAsync()).ToDictionary(a => a.LocationID, a => a.SceneCount); - await result.ReadAsync