import { test, expect } from '@playwright/test';

test.describe('Financial Tab Icon', () => {
  test('financial tab uses DocumentText icon, not MoneyRecive', async ({ page }) => {
    await page.goto('/hr-manager/employees/list');

    await page.waitForSelector('table tbody tr:not([aria-hidden="true"])', { timeout: 20000 });

    const rowCount = await page.locator('table tbody tr:not([aria-hidden="true"])').count();
    if (rowCount === 0) {
      test.skip(true, 'No employees available for testing');
    }

    const viewButton = page
      .locator('table tbody tr:not([aria-hidden="true"])')
      .first()
      .locator('button[aria-label="View"]');
    await viewButton.click();

    await page.waitForURL('**/employees/view/**', { timeout: 10000 });

    const financialTab = page.getByRole('tab', { name: /financial & statutory/i });
    await expect(financialTab).toBeVisible();

    const tabIcon = financialTab.locator('svg').first();
    const iconHtml = await tabIcon.innerHTML();

    expect(iconHtml).not.toContain('M8.67');
  });
});
