fix: Accounting sidebar link + E2E spec (FIBEROPS-240) #11

Merged
kibin merged 1 commits from fix/accounting-sidebar-e2e into main 2026-03-31 23:54:53 +00:00
2 changed files with 52 additions and 1 deletions
Showing only changes of commit 85f646cbed - Show all commits

View File

@@ -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'] },
];

50
e2e/accounting.spec.ts Normal file
View File

@@ -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();
});
});