system.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /**
  2. * System Mock Handlers
  3. * 系统信息相关的 mock 处理器
  4. */
  5. /**
  6. * 获取软件信息 - 成功场景
  7. *
  8. * @description 获取系统软件版本、设备类型、语言等信息
  9. * @method GET
  10. * @url /dr/api/v1/pub/software_info
  11. * @access 公开接口
  12. *
  13. * @returns {Object} 包含软件版本、服务器信息、设备信息等
  14. * @returns {string} data.FPD - 探测器类型(Simulator)
  15. * @returns {string} data.GEN - 发生器类型(Simulator)
  16. * @returns {string} data.guest - 访客令牌
  17. * @returns {string[]} data.language - 支持的语言列表
  18. * @returns {string} data.product - 产品名称(DROS)
  19. * @returns {string} data.sn - 设备序列号
  20. * @returns {Object} data.server - 各服务器版本信息
  21. *
  22. * @example
  23. * mockGetSoftwareInfoSuccess();
  24. * cy.wait('@getSoftwareInfoSuccess').its('response.body.data.product').should('equal', 'DROS');
  25. *
  26. * @see docs/DR.md - 章节2
  27. */
  28. export function mockGetSoftwareInfoSuccess() {
  29. cy.intercept('GET', '/dr/api/v1/pub/software_info', {
  30. statusCode: 200,
  31. body: {
  32. code: "0x000000",
  33. data: {
  34. FPD: "Simulator",
  35. GEN: "Simulator",
  36. guest: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTY3MjAxMTUsImlkIjoyLCJuYW1lIjoiZ3Vlc3QifQ.cDkkxM2mkiCQf7T87WsCMewITk13c7jSDoniT7gDHXQ",
  37. language: ["en", "zh"],
  38. product: "DROS",
  39. server: {
  40. auth: {
  41. build: "2025-08-25 17:45:18",
  42. desc: "Authentication Server repo",
  43. submodule: ["3a167dd4[rpc_idl]"],
  44. version: "0.3.0-13-g8b85622"
  45. },
  46. dcmtk: {
  47. build: "2025-08-25 13:43:16",
  48. desc: "Dcmtk Server repo",
  49. submodule: ["0fc2b1e4[rpc_idl]"],
  50. version: "0.3.0-12-gff618d4"
  51. },
  52. imgProc: {
  53. build: "2025-08-25 13:46:23",
  54. desc: "Img Proc Server repo",
  55. submodule: [
  56. "5e507af7[auto_wwwl]",
  57. "3a75bb1f[collimator_circle]",
  58. "e7b69785[collimator_rect]",
  59. "6b7fbbd1[enhance]",
  60. "5905e001[rpc_idl]"
  61. ],
  62. version: "0.3.0-7-gbb2ee0b"
  63. },
  64. protocol: {
  65. build: "2025-08-25 17:45:23",
  66. desc: "Protocol Server repo",
  67. submodule: ["3a167dd4[rpc_idl]"],
  68. version: "0.3.0-7-g1954756"
  69. },
  70. resource: {
  71. build: "2025-08-25 17:45:27",
  72. desc: "Resource Server repo",
  73. submodule: ["0fc2b1e4[rpc_idl]"],
  74. version: "0.3.0-12-g60e37c1"
  75. },
  76. study: {
  77. build: "2025-08-25 17:45:25",
  78. desc: "Study Server repo",
  79. submodule: ["3a167dd4[rpc_idl]"],
  80. version: "0.3.0-11-g784ba1b"
  81. },
  82. task: {
  83. build: "2025-08-25 17:45:29",
  84. desc: "Task Server repo",
  85. submodule: ["0fc2b1e4[rpc_idl]"],
  86. version: "0.3.0-20-ge9ec04a"
  87. }
  88. },
  89. sn: "2edbc382-044adc78-95bed11b-51c9328a"
  90. },
  91. description: "Success",
  92. solution: ""
  93. }
  94. }).as('getSoftwareInfoSuccess');
  95. }
  96. /**
  97. * 获取软件信息 - 失败场景
  98. *
  99. * @description 获取软件信息失败,服务器错误
  100. * @method GET
  101. * @url /dr/api/v1/pub/software_info
  102. * @access 公开接口
  103. *
  104. * @returns {Object} 错误响应
  105. * @returns {string} code - 错误码
  106. * @returns {string} description - 错误描述
  107. *
  108. * @example
  109. * mockGetSoftwareInfoFail();
  110. * cy.wait('@getSoftwareInfoFail');
  111. *
  112. * @see docs/DR.md - 章节2
  113. */
  114. export function mockGetSoftwareInfoFail() {
  115. cy.intercept('GET', '/dr/api/v1/pub/software_info', {
  116. statusCode: 500,
  117. body: {
  118. code: "0x000001",
  119. data: {},
  120. description: "Internal Server Error",
  121. solution: "Please contact system administrator"
  122. }
  123. }).as('getSoftwareInfoFail');
  124. }