import { test, expect } from '@playwright/test'; // 原有测试用例保持不变... // test.describe('Existing Tests', () => { ... }); test.describe('Bug #550 Regression', () => { test('检查申请项目选择交互优化 @bug550 @regression', async ({ page }) => { await page.goto('/outpatient/exam-request'); // 1. 验证解耦:勾选项目不应自动勾选检查方法 await page.click('text=彩超'); await page.click('text=128线排'); const methodCheckbox = page.locator('.selected-card .method-item input[type="checkbox"]').first(); await expect(methodCheckbox).not.toBeChecked('勾选项目时检查方法应保持未勾选状态'); // 2. 验证卡片显示:无冗余“套餐”字样,支持悬停提示完整名称 const cardName = page.locator('.selected-card .item-name').first(); await expect(cardName).not.toContainText('套餐'); await expect(cardName).toHaveAttribute('title', expect.stringContaining('128线排')); // 3. 验证默认折叠与层级结构 const detailsPanel = page.locator('.selected-card .card-details').first(); await expect(detailsPanel).toBeHidden('默认状态下明细应收起'); await cardName.click(); await expect(detailsPanel).toBeVisible('点击卡片头部应展开明细'); // 验证父子层级渲染正确 const parentItem = page.locator('.selected-card').first(); await expect(parentItem).toHaveClass(/selected-card/); const childMethods = parentItem.locator('.method-item'); await expect(childMethods).toHaveCount(1); // 至少包含关联方法节点 }); });