import { test as base } from '@playwright/test';
import { AdminLoginPage } from '../pages/admin/login.page';
import { DashboardPage } from '../pages/admin/dashboard.page';
import { UserManagementPage } from '../pages/admin/user-management.page';
import { ActivityManagementPage } from '../pages/admin/activity-management.page';
import { RouteManagementPage } from '../pages/admin/route-management.page';

type Fixtures = {
  adminLoginPage: AdminLoginPage;
  dashboardPage: DashboardPage;
  userManagementPage: UserManagementPage;
  activityManagementPage: ActivityManagementPage;
  routeManagementPage: RouteManagementPage;
};

export const test = base.extend<Fixtures>({
  adminLoginPage: async ({ page }, use) => {
    await use(new AdminLoginPage(page));
  },
  dashboardPage: async ({ page }, use) => {
    await use(new DashboardPage(page));
  },
  userManagementPage: async ({ page }, use) => {
    await use(new UserManagementPage(page));
  },
  activityManagementPage: async ({ page }, use) => {
    await use(new ActivityManagementPage(page));
  },
  routeManagementPage: async ({ page }, use) => {
    await use(new RouteManagementPage(page));
  },
});

export { expect } from '@playwright/test';