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/pages/inventory/inventoryTransferManagementPage.ts
LingandRX 6517e4192c feat: 初始化慧来客自动化测试项目
- 添加项目配置文件和环境变量设置
- 创建测试用例目录结构和命名规范
- 实现基础测试 fixture 和页面对象模型
- 添加示例测试用例和数据生成器
- 配置 playwright 和 gitignore 文件
2024-12-22 19:18:27 +08:00

44 lines
1.4 KiB
TypeScript

import { Page } from 'playwright';
import { waitSpecifyApiLoad } from '@/utils/utils';
export class TransferManagementPage {
page: Page;
subPages: { name: string; url?: string[] }[];
/**
* 库存-调货管理页面
* @param {import("@playwright/test").Page} page
*/
constructor(page: Page) {
this.page = page;
this.subPages = [
{ name: '门店要货', url: ['/stock'] },
{ name: '要货单', url: ['/transfer_stock_bill'] },
{ name: '调货管理', url: ['/transfer_stock_bill'] },
];
}
gotoSubPage = async (subPageName: string) => {
if (!this.subPages.some(item => item.name === subPageName)) {
throw new Error(`暂不支持${subPageName}页面`);
}
const $dropDown = this.page
.locator('.top_tab .tab_item', {
hasText: '调货管理',
})
.locator('.ant-dropdown-link');
await $dropDown.click();
const subPage = this.subPages.find(item => item.name === subPageName);
if (subPage?.url) {
await Promise.all([
this.page.getByRole('menuitem', { name: subPageName }).click(),
waitSpecifyApiLoad(subPage.url),
]);
} else {
await this.page.getByRole('menuitem', { name: subPageName }).click();
}
};
}