This repository has been archived on 2025-04-22. You can view files and clone it, but cannot push or open issues or pull requests.
hlk_autotest/tests/fixtures/staffFixture.ts
LingandRX 6517e4192c feat: 初始化慧来客自动化测试项目
- 添加项目配置文件和环境变量设置
- 创建测试用例目录结构和命名规范
- 实现基础测试 fixture 和页面对象模型
- 添加示例测试用例和数据生成器
- 配置 playwright 和 gitignore 文件
2024-12-22 19:18:27 +08:00

47 lines
1.5 KiB
TypeScript

import { test as base } from '@playwright/test';
import { HomeNavigation } from '@/pages/homeNavigationPage.js';
import { TransferManagementPage } from '@/pages/inventory';
export const test = base.extend({
/**
* @type { import("@playwright/test").Page }
*/
firstStaffPage: async ({ browser }, use) => {
const context = await browser.newContext({
storageState: '.auth/user_1.json',
});
const page = await context.newPage();
await page.goto(process.env.BASE_URL ?? '');
await use(page);
await context.close();
},
/**
* @type { import("@playwright/test").Page }
*/
secondStaffPage: async ({ browser }, use) => {
const context = await browser.newContext({
storageState: '.auth/user_2.json',
});
const page = await context.newPage();
await page.goto(process.env.BASE_URL ?? '');
await use(page);
await context.close();
},
/**
* @type { HomeNavigation }
*/
staffHomeNavigation: async ({ firstStaffPage }, use) => {
const homeNavigation = new HomeNavigation(firstStaffPage);
await use(homeNavigation);
},
/**
* @type { TransferManagementPage }
*/
transferManagementPage: async ({ firstStaffPage }, use) => {
const transferManagementPage = new TransferManagementPage(firstStaffPage);
await use(transferManagementPage);
},
});
export { expect } from '@playwright/test';