import { describe, it, cy } from 'cypress' describe('Bug Regression Tests', () => { // 历史回归用例占位... it('should pass existing regression tests', () => { cy.log('Existing regression suite placeholder') }) }) // @bug562 @regression describe('Bug #562: 门诊医生工作站-待写病历加载性能', () => { it('待写病历列表应在2秒内完成加载并渲染', () => { // 拦截待写病历接口,模拟真实网络请求 cy.intercept('GET', '/api/orders/pending*').as('getPendingOrders') cy.login('doctor1', '123456') cy.visit('/outpatient/doctor-workstation') // 点击待写病历Tab cy.get('[data-cy="tab-pending-records"]').click() // 记录开始时间并等待接口响应 const startTime = Date.now() cy.wait('@getPendingOrders', { timeout: 2000 }).then((interception) => { const loadTime = Date.now() - startTime expect(interception.response?.statusCode).to.eq(200) expect(loadTime).to.be.lessThan(2000, `接口响应耗时 ${loadTime}ms 超过2秒阈值`) }) // 验证数据渲染完成且加载状态已清除 cy.get('[data-cy="records-table"]').should('be.visible') cy.get('[data-cy="loading-spinner"]').should('not.exist') }) })