commands.d.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /// <reference types="cypress" />
  2. declare namespace Cypress {
  3. interface Chainable<Subject = any> {
  4. /**
  5. * 自定义命令:登录并完成初始化进入主页
  6. *
  7. * 这个命令封装了完整的登录流程:
  8. * 1. 清除存储
  9. * 2. Mock 所有必要的 API(i18n、quota、patient types、body parts)
  10. * 3. 执行登录
  11. * 4. 等待初始化完成
  12. *
  13. * @param username - 用户名,默认 'admin'
  14. * @param password - 密码,默认 '123456'
  15. *
  16. * @example
  17. * cy.loginAndInitialize();
  18. * cy.loginAndInitialize('testuser', 'testpass');
  19. */
  20. loginAndInitialize(username?: string, password?: string): Chainable<Subject>;
  21. /**
  22. * 记录带时间戳的日志
  23. *
  24. * @param message - 日志消息
  25. * @param args - 额外参数
  26. */
  27. logWithDate(message: string, ...args: any[]): Chainable<Subject>;
  28. /**
  29. * 刷新浏览器 console 日志到终端
  30. *
  31. * 将缓冲区中的所有浏览器 console 日志输出到运行 Cypress 的终端
  32. *
  33. * @example
  34. * cy.flushConsoleLogs();
  35. */
  36. flushConsoleLogs(): Chainable<Subject>;
  37. }
  38. interface AUTWindow {
  39. __consoleLogs__?: Array<{
  40. type: 'log' | 'error' | 'warn';
  41. message: string;
  42. timestamp: string;
  43. }>;
  44. }
  45. }
  46. export {};