123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- /**
- * 测试文件: 阶段3-进入检查
- * 路径: 路径1.2-Worklist导航按钮进入
- *
- * 路径分析:
- * - POM: LoginPage, MainPage, WorklistPage, ExamPage
- * - Mock:
- * - mockLoginSuccess()
- * - mockFetchTwoWorks()
- * - mockGetStudyArrived()
- * - 规格:
- * ✓ 登录成功
- * ✓ 导航到工作列表
- * ✓ 选中第一条记录(单击)
- * ✓ 点击导航按钮 "exam"
- * ✓ 系统加载任务信息
- * ✓ 进入检查界面
- * - 需要新建: ExamPage POM(已创建)
- * - 需要添加: 检查界面元素的data-testid
- * - 已有的data-testid:
- * - MainPage: exam - 导航到检查的按钮
- * - WorklistTable: row-{index} - 表格行
- */
- import { mockLoginSuccess } from '../../support/mock/handlers/user';
- import { mockFetchTwoWorks } from '../../support/mock/handlers/worklist';
- import { mockGetStudyArrived } from '../../support/mock/handlers/study';
- import LoginPage from '../../support/pageObjects/LoginPage';
- import MainPage from '../../support/pageObjects/MainPage';
- import WorklistPage from '../../support/pageObjects/WorklistPage';
- import ExamPage from '../../support/pageObjects/ExamPage';
- describe('阶段3:进入检查 - 路径1.2:Worklist导航按钮进入', () => {
- const loginPage = new LoginPage();
- const mainPage = new MainPage();
- const worklistPage = new WorklistPage();
- const examPage = new ExamPage();
- beforeEach(() => {
- // 设置Mock
- mockLoginSuccess();
- mockFetchTwoWorks();
- mockGetStudyArrived();
- });
- it('应该通过选中条目并点击导航按钮进入检查界面', () => {
- /**
- * Given: 用户已登录并在Worklist页面
- * 步骤1(前置): 完成登录并导航到Worklist
- */
- loginPage.visit();
- loginPage.login('admin', '123456');
- cy.wait('@loginSuccess');
-
- /**
- * When: 导航到Worklist
- * 步骤1: 打开 Worklist
- */
- mainPage.clickPatientManagementButton();
- mainPage.clickWorklistButton();
- cy.wait('@fetchTwoWorks');
- // 验证Worklist显示
- worklistPage.getTable().should('be.visible');
- /**
- * When: 选中第一条任务条目(单击)
- * 步骤2: 选中任务条目
- */
- cy.get('tbody tr[data-testid="row-0"]').click();
- /**
- * Then: 验证行被选中(背景色变化)
- */
- cy.get('tbody tr[data-testid="row-0"]')
- .should('have.class', 'bg-yellow-500');
- /**
- * When: 点击导航按钮"exam"
- * 步骤3: 点击导航按钮"exam"
- */
- mainPage.clickExamButton();
- /**
- * Then: 系统加载任务信息,进入检查界面
- * 步骤4: 系统加载任务信息
- * 步骤5: 进入检查界面
- */
- cy.wait('@getStudyArrived').then((interception) => {
- expect(interception.response?.statusCode).to.eq(200);
- // 验证返回的检查数据
- expect(interception.response?.body.data).to.have.property('StudyID');
- expect(interception.response?.body.data.StudyStatus).to.eq('Arrived');
- });
- /**
- * Then: 验证进入检查界面
- * 注意:当前需要在实际的检查页面组件中添加data-testid
- * TODO: 添加检查界面的实际验证
- *
- * 预期验证(待实现):
- * - examPage.verifyExamPageLoaded();
- * - examPage.getPatientInfo().should('be.visible');
- * - examPage.getStudyId().should('contain', 'expected-study-id');
- */
-
- // 临时验证:确保离开了worklist页面
- cy.url().should('not.include', 'worklist');
- });
- });
|