yapi-plugin-auto-test
Advanced tools
@@ -280,21 +280,11 @@ import React, { Component } from "react"; | ||
| <Checkbox.Group | ||
| options={triggerOptions} | ||
| onChange={this.onTriggerChange} | ||
| /> | ||
| options={triggerOptions} | ||
| onChange={this.onTriggerChange} | ||
| /> | ||
| )} | ||
| </FormItem> | ||
| {/* <FormItem {...formItemLayout} label="类型通知"> | ||
| {getFieldDecorator("notice_client", { | ||
| initialValue: "workWX" | ||
| })( | ||
| <Radio.Group onChange={this.onChange}> | ||
| <Radio value="email">邮箱</Radio> | ||
| <Radio value="workWX">企业微信</Radio> | ||
| </Radio.Group> | ||
| )} | ||
| </FormItem> */} | ||
| <FormItem {...formItemLayout} label={<span>企业微信机器人URL <a href="https://work.weixin.qq.com/api/doc/90000/90136/91770">文档</a></span>}> | ||
| <FormItem {...formItemLayout} label={<span>通知机器人URL <a rel="noopener noreferrer" target="_blank" href="https://github.com/congqiu/yapi-plugin-auto-test/blob/master/README.md#%E6%B5%8B%E8%AF%95%E8%AE%A1%E5%88%92">文档</a></span>}> | ||
| {getFieldDecorator("notifier_url", { | ||
| initialValue: this.state.notifier_url | ||
| })(<Input />)} | ||
| })(<Input placeholder="企业微信、钉钉机器人完整地址或自定义webhook的地址" />)} | ||
| </FormItem> | ||
@@ -301,0 +291,0 @@ </div> |
@@ -187,3 +187,3 @@ const openController = require('controllers/open.js'); | ||
| `; | ||
| tools.sendWorkWX(notifier, content); | ||
| tools.sendMessage(notifier, `【${projectData.name}】的测试计划【${plan.plan_name}】执行通知`, content); | ||
| } | ||
@@ -190,0 +190,0 @@ } |
+1
-1
| { | ||
| "name": "yapi-plugin-auto-test", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "description": "YAPI自动化测试插件,支持在YAPI设置测试计划,查看历史测试结果,自定义通知。", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+12
-1
@@ -27,5 +27,6 @@ yapi-plugin-auto-test | ||
|  | ||
| 用户可以自定义多个测试计划,根据对应的设置项进行测试计划的设置。 | ||
| 自定义通知目前只支持企业微信通知,如果url为空则不发送通知,邮件通知不受触发通知影响。 | ||
| 通知机器人支持目前支持企业微信机器人、钉钉机器人以及自定义webhook,如果url为空则不发送通知,邮件通知不受触发通知影响。如果是企业微信或钉钉机器人直接复制机器人地址即可。 | ||
@@ -35,2 +36,3 @@ #### 测试结果 | ||
|  | ||
| 时间轴风格的测试结果列表,支持直接查看历史测试结果。注意:测试结果页面的清空会直接**清空**当前计划的历史测试结果,谨慎操作。 | ||
@@ -40,2 +42,3 @@ | ||
| ### 更新 | ||
| 通过yapi-cli更新插件还是比较麻烦的,直接再执行一次命令并不会更新。因为yapi-cli安装插件实际上就是在vendors目录下执行`npm install --registry https://registry.npm.taobao.org yapi-plugin-auto-test`,所以最后会在package.json文件中记录下开始安装的版本号,再次执行安装的还是同一个版本。 | ||
@@ -49,5 +52,13 @@ | ||
| ### 注意事项 | ||
| 1. 企业微信每个机器人发送的消息不能超过20条/分钟,最新内容参考[消息发送频率限制](https://work.weixin.qq.com/api/doc/90000/90136/91770#%E6%B6%88%E6%81%AF%E5%8F%91%E9%80%81%E9%A2%91%E7%8E%87%E9%99%90%E5%88%B6)。 | ||
| 2. 钉钉每个机器人每分钟最多发送20条,参考[消息发送频率限制](https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq)。 | ||
| ### ChangeLog | ||
| #### v1.0.1 | ||
| * 结果通知支持更多方式 | ||
| #### v1.0.0 | ||
@@ -54,0 +65,0 @@ |
+37
-1
@@ -10,2 +10,38 @@ const axios = require("axios"); | ||
| }); | ||
| }; | ||
| }; | ||
| const sendWWMessage = async (url, content) => { | ||
| return await axios.post(url, { | ||
| "msgtype": "markdown", | ||
| "markdown": { | ||
| content | ||
| } | ||
| }); | ||
| }; | ||
| const sendDingTalk = async (url, title, text) => { | ||
| return await axios.post(url, { | ||
| "msgtype": "markdown", | ||
| "markdown": { | ||
| title, | ||
| text | ||
| } | ||
| }); | ||
| }; | ||
| const sendWebhook = async (url, title, content) => { | ||
| return await axios.post(url, { | ||
| title, | ||
| content | ||
| }); | ||
| }; | ||
| exports.sendMessage = async (url, title, content) => { | ||
| if (url.trim().indexOf("https://qyapi.weixin.qq.com") === 0) { | ||
| return await sendWWMessage(url, content); | ||
| } | ||
| if (url.trim().indexOf("https://oapi.dingtalk.com/robot/send") === 0) { | ||
| return await sendDingTalk(url, title , content); | ||
| } | ||
| return await sendWebhook(url, content) | ||
| } |
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
1457
1.53%81
15.71%138540
-0.41%