fix: 修正Playwright登录页选择器 - 使用实际placeholder '账号'/'密码'

This commit is contained in:
2026-04-25 22:29:23 +08:00
parent 34ba7cae6a
commit 8fb1d3e583
6 changed files with 49 additions and 81 deletions

View File

@@ -1,43 +1,42 @@
import { test, expect } from '@playwright/test';
import { LoginPage } from '../pages/LoginPage';
import { SurgeryBillingPage } from '../pages/SurgeryBillingPage';
import { TEST_USERS, TEST_URLS } from '../utils/test-data';
test.describe('💊 手术计费模块', () => {
let loginPage: LoginPage;
let surgeryPage: SurgeryBillingPage;
test.beforeEach(async ({ page }) => {
loginPage = new LoginPage(page);
surgeryPage = new SurgeryBillingPage(page);
await loginPage.goto();
await loginPage.login(TEST_USERS.admin.username, TEST_USERS.admin.password);
await loginPage.expectLoginSuccess();
});
test('#437 快速连续点击防重复 @bug437 @smoke', async () => {
await surgeryPage.goto();
test('#437 快速连续点击防重复 @bug437 @smoke', async ({ page }) => {
await page.goto(TEST_URLS.surgeryBilling);
await page.waitForLoadState('networkidle');
if (await surgeryPage.generateBtn.isVisible()) {
// 模拟用户快速连点
await surgeryPage.rapidClickGenerate(5);
await surgeryPage.page.waitForTimeout(3000);
const genBtn = page.locator('button:has-text("生成"), button:has-text("新增")');
if (await genBtn.isVisible()) {
for (let i = 0; i < 5; i++) {
await genBtn.click().catch(() => {});
}
await page.waitForTimeout(3000);
// 验证没有产生重复对话框
const count = await surgeryPage.getDialogCount();
const count = await page.locator('.el-dialog, .el-message-box').count();
expect(count).toBeLessThanOrEqual(1);
}
});
test('#443 签发耗材不报库房错误 @bug443 @smoke', async () => {
await surgeryPage.goto();
test('#443 签发耗材不报库房错误 @bug443 @smoke', async ({ page }) => {
await page.goto(TEST_URLS.surgeryBilling);
await page.waitForLoadState('networkidle');
if (await surgeryPage.signBtn.isVisible()) {
await surgeryPage.signBtn.click();
await surgeryPage.page.waitForTimeout(2000);
// 不应出现"发放库房为空"错误
await surgeryPage.expectNoLocationIdError();
const signBtn = page.locator('button:has-text("签发"), button:has-text("提交")');
if (await signBtn.isVisible()) {
await signBtn.click();
await page.waitForTimeout(2000);
await expect(page.locator('text=发放库房为空')).toHaveCount(0, { timeout: 5000 });
}
});
});