import { test as base } from '@playwright/test';
import { EnterpriseMiniPage } from './pages/mini/enterprise-mini.page';
import { TalentMiniPage } from './pages/mini/talent-mini.page';

/**
 * Enterprise Mini Fixtures 类型
 */
export interface EnterpriseMiniFixtures {
  enterpriseMiniPage: EnterpriseMiniPage;
}

/**
 * Talent Mini Fixtures 类型
 */
export interface TalentMiniFixtures {
  talentMiniPage: TalentMiniPage;
}

/**
 * 扩展 test 对象，包含企业小程序 Page Object fixture
 */
export const test = base.extend<EnterpriseMiniFixtures>({
  enterpriseMiniPage: async ({ page }, use) => {
    const miniPage = new EnterpriseMiniPage(page);
    await use(miniPage);
  },
});

/**
 * 扩展 test 对象，包含人才小程序 Page Object fixture
 */
export const testTalent = base.extend<TalentMiniFixtures>({
  talentMiniPage: async ({ page }, use) => {
    const talentMiniPage = new TalentMiniPage(page);
    await use(talentMiniPage);
  },
});

/**
 * 导出基础的 expect（保持兼容性）
 */
export const expect = base.expect;
