@davoodmehraban89 / Factor-easy / commits / 89c2d8d
Fork 0

سامانه صدور فاکتور و حسابداری

test: assert real commerce tab changes view, sidebar and back-navigation from accounting

davoodmehraban89 committed Oct 15, 2026 at 20:38 UTC 89c2d8de7df2d02176421c40d583ad7fbe8368da
1 file changed +26
scripts/phase0-modal-dashboard.spec.js
+26
@@ -59,3 +59,29 @@ test('dashboard cash/assets cards drill to accounts, rows to ledger, recent vouc
59 await page.locator('#finora-voucher-register-open').click();
60 await expect(page.locator('#view-journal')).toHaveClass(/active/);
61 });
62 +
63 +
64 +test('F0-02 commerce tab navigates away from accounting and exposes invoice, product and contact links',async({page})=>{
65 + // Synthetic local UI test. No real Supabase session or financial writes.
66 + await boot(page);
67 + await page.waitForFunction(()=>typeof window.applyLicensedModuleUI==='function'&&typeof window.openModule==='function');
68 + await page.evaluate(()=>{currentUser.modules=['full_suite'];applyLicensedModuleUI();});
69 + const rail=page.locator('#module-rail');
70 + await rail.locator('[data-module="accounting"]').click();
71 + await expect(page.locator('#view-accounting-foundation')).toHaveClass(/active/);
72 + await expect(page.locator('#module-panel-title')).toHaveText('حسابداری');
73 + await expect(page.locator('#module-panel-links')).toContainText('ثبت سند حسابداری');
74 + await rail.locator('[data-module="commerce"]').click();
75 + await expect(page.locator('#view-invoices')).toHaveClass(/active/);
76 + await expect(page.locator('#module-panel-title')).toHaveText('بازرگانی');
77 + await expect(page.locator('#module-panel-links')).toContainText('فاکتورها');
78 + await expect(page.locator('#module-panel-links')).toContainText('کالا و خدمات');
79 + await expect(page.locator('#module-panel-links')).toContainText('اشخاص');
80 + await expect(page.locator('#module-panel-links [data-view="view-journal"]')).toHaveCount(0);
81 + await expect(rail.locator('[data-module="commerce"]')).toHaveClass(/active/);
82 + await page.locator('#module-panel-links [data-view="view-products"]').click();
83 + await expect(page.locator('#view-products')).toHaveClass(/active/);
84 + await page.locator('#module-panel-links [data-view="view-invoices"]').click();
85 + await expect(page.locator('#view-invoices')).toHaveClass(/active/);
86 + await expect(page.locator('#module-panel-title')).toHaveText('بازرگانی');
87 +});