123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- /**
- * System Mock Handlers
- * 系统信息相关的 mock 处理器
- */
- /**
- * 获取软件信息 - 成功场景
- *
- * @description 获取系统软件版本、设备类型、语言等信息
- * @method GET
- * @url /dr/api/v1/pub/software_info
- * @access 公开接口
- *
- * @returns {Object} 包含软件版本、服务器信息、设备信息等
- * @returns {string} data.FPD - 探测器类型(Simulator)
- * @returns {string} data.GEN - 发生器类型(Simulator)
- * @returns {string} data.guest - 访客令牌
- * @returns {string[]} data.language - 支持的语言列表
- * @returns {string} data.product - 产品名称(DROS)
- * @returns {string} data.sn - 设备序列号
- * @returns {Object} data.server - 各服务器版本信息
- *
- * @example
- * mockGetSoftwareInfoSuccess();
- * cy.wait('@getSoftwareInfoSuccess').its('response.body.data.product').should('equal', 'DROS');
- *
- * @see docs/DR.md - 章节2
- */
- export function mockGetSoftwareInfoSuccess() {
- cy.intercept('GET', '/dr/api/v1/pub/software_info', {
- statusCode: 200,
- body: {
- code: "0x000000",
- data: {
- FPD: "Simulator",
- GEN: "Simulator",
- guest: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTY3MjAxMTUsImlkIjoyLCJuYW1lIjoiZ3Vlc3QifQ.cDkkxM2mkiCQf7T87WsCMewITk13c7jSDoniT7gDHXQ",
- language: ["en", "zh"],
- product: "DROS",
- server: {
- auth: {
- build: "2025-08-25 17:45:18",
- desc: "Authentication Server repo",
- submodule: ["3a167dd4[rpc_idl]"],
- version: "0.3.0-13-g8b85622"
- },
- dcmtk: {
- build: "2025-08-25 13:43:16",
- desc: "Dcmtk Server repo",
- submodule: ["0fc2b1e4[rpc_idl]"],
- version: "0.3.0-12-gff618d4"
- },
- imgProc: {
- build: "2025-08-25 13:46:23",
- desc: "Img Proc Server repo",
- submodule: [
- "5e507af7[auto_wwwl]",
- "3a75bb1f[collimator_circle]",
- "e7b69785[collimator_rect]",
- "6b7fbbd1[enhance]",
- "5905e001[rpc_idl]"
- ],
- version: "0.3.0-7-gbb2ee0b"
- },
- protocol: {
- build: "2025-08-25 17:45:23",
- desc: "Protocol Server repo",
- submodule: ["3a167dd4[rpc_idl]"],
- version: "0.3.0-7-g1954756"
- },
- resource: {
- build: "2025-08-25 17:45:27",
- desc: "Resource Server repo",
- submodule: ["0fc2b1e4[rpc_idl]"],
- version: "0.3.0-12-g60e37c1"
- },
- study: {
- build: "2025-08-25 17:45:25",
- desc: "Study Server repo",
- submodule: ["3a167dd4[rpc_idl]"],
- version: "0.3.0-11-g784ba1b"
- },
- task: {
- build: "2025-08-25 17:45:29",
- desc: "Task Server repo",
- submodule: ["0fc2b1e4[rpc_idl]"],
- version: "0.3.0-20-ge9ec04a"
- }
- },
- sn: "2edbc382-044adc78-95bed11b-51c9328a"
- },
- description: "Success",
- solution: ""
- }
- }).as('getSoftwareInfoSuccess');
- }
- /**
- * 获取软件信息 - 失败场景
- *
- * @description 获取软件信息失败,服务器错误
- * @method GET
- * @url /dr/api/v1/pub/software_info
- * @access 公开接口
- *
- * @returns {Object} 错误响应
- * @returns {string} code - 错误码
- * @returns {string} description - 错误描述
- *
- * @example
- * mockGetSoftwareInfoFail();
- * cy.wait('@getSoftwareInfoFail');
- *
- * @see docs/DR.md - 章节2
- */
- export function mockGetSoftwareInfoFail() {
- cy.intercept('GET', '/dr/api/v1/pub/software_info', {
- statusCode: 500,
- body: {
- code: "0x000001",
- data: {},
- description: "Internal Server Error",
- solution: "Please contact system administrator"
- }
- }).as('getSoftwareInfoFail');
- }
|