Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
wangjian963
2026-06-01 14:16:05 +08:00
17 changed files with 77 additions and 2042 deletions

View File

@@ -26,3 +26,4 @@ yarn.lock
test-results/ test-results/
tests/e2e/report/ tests/e2e/report/
tests/tests/ tests/tests/
vite.config.js.timestamp*

View File

@@ -1,47 +1,83 @@
import { test, expect } from '@playwright/test'; import { test, expect } from '@playwright/test';
import { LoginPage } from '../pages/LoginPage';
/** /**
* Bug #630: Bug #630 待确认标题 * Bug #630: [门诊医生站] 点击选择现诊患者列表报错
* 自动生成: 2026-06-01 09:36:18 * 禅道信息:
* - 登录doctor1 / 123456租户=中联医院(tenantId=1)
* - 步骤:进入门诊医生站 → 点击左侧现诊患者 → 观察右侧加载
*/ */
test.describe('🐛 Bug#630', () => { test.describe('🐛 Bug#630 门诊医生站现诊患者列表', () => {
let loginPage: LoginPage; test('#630 点击现诊患者不应报错 @bug630 @regression', async ({ page }) => {
// 1. 登录
test.beforeEach(async ({ page }) => { await page.goto('http://localhost:81/');
loginPage = new LoginPage(page); const loginResp = await page.request.post('http://localhost:18082/openhis/login', {
await loginPage.goto(); data: { username: 'doctor1', password: '123456', tenantId: '1', code: '', uuid: '' }
await loginPage.login(
process.env.TEST_USERNAME || 'admin',
process.env.TEST_PASSWORD || 'admin123'
);
await loginPage.expectLoginSuccess();
}); });
const loginData = await loginResp.json();
expect(loginData.code).toBe(200);
await page.context().addCookies([{
name: 'Admin-Token', value: loginData.token, domain: 'localhost', path: '/'
}]);
test('#630 Bug #630 待确认标题 @bug630 @regression', async ({ page }) => { // 2. 进入首页
await page.goto('/'); await page.goto('http://localhost:81/index');
await page.waitForLoadState('networkidle'); 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. 验证"现诊患者"标签存在
await expect(page).not.toHaveURL(/.*login.*/); const patientLabel = page.locator('text=现诊患者');
await expect(patientLabel).toBeVisible({ timeout: 10000 });
console.log('✅ 现诊患者标签可见');
// 检查无 JS 错误 // 5. 截图:门诊医生站页面
const jsErrors: string[] = []; await page.screenshot({ path: 'test-results/bug-630-step1.png', fullPage: true });
page.on('pageerror', (err) => jsErrors.push(err.message));
await page.waitForTimeout(2000);
// 页面基本可交互 // 6. 查找患者列表项(可能是表格行或列表项)
const body = page.locator('body'); const patientSelectors = [
await expect(body).toBeVisible(); '.el-table__body tr',
'.patient-item',
'.current-patient',
'[class*="patient-list"] li',
'.list-item',
];
// 截图记录 let clickedPatient = false;
await page.screenshot({ for (const selector of patientSelectors) {
path: 'tests/e2e/report/bug-630-result.png', const items = page.locator(selector);
fullPage: true 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})`);
}
}
}
// 无 JS 错误 if (!clickedPatient) {
expect(jsErrors).toEqual([]); 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);
}); });
}); });

View File

@@ -40,7 +40,7 @@ export default defineConfig(({ mode, command }) => {
proxy: { proxy: {
// https://cn.vitejs.dev/config/#server-proxy // https://cn.vitejs.dev/config/#server-proxy
'/dev-api': { '/dev-api': {
target: 'http://localhost:18080/openhis', target: process.env.VITE_API_PROXY || 'http://localhost:18080/openhis',
changeOrigin: true, changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, ''), rewrite: (p) => p.replace(/^\/dev-api/, ''),
}, },

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long