123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- /**
- * Device Mock Handlers
- * 设备相关的 mock 处理器
- */
- /**
- * 打开设备 - 成功场景
- *
- * @description 打开指定设备
- * @method POST
- * @url /api/v1/auth/device/open
- * @access 需要认证
- *
- * @param {Object} requestBody - 请求体
- * @param {string} requestBody.deviceUri - 设备URI
- *
- * @returns {Object} 成功响应
- *
- * @example
- * mockOpenDeviceSuccess();
- * cy.wait('@openDeviceSuccess');
- *
- * @see docs/DR.md - 章节28
- */
- export function mockOpenDeviceSuccess() {
- cy.intercept('POST', '/api/v1/auth/device/open', {
- statusCode: 200,
- body: {
- code: "0x000000",
- description: "Success",
- solution: "",
- data: {
- "@type": "type.googleapis.com/google.protobuf.Empty",
- value: {}
- }
- }
- }).as('openDeviceSuccess');
- }
- /**
- * 执行设备Get操作 - 成功场景
- *
- * @description 执行设备的Get操作,获取设备状态或参数
- * @method POST
- * @url /api/v1/auth/device/get
- * @access 需要认证
- *
- * @param {Object} requestBody - 请求体
- * @param {string} requestBody.deviceUri - 设备URI
- * @param {string} requestBody.reqName - 请求名称
- *
- * @returns {Object} data - 设备状态数据(JSON字符串)
- *
- * @example
- * mockDeviceGetSuccess();
- * cy.wait('@deviceGetSuccess');
- *
- * @see docs/DR.md - 章节29
- */
- export function mockDeviceGetSuccess() {
- cy.intercept('POST', '/api/v1/auth/device/get', {
- statusCode: 200,
- body: {
- code: "0x000000",
- description: "Success",
- solution: "",
- data: JSON.stringify({
- IsDemo: { Value: "1" },
- GENERATORSTATUS: { Value: "4" },
- KV: { Value: "70.0" },
- MA: { Value: "125.0" }
- })
- }
- }).as('deviceGetSuccess');
- }
- /**
- * 执行设备Action操作 - 成功场景
- *
- * @description 执行设备的Action操作,控制设备行为
- * @method POST
- * @url /api/v1/auth/device/action
- * @access 需要认证
- *
- * @param {Object} requestBody - 请求体
- * @param {string} requestBody.deviceUri - 设备URI
- * @param {string} requestBody.reqName - 请求名称
- * @param {string} requestBody.reqParam - 请求参数
- *
- * @returns {Object} 成功响应
- *
- * @example
- * mockDeviceActionSuccess();
- * cy.wait('@deviceActionSuccess');
- *
- * @see docs/DR.md - 章节30
- */
- export function mockDeviceActionSuccess() {
- cy.intercept('POST', '/api/v1/auth/device/action', {
- statusCode: 200,
- body: {
- code: "0x000000",
- description: "Success",
- solution: "",
- data: {
- "@type": "type.googleapis.com/google.protobuf.Empty",
- value: {}
- }
- }
- }).as('deviceActionSuccess');
- }
|