Files
his/healthlink-his-ui/tests/e2e/specs/bug-630.spec.ts
华佗 893cbf1fe0 refactor: 彻底清除所有openhis痕迹
- 重命名目录: openhis-server-new → healthlink-his-server
- 重命名目录: openhis-ui-vue3 → healthlink-his-ui
- 重命名Java类: OpenHisApplication → HealthLinkHisApplication
- 重命名Java类: OpenHisMiniApp → HealthLinkHisMiniApp
- 重命名组件目录: OpenHis → HealthLinkHis
- 重命名样式文件: openhis.scss → healthlink-his.scss
- 重命名配置: nginx-openhis.conf → nginx-healthlink-his.conf
- 更新所有源码引用 (0个残留)
- 更新所有文档/脚本/配置中的引用
2026-06-05 13:36:28 +08:00

84 lines
3.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { test, expect } from '@playwright/test';
/**
* Bug #630: [门诊医生站] 点击选择现诊患者列表报错
* 禅道信息:
* - 登录doctor1 / 123456租户=中联医院(tenantId=1)
* - 步骤:进入门诊医生站 → 点击左侧现诊患者 → 观察右侧加载
*/
test.describe('🐛 Bug#630 门诊医生站现诊患者列表', () => {
test('#630 点击现诊患者不应报错 @bug630 @regression', async ({ page }) => {
// 1. 登录
await page.goto('http://localhost:81/');
const loginResp = await page.request.post('http://localhost:18082/healthlink-his/login', {
data: { username: 'doctor1', password: '123456', tenantId: '1', code: '', uuid: '' }
});
const loginData = await loginResp.json();
expect(loginData.code).toBe(200);
await page.context().addCookies([{
name: 'Admin-Token', value: loginData.token, domain: 'localhost', path: '/'
}]);
// 2. 进入首页
await page.goto('http://localhost:81/index');
await page.waitForLoadState('networkidle');
await page.waitForTimeout(3000);
// 3. 通过侧边栏导航到门诊医生站
await page.locator('text=门诊医生工作站').first().click();
await page.waitForTimeout(1000);
await page.locator('text=门诊医生站').first().click();
await page.waitForTimeout(5000);
// 4. 验证"现诊患者"标签存在
const patientLabel = page.locator('text=现诊患者');
await expect(patientLabel).toBeVisible({ timeout: 10000 });
console.log('✅ 现诊患者标签可见');
// 5. 截图:门诊医生站页面
await page.screenshot({ path: 'test-results/bug-630-step1.png', fullPage: true });
// 6. 查找患者列表项(可能是表格行或列表项)
const patientSelectors = [
'.el-table__body tr',
'.patient-item',
'.current-patient',
'[class*="patient-list"] li',
'.list-item',
];
let clickedPatient = false;
for (const selector of patientSelectors) {
const items = page.locator(selector);
const count = await items.count();
if (count > 0) {
console.log(`找到 ${count} 个患者 (${selector})`);
try {
await items.first().click({ timeout: 5000 });
clickedPatient = true;
console.log('✅ 已点击患者');
break;
} catch {
console.log(`点击失败 (${selector})`);
}
}
}
if (!clickedPatient) {
console.log('⚠️ 没有患者数据,测试环境可能无数据');
}
// 7. 等待右侧加载
await page.waitForTimeout(5000);
await page.screenshot({ path: 'test-results/bug-630-step2.png', fullPage: true });
// 8. 验证没有错误弹窗
const errorPopups = page.locator('.el-message--error');
const errorCount = await errorPopups.count();
console.log('错误弹窗:', errorCount);
await page.screenshot({ path: 'test-results/bug-630-final.png', fullPage: true });
expect(errorCount).toBe(0);
});
});