فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

test(ui): actually click header sidebar/theme controls and assert keyboard links, aria-current and saved state

davoodmehraban89 committed Oct 30, 2026 at 23:20 UTC 6ff3ed440011d32f3f94c0a7f9ffafec2d9a8e85
1 file changed +43
tests/windows-vm-ui-interaction-audit-browser.js
+43
@@ -110,8 +110,50 @@
110 if (row) {row.status='failed';row.reason='UI click error';}
111 } finally {dismiss();}
112 }
113 + // Explicit shell regression: semantic links, keyboard focus, active route,
114 + // persistent sidebar collapse and reversible theme toggle.
115 + const navLinks=[...document.querySelectorAll('#sidebarMenu a[data-page]')];
116 + if (navLinks.length !== routes.length) throw Error('sidebar navigation count mismatch');
117 + for(const link of navLinks) {
118 + const route=link.dataset.page;
119 + if(link.getAttribute('href')!=='#'+route || link.tabIndex<0 ||
120 + !link.getAttribute('aria-label')) throw Error('sidebar link is not keyboard accessible: '+route);
121 + }
122 + const hamburger=document.getElementById('sidebarToggleBtn');
123 + if(!hamburger || !hamburger.getAttribute('aria-label') ||
124 + hamburger.getAttribute('aria-controls')!=='sidebarMenu') {
125 + throw Error('sidebar accessible toggle missing');
126 + }
127 + const beforeCollapsed=document.getElementById('sidebar').classList.contains('collapsed');
128 + hamburger.click();await wait(70);
129 + const afterCollapsed=document.getElementById('sidebar').classList.contains('collapsed');
130 + if (beforeCollapsed===afterCollapsed ||
131 + localStorage.getItem('finora_pro_sidebar_collapsed')!==String(afterCollapsed) ||
132 + hamburger.getAttribute('aria-expanded')!==String(!afterCollapsed)) {
133 + throw Error('sidebar click did not persist synchronized collapsed and aria-expanded state');
134 + }
135 + hamburger.click();await wait(70);
136 + if(document.getElementById('sidebar').classList.contains('collapsed')!==beforeCollapsed ||
137 + localStorage.getItem('finora_pro_sidebar_collapsed')!==String(beforeCollapsed)) {
138 + throw Error('sidebar click did not restore the prior saved state');
139 + }
140 + const themeButton=document.getElementById('themeToggleBtn');
141 + const originalTheme=document.documentElement.getAttribute('data-theme');
142 + if(!themeButton || !themeButton.getAttribute('title'))throw Error('theme button missing accessible name');
143 + themeButton.click();await wait(50);
144 + if(document.documentElement.getAttribute('data-theme')===originalTheme)throw Error('theme toggle was inert');
145 + themeButton.click();await wait(50);
146 + if(document.documentElement.getAttribute('data-theme')!==originalTheme ||
147 + localStorage.getItem('finora_pro_theme')!==originalTheme)throw Error('theme setting not reversible/persisted');
148 + const shellResults={keyboardReachableSidebarLinks:navLinks.length,
149 + sidebarCollapseClickAndPersistence:true,themeToggleClickAndPersistence:true,
150 + activeRouteAriaCurrent:true};
151 for (const route of routes) {
152 await go(route);
153 + const active=[...document.querySelectorAll('#sidebarMenu [aria-current="page"]')];
154 + if(active.length!==1 || active[0].dataset.page!==route){
155 + throw Error('active route is not announced to screen readers: '+route);
156 + }
157 const tabs = inventory(route,'root').filter(el => !el.disabled && safeTab.test(handler(el)));
158 // Evaluate each known safe top-level tab. The router is reset between
159 // clicks to avoid mutating references after HTML rerendering.
@@ -209,6 +251,7 @@
251 }
252 return {
253 environment:'installed-Windows-Tauri-WebView2-synthetic-VM',
254 + shellResults,
255 routesVisited:routes.length,routeNames:routes,
256 inventoryCount:rows.length,
257 safeClickCount:clicks.length,