سامانه صدور فاکتور و حسابداری
test(phase0): stabilize light/dark contrast gate against boot race and 200ms button transition
davoodmehraban89 committed
Oct 12, 2026 at 11:33 UTC
9a68f802adb4cc1894c0abb2ea1cfb2cef37ae74
1 file changed
+10
-2
scripts/phase0-dark-theme-contrast.spec.js
+10
-2
@@ -20,7 +20,12 @@ async function setup(page){
20
<button type="button" class="module-link" id="f0-theme-nav">حسابداری</button>
21
</aside>`;
22
document.body.appendChild(fixture);
23
- document.body.classList.add('finora-theme-dark');
23
+ // Keep the requested theme stable if the application's delayed boot runs.
24
+ // This is a browser fixture only; no persisted user setting is modified.
25
+ window.__f0TestTheme='dark';
26
+ const originalSettings=window.getMySettings;
27
+ window.getMySettings=()=>({...((typeof originalSettings==='function'&&originalSettings())||{}),ui_theme:window.__f0TestTheme});
28
+ finoraApplyTheme();
29
});
30
}
31
@@ -63,7 +68,10 @@ test('F0-06 dark mode maintains readable accounting panels, controls and shell',
68
69
test('F0-06 light mode remains legible after switching out of dark mode',async({page})=>{
70
await setup(page);
66
- await page.evaluate(()=>document.body.classList.remove('finora-theme-dark'));
71
+ await page.evaluate(()=>{window.__f0TestTheme='light';finoraApplyTheme()});
72
+ // Buttons animate their background for 200ms; assert steady-state contrast,
73
+ // not an intermediate frame during CSS transition.
74
+ await expect.poll(async()=>(await sample(page)).button.contrast,{timeout:3000}).toBeGreaterThanOrEqual(4.5);
75
const s=await sample(page);
76
expect(s.rootDark).toBe(false);
77
expect(s.accordion.contrast).toBeGreaterThanOrEqual(4.5);