- 新增页面对象: SurgeryBillingPage, DoctorStationPage - 新增测试用例: 手术计费防重复(#437), 签发耗材验证(#443), 并发操作测试 - 增强登录测试: 多场景覆盖 - 完善测试数据工具: 支持多角色用户配置 - 清理冗余备份文件
59 lines
2.1 KiB
TypeScript
59 lines
2.1 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
||
import { LoginPage } from '../pages/LoginPage';
|
||
import { TEST_USERS, TEST_URLS } from '../utils/test-data';
|
||
|
||
test.describe('🐛 Bug回归测试', () => {
|
||
let loginPage: LoginPage;
|
||
|
||
test.beforeEach(async ({ page }) => {
|
||
loginPage = new LoginPage(page);
|
||
await loginPage.goto();
|
||
await loginPage.login(TEST_USERS.admin.username, TEST_USERS.admin.password);
|
||
await loginPage.expectLoginSuccess();
|
||
});
|
||
|
||
test('#437 手术计费防重复提交 @bug437 @regression', async ({ page }) => {
|
||
await page.goto(TEST_URLS.surgeryBilling);
|
||
await page.waitForLoadState('networkidle');
|
||
|
||
const addBtn = page.locator('button:has-text("新增"), button:has-text("生成")');
|
||
if (await addBtn.isVisible()) {
|
||
// 快速连续点击3次
|
||
await addBtn.click();
|
||
await addBtn.click();
|
||
await addBtn.click();
|
||
await page.waitForTimeout(2000);
|
||
|
||
// 验证只弹出一个对话框
|
||
const dialogs = page.locator('.el-dialog, .el-message-box');
|
||
expect(await dialogs.count()).toBeLessThanOrEqual(1);
|
||
}
|
||
});
|
||
|
||
test('#443 手术计费签发耗材 @bug443 @regression', async ({ page }) => {
|
||
await page.goto(TEST_URLS.surgeryBilling);
|
||
await page.waitForLoadState('networkidle');
|
||
// 验证签发功能不报错(locationId为空时应有默认值)
|
||
const signBtn = page.locator('button:has-text("签发"), button:has-text("提交")');
|
||
if (await signBtn.isVisible()) {
|
||
await signBtn.click();
|
||
await page.waitForTimeout(2000);
|
||
// 不应出现"发放库房为空"错误
|
||
const errorMsg = page.locator('text=发放库房为空');
|
||
expect(await errorMsg.count()).toBe(0);
|
||
}
|
||
});
|
||
|
||
test('#427 检查项目分类手风琴展开 @regression', async ({ page }) => {
|
||
await page.goto(TEST_URLS.doctorStation);
|
||
await page.waitForLoadState('networkidle');
|
||
// 验证分类展开功能
|
||
const categories = page.locator('.el-collapse-item, .category-item');
|
||
const count = await categories.count();
|
||
if (count > 0) {
|
||
await categories.first().click();
|
||
await page.waitForTimeout(500);
|
||
}
|
||
});
|
||
});
|