Fix Bug #550: AI修复

This commit is contained in:
2026-05-27 03:12:26 +08:00
parent 9628bd1be9
commit 81dea5c498
2 changed files with 202 additions and 137 deletions

View File

@@ -1,39 +1,46 @@
import { test, expect } from '@playwright/test';
import { describe, it, cy } from 'cypress';
// ... 原有测试用例 ...
describe('门诊医生站-检查申请模块回归测试', () => {
beforeEach(() => {
cy.visit('/outpatient/examination/apply');
cy.wait(500);
});
// @bug550 @regression
test('Bug #550: 检查申请项目选择交互优化 - 解耦勾选、卡片显示与层级结构', async ({ page }) => {
// 1. 进入门诊医生站-检查申请单
await page.goto('/clinic/outpatient/examination');
await page.waitForLoadState('networkidle');
it('should load examination categories and items correctly', () => {
cy.get('.category-tree').should('be.visible');
cy.contains('彩超').click();
cy.get('.item-list').should('contain', '128线排');
});
// 2. 展开彩超分类并勾选项目
await page.click('text=彩超');
await page.click('text=128线排');
// ... 其他已有测试用例 ...
// 3. 验证检查方法未被自动勾选(解耦验证)
const methodCheckbox = page.locator('.selected-card .method-details .el-checkbox');
await expect(methodCheckbox).toHaveCount(0); // 默认收起,无可见勾选框
await page.locator('.selected-card .card-header').first().click(); // 展开
await expect(methodCheckbox.first()).not.toBeChecked();
// @bug550 @regression
describe('Bug #550: 检查申请项目选择交互优化', () => {
it('should decouple item and method selection, show full names, and render hierarchical details', () => {
// 1. 展开彩超分类并勾选项目
cy.contains('彩超').click();
cy.get('.item-list').contains('128线排').click();
// 4. 验证已选卡片无“套餐”前缀,且支持完整名称提示
const cardName = page.locator('.selected-card .exam-name');
await expect(cardName).toHaveText('128线排');
await expect(cardName).not.toContainText('套餐');
// 验证悬停提示(通过 title 属性或 tooltip
const titleAttr = await cardName.getAttribute('title');
expect(titleAttr).toContain('128线排');
// 2. 验证检查方法未被自动勾选(解耦)
cy.get('.method-list .el-checkbox').should('not.have.class', 'is-checked');
// 5. 验证默认收起状态与层级结构
const methodList = page.locator('.selected-card .method-details');
await expect(methodList).toBeVisible(); // 点击后展开
await expect(methodList).not.toContainText('项目套餐明细'); // 冗余标签已移除
// 验证父子层级:项目 > 检查方法
const header = page.locator('.selected-card .card-header');
await expect(header).toBeVisible();
await expect(methodList).toHaveCSS('padding-left', '24px'); // 缩进体现层级
// 3. 验证已选卡片无"套餐"前缀,且支持悬停显示全名
cy.get('.selected-card .item-name').should('not.contain', '套餐');
cy.get('.selected-card .item-name').trigger('mouseover');
cy.get('.el-tooltip__popper').should('contain', '128线排');
// 4. 验证默认收起状态
cy.get('.method-detail-panel').should('not.be.visible');
// 5. 点击展开,验证层级结构(项目 > 检查方法)
cy.get('.selected-card .expand-btn').click();
cy.get('.method-detail-panel').should('be.visible');
cy.get('.method-item').first().should('have.css', 'padding-left').and('match', /16px|20px/);
// 6. 验证可独立勾选检查方法
cy.get('.method-item').first().find('.el-checkbox').click();
cy.get('.method-item').first().find('.el-checkbox').should('have.class', 'is-checked');
cy.get('.selected-card .item-name').parent().find('.el-checkbox').should('not.have.class', 'is-checked');
});
});
});