feat: add branch overviews scoped outdoor plans and complete room moves
This commit is contained in:
1 parent
382d6e04f2
commit
16eddacebf
35 files changed
+2598
-2116
No files matched your search
@@ -30,10 +30,11 @@ try{
|
||||
});
|
||||
await page.waitForFunction(()=>window.nfPanel.shadowRoot.querySelector("nf-view3d")?.viewer);
|
||||
await page.evaluate(()=>{window.topoHost=window.nfPanel;window.topoView=()=>window.topoHost.shadowRoot.querySelector("nf-view3d");});
|
||||
const select=async(kind,id)=>{
|
||||
await page.waitForFunction((kind,id)=>window.topoView().shadowRoot.querySelector(`.nf-thumb[data-topology-kind="${kind}"][data-topology-key="${kind}:${id}"]`),{},kind,id);
|
||||
await page.evaluate((kind,id)=>window.topoView().shadowRoot.querySelector(`.nf-thumb[data-topology-kind="${kind}"][data-topology-key="${kind}:${id}"]`).click(),kind,id);
|
||||
await page.waitForFunction((kind,id)=>window.topoView().topologySelection?.kind===kind&&window.topoView().topologySelection?.id===id,{},kind,id);
|
||||
const select=async(kind,id,ownerKind)=>{
|
||||
const key=[kind,ownerKind,id].filter(Boolean).join(":");
|
||||
await page.waitForFunction((key)=>window.topoView().shadowRoot.querySelector(`.nf-thumb[data-topology-key="${key}"]`),{},key);
|
||||
await page.evaluate((key)=>window.topoView().shadowRoot.querySelector(`.nf-thumb[data-topology-key="${key}"]`).click(),key);
|
||||
await page.waitForFunction((kind,id,owner)=>window.topoView().topologySelection?.kind===kind&&window.topoView().topologySelection?.id===id&&(window.topoView().topologySelection?.ownerKind??null)===(owner??null),{},kind,id,ownerKind);
|
||||
};
|
||||
const noTopMenu=async()=>assert.equal(await page.evaluate(()=>!!window.topoHost.shadowRoot.querySelector("nav.nf-nav,.nf-card-rooms")),false,"upper room menu is absent above the floor level and outdoors");
|
||||
const scene=()=>page.evaluate(()=>window.topoView().viewer.floors.map((f)=>f.floor.id).sort());
|
||||
@@ -83,11 +84,34 @@ try{
|
||||
assert.deepEqual(await page.evaluate(()=>window.nfPanel.shadowRoot.querySelector("nf-room-panel").outside),["sensor.903"],"legacy outdoor pins stay within their location even without a dedicated outdoor floor");
|
||||
await page.evaluate(()=>window.nfPanel.shadowRoot.querySelector("nf-room-panel").dispatchEvent(new CustomEvent("close",{bubbles:true,composed:true})));
|
||||
|
||||
// Branch/building outdoor views have separate scenes, breadcrumbs, values and pin targets.
|
||||
await page.evaluate(async()=>{
|
||||
const p=window.nfPanel,b=structuredClone(window.topologyProject),base=b.floors.find((f)=>f.id==="outside-a");
|
||||
for(const [id,field,parent,sensor]of[["outside-hq","outdoor_branch_id","hq",905],["outside-ras19","outdoor_building_id","ras19",906]]){
|
||||
const f={...structuredClone(base),id,outdoor_location_id:null,[field]:parent};f.outdoor[0].id=id;f.outdoor[0].temp_entity=`sensor.${sensor}`;b.floors.push(f);
|
||||
p.hass={...p.hass,states:{...p.hass.states,[`sensor.${sensor}`]:{entity_id:`sensor.${sensor}`,state:"22",attributes:{symcon_id:sensor,symcon_variable_type:2,symcon_value:22,symcon_formatted:"22 °C",unit_of_measurement:"°C"}}}};
|
||||
}
|
||||
window.topologyProject=structuredClone(b);p.data.edit(b);p.openTopology({kind:"all"});await p.updateComplete;
|
||||
});
|
||||
await select("location","urbach");await select("branch","hq");assert.deepEqual(await scene(),["eg","og","outside-hq","outside-ras19"]);await noTopMenu();
|
||||
await select("outside","hq","branch");assert.deepEqual(await scene(),["outside-hq"]);await noTopMenu();
|
||||
await page.evaluate(()=>window.topoView().dispatchEvent(new CustomEvent("room-tap",{detail:{floorId:"outside-hq",roomId:"nf-outside"},bubbles:true,composed:true})));
|
||||
await page.waitForFunction(()=>window.nfPanel._outside&&window.nfPanel.shadowRoot.querySelector("nf-room-panel")?.outside?.includes("sensor.905"));
|
||||
assert.deepEqual(await page.evaluate(()=>window.nfPanel.shadowRoot.querySelector("nf-room-panel").outside.slice().sort()),["sensor.903","sensor.905","sensor.906"]);
|
||||
await page.evaluate(()=>{window.nfPanel.shadowRoot.querySelector("nf-room-panel").dispatchEvent(new CustomEvent("close",{bubbles:true,composed:true}));window.topoView().shadowRoot.querySelector('.nf-topology-crumbs [data-topology-key="branch:hq"]').click();});
|
||||
await select("building","ras19");await select("outside","ras19","building");assert.deepEqual(await scene(),["outside-ras19"]);await noTopMenu();
|
||||
await page.evaluate(()=>window.topoView().dispatchEvent(new CustomEvent("room-tap",{detail:{floorId:"outside-ras19",roomId:"nf-outside"},bubbles:true,composed:true})));
|
||||
await page.waitForFunction(()=>window.nfPanel._outside&&window.nfPanel.shadowRoot.querySelector("nf-room-panel")?.outside?.includes("sensor.906"));
|
||||
assert.deepEqual(await page.evaluate(()=>window.nfPanel.shadowRoot.querySelector("nf-room-panel").outside.slice().sort()),["sensor.903","sensor.906"]);
|
||||
await page.screenshot({path:join(out,"symcon-topology-building-outside.png")});
|
||||
|
||||
// The HTML-SDK tile uses the same hierarchy and hides its own upper menu until a floor is selected.
|
||||
await page.evaluate(async()=>{const p=window.nfPanel,card=document.createElement("nextfloor-card");card.setConfig({type:"custom:nextfloor-card",fill:true,room_buttons:true,controls:true});card.hass=p.hass;card.style.cssText="display:block;height:850px";document.body.append(card);await card.updateComplete;card.data.edit(structuredClone(window.topologyProject));p.style.display="none";window.topoHost=card;window.topoCard=card;await card.updateComplete;});
|
||||
await page.waitForFunction(()=>window.topoView()?.viewer&&window.topoView().shadowRoot.querySelector('[data-topology-kind="location"]'));
|
||||
await noTopMenu();await select("location","urbach");await select("branch","hq");await select("building","ras19");await noTopMenu();await select("floor","eg");
|
||||
await page.waitForFunction(()=>window.topoCard.shadowRoot.querySelectorAll(".nf-card-rooms button").length===2);
|
||||
await page.evaluate(()=>window.topoView().shadowRoot.querySelector('.nf-topology-crumbs [data-topology-key="building:ras19"]').click());
|
||||
await select("outside","ras19","building");await noTopMenu();assert.deepEqual(await scene(),["outside-ras19"]);
|
||||
await page.evaluate(()=>window.topoView().shadowRoot.querySelector(".nf-thumb-house").click());await noTopMenu();
|
||||
await page.setViewport({width:390,height:844});
|
||||
await page.waitForFunction(()=>window.topoView().shadowRoot.querySelectorAll('[data-topology-kind="location"] img').length===2);
|
||||
|
||||
Reference in new issue
Block a user