system.ts 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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: "Physics",
  35. GEN: "Physics",
  36. current_locale: "zh_CN",
  37. default_locale: "zh_CN",
  38. guest: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NjA0OTc2NDksImlkIjoyLCJuYW1lIjoiZ3Vlc3QifQ.hUV5_GOzlWKDeFioJCsHMG2IXa0oJPfNNlPsr69ypqc",
  39. language: ["en", "zh"],
  40. product: "VETDROS",
  41. server: {
  42. auth: {
  43. build: "2025-08-25 17:45:18",
  44. desc: "Authentication Server repo",
  45. submodule: ["3a167dd4[rpc_idl]"],
  46. version: "0.3.0-13-g8b85622"
  47. },
  48. dcmtk: {
  49. build: "2025-08-25 13:43:16",
  50. desc: "Dcmtk Server repo",
  51. submodule: ["0fc2b1e4[rpc_idl]"],
  52. version: "0.3.0-12-gff618d4"
  53. },
  54. imgProc: {
  55. build: "2025-08-25 13:46:23",
  56. desc: "Img Proc Server repo",
  57. submodule: [
  58. "5e507af7[auto_wwwl]",
  59. "3a75bb1f[collimator_circle]",
  60. "e7b69785[collimator_rect]",
  61. "6b7fbbd1[enhance]",
  62. "5905e001[rpc_idl]"
  63. ],
  64. version: "0.3.0-7-gbb2ee0b"
  65. },
  66. protocol: {
  67. build: "2025-08-25 17:45:23",
  68. desc: "Protocol Server repo",
  69. submodule: ["3a167dd4[rpc_idl]"],
  70. version: "0.3.0-7-g1954756"
  71. },
  72. resource: {
  73. build: "2025-08-25 17:45:27",
  74. desc: "Resource Server repo",
  75. submodule: ["0fc2b1e4[rpc_idl]"],
  76. version: "0.3.0-12-g60e37c1"
  77. },
  78. study: {
  79. build: "2025-08-25 17:45:25",
  80. desc: "Study Server repo",
  81. submodule: ["3a167dd4[rpc_idl]"],
  82. version: "0.3.0-11-g784ba1b"
  83. },
  84. task: {
  85. build: "2025-08-25 17:45:29",
  86. desc: "Task Server repo",
  87. submodule: ["0fc2b1e4[rpc_idl]"],
  88. version: "0.3.0-20-ge9ec04a"
  89. }
  90. },
  91. sn: "19d5d2eb-8b720370-7d617b19-670dd1ae"
  92. },
  93. description: "Success",
  94. solution: ""
  95. }
  96. }).as('getSoftwareInfoSuccess');
  97. }
  98. /**
  99. * 获取软件信息 - 失败场景
  100. *
  101. * @description 获取软件信息失败,服务器错误
  102. * @method GET
  103. * @url /dr/api/v1/pub/software_info
  104. * @access 公开接口
  105. *
  106. * @returns {Object} 错误响应
  107. * @returns {string} code - 错误码
  108. * @returns {string} description - 错误描述
  109. *
  110. * @example
  111. * mockGetSoftwareInfoFail();
  112. * cy.wait('@getSoftwareInfoFail');
  113. *
  114. * @see docs/DR.md - 章节2
  115. */
  116. export function mockGetSoftwareInfoFail() {
  117. cy.intercept('GET', '/dr/api/v1/pub/software_info', {
  118. statusCode: 500,
  119. body: {
  120. code: "0x000001",
  121. data: {},
  122. description: "Internal Server Error",
  123. solution: "Please contact system administrator"
  124. }
  125. }).as('getSoftwareInfoFail');
  126. }