From 85f646cbed973751a392b6a1e879c396af17156e Mon Sep 17 00:00:00 2001 From: root Date: Tue, 31 Mar 2026 23:54:36 +0000 Subject: [PATCH] fix: add Accounting to sidebar nav + E2E spec (FIBEROPS-240) --- components/layout/sidebar.tsx | 3 ++- e2e/accounting.spec.ts | 50 +++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 e2e/accounting.spec.ts diff --git a/components/layout/sidebar.tsx b/components/layout/sidebar.tsx index 14f2f2e..a6c2b18 100644 --- a/components/layout/sidebar.tsx +++ b/components/layout/sidebar.tsx @@ -5,7 +5,7 @@ import { usePathname } from 'next/navigation'; import { useAuthStore } from '@/lib/auth-store'; import { LayoutDashboard, Users, UserPlus, FileText, CreditCard, - ArrowLeftRight, Ticket, BarChart3, ScrollText, Settings, + ArrowLeftRight, Ticket, BarChart3, ScrollText, Settings, BookOpen, } from 'lucide-react'; const navItems = [ @@ -17,6 +17,7 @@ const navItems = [ { label: 'Remittances', href: '/remittances', icon: ArrowLeftRight, roles: ['admin', 'collector'] }, { label: 'Tickets', href: '/tickets', icon: Ticket, roles: [] }, { label: 'Reports', href: '/reports', icon: BarChart3, roles: ['admin', 'staff'] }, + { label: 'Accounting', href: '/accounting', icon: BookOpen, roles: ['admin'] }, { label: 'Audit Log', href: '/audit-log', icon: ScrollText, roles: ['admin'] }, { label: 'Settings', href: '/settings', icon: Settings, roles: ['admin'] }, ]; diff --git a/e2e/accounting.spec.ts b/e2e/accounting.spec.ts new file mode 100644 index 0000000..6e00d9d --- /dev/null +++ b/e2e/accounting.spec.ts @@ -0,0 +1,50 @@ +import { test, expect } from '@playwright/test'; +import { login } from './helpers/auth'; + +test.describe('Accounting', () => { + test.beforeEach(async ({ page }) => { + await login(page); + }); + + test('chart of accounts page loads', async ({ page }) => { + await page.goto('/accounting'); + await page.waitForTimeout(3000); + await expect(page.locator('h1').filter({ hasText: 'Accounting' }).first()).toBeVisible({ timeout: 15000 }); + }); + + test('accounting sub-nav visible', async ({ page }) => { + await page.goto('/accounting'); + await page.waitForTimeout(3000); + await expect(page.locator('a').filter({ hasText: /Expenses/ }).first()).toBeVisible(); + }); + + test('journal entries page loads', async ({ page }) => { + await page.goto('/accounting/journal-entries'); + await page.waitForTimeout(3000); + await expect(page.locator('h1').filter({ hasText: 'Accounting' }).first()).toBeVisible({ timeout: 15000 }); + }); + + test('expenses page loads', async ({ page }) => { + await page.goto('/accounting/expenses'); + await page.waitForTimeout(3000); + await expect(page.locator('h1').filter({ hasText: 'Accounting' }).first()).toBeVisible({ timeout: 15000 }); + }); + + test('company accounts page loads', async ({ page }) => { + await page.goto('/accounting/company-accounts'); + await page.waitForTimeout(3000); + await expect(page.locator('h1').filter({ hasText: 'Accounting' }).first()).toBeVisible({ timeout: 15000 }); + }); + + test('financial reports page loads', async ({ page }) => { + await page.goto('/accounting/reports'); + await page.waitForTimeout(3000); + await expect(page.locator('text=Trial Balance').first()).toBeVisible({ timeout: 15000 }); + }); + + test('accounting link in sidebar', async ({ page }) => { + await page.goto('/dashboard'); + await page.waitForTimeout(2000); + await expect(page.locator('a[href="/accounting"]')).toBeVisible(); + }); +}); -- 2.43.0