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

const MANAGEMENT_ROUTES = [
  '/admin/company?_preview=1',
  '/admin/candidate?_preview=1',
  '/admin/customer?_preview=1',
  '/admin/photographer?_preview=1',
  '/admin/makeup-artist?_preview=1',
  '/admin/tutors?_preview=1',
  '/admin/developers?_preview=1',
  '/admin/video-editors?_preview=1',
  '/admin/fitness-trainers?_preview=1',
  '/admin/catering-services?_preview=1',
  '/admin/graphic-designers?_preview=1',
  '/admin/social-media-managers?_preview=1',
  '/admin/ugc-content-creator?_preview=1',
];

test.describe('Department-style UI parity for management modules', () => {
  for (const route of MANAGEMENT_ROUTES) {
    test(`controls and table structure: ${route}`, async ({ page }) => {
      await page.goto(route, { waitUntil: 'domcontentloaded' });
      await expect(page.getByText('Sort').first()).toBeVisible();
      await expect(page.getByText('Filters').first()).toBeVisible();
      await expect(page.getByText('Export').first()).toBeVisible();
      await expect(page.getByText('ACTIONS').first()).toBeVisible();
      await expect(page.locator('table').first()).toBeVisible();
      await expect(page.getByText('ACTIONS').first()).toBeVisible();
      await expect(page.getByText('Live legacy module embedded for exact design and functionality parity during migration.')).toHaveCount(0);
    });
  }
});

test.describe('Dashboard management modules are non-empty', () => {
  test('internal dashboard management renders rows or configured table state', async ({ page }) => {
    await page.goto('/admin/internal-dashboard-management?_preview=1', { waitUntil: 'domcontentloaded' });
    await expect(page.getByRole('heading', { name: 'Internal Dashboard Management' })).toBeVisible();
    await expect(page.locator('table').first()).toBeVisible();
  });

  test('external dashboard management renders rows or configured table state', async ({ page }) => {
    await page.goto('/admin/external-dashboard-management?_preview=1', { waitUntil: 'domcontentloaded' });
    await expect(page.getByRole('heading', { name: 'External Dashboard Management' })).toBeVisible();
    await expect(page.locator('table').first()).toBeVisible();
  });
});
