import { test, expect } from '@playwright/test';
import { login } from './helpers/auth';

test.describe('財務管理模組', () => {
    test.beforeEach(async ({ page }) => {
        await login(page);
    });

    test('應能進入應付帳款管理頁面並顯示主要元素', async ({ page }) => {
        await page.goto('/finance/account-payables');
        await expect(page.getByRole('heading', { name: /應付帳款管理/ })).toBeVisible();
        await expect(page.locator('table')).toBeVisible();
    });

    test('應能進入水電瓦斯費管理頁面並顯示主要元素', async ({ page }) => {
        await page.goto('/utility-fees');
        await expect(page.getByRole('heading', { name: /公共事業費管理/ })).toBeVisible();
        await expect(page.locator('table')).toBeVisible();
        await expect(page.getByRole('button', { name: /新增/ })).toBeVisible();
    });

    test('應能進入財務報表頁面並顯示主要元素', async ({ page }) => {
        await page.goto('/accounting-report');
        await expect(page.getByRole('heading', { name: /會計報表/ })).toBeVisible();
        await expect(page.locator('table')).toBeVisible();
        await expect(page.getByRole('button', { name: /匯出/ })).toBeVisible();
    });
});
