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/baseFixture.ts
LingandRX 3547f32493 ci(gitlab): 添加 GitLab CI 配置并更新测试相关代码
- 新增 .gitlab-ci.yml 文件,配置 GitLab CI/CD 管道
- 移除 AuthAccount 类中未使用的 indexedDBFile 属性
- 简化 baseFixture 中的测试初始化流程
- 更新 CustomerPage 中的顾客创建逻辑
- 调整 boss_cashier.spec.ts 中的二维码解码和输入值设置
- 新增 boss_test.spec.ts 文件,添加创建顾客的测试用例
2025-03-12 00:22:22 +08:00

49 lines
1.6 KiB
TypeScript

import { test as base, expect } from '@playwright/test';
import { HomeNavigation } from '@/pages/homeNavigationPage';
import { firstAccount, secondAccount, AuthAccount } from '@/common/auth';
type MyFixture = {
homeNavigation: HomeNavigation;
billSet: Set<string>;
};
export const test = base.extend<MyFixture>({
page: async ({ page, baseURL }, use) => {
await page.addLocatorHandler(page.locator('.left_img > .close_btn > .close_icon > svg'), async () => {
await page.locator('.left_img > .close_btn > .close_icon > svg').click();
await expect(page.locator('.versionModal_main_content')).toBeVisible();
});
if (!baseURL) throw new Error('baseURL is required');
await page.goto(baseURL);
// await page.getByRole('button', { name: /开\s单/ }).waitFor();
await expect(page.getByRole('button', { name: /开\s单/ })).toBeEnabled();
await page.reload();
await page.getByRole('button', { name: /开\s单/ }).click();
// await page.getByRole('button', { name: /开\s单/ }).waitFor();
await expect(page.getByRole('button', { name: '创建会员' })).toBeEnabled();
await use(page);
},
/**
* 首页导航
*/
homeNavigation: async ({ page }, use) => {
const homeNavigation = new HomeNavigation(page);
await use(homeNavigation);
},
/**
* 流水单据集合(无重复水单)
*/
billSet: async ({ page }, use) => {
const billSet = new Set<string>();
await use(billSet);
},
});
export { expect } from '@playwright/test';