fix: 优化用户信息页面

This commit is contained in:
gaoxiaolin.gao 2018-07-31 11:31:11 +08:00
parent 5e62e80bb4
commit b405662ccf
9 changed files with 46 additions and 10 deletions

View File

@ -308,6 +308,8 @@ class InterfaceColContent extends Component {
statusText: data.res.statusText
}
);
// 断言测试
await this.handleScriptTest(interfaceData, responseData, validRes, requestParams);
if (validRes.length === 0) {

View File

@ -8,7 +8,6 @@ import { connect } from 'react-redux';
const EditButton = props => {
const { isAdmin, isOwner, onClick, name, admin } = props;
if (isOwner) {
// 本人
if (admin) {
@ -316,11 +315,10 @@ class Profile extends Component {
}
if (this.state.roleEdit === false) {
let btn = '';
roleEditHtml = (
<div>
<span className="text">{roles[userinfo.role]}</span>&nbsp;&nbsp;
{btn}
</div>
);
} else {

View File

@ -139,6 +139,16 @@ http request params, 合并了 query 和 body
logmessage 函数,调试时使用log 信息仅仅在断言失败后打印,失败断言前的信息
```
log(234)
assert.equal(status, 400)
log(123)
```
输出结果:
log: 234
AssertionError: 200 == 400
### 示例
```

View File

@ -261,7 +261,6 @@ class openController extends baseController {
if (ctx.params.mode === 'json') {
return (ctx.body = reportsResult);
} else {
// ctx.set('Content-Disposition', `attachment; filename=api.html`);
return (ctx.body = renderToHtml(reportsResult));
}
}

View File

@ -504,7 +504,9 @@ function convertString(variable) {
}
}
//
exports.runCaseScript = async function runCaseScript(params) {
let script = params.script;
// script 是断言
if (!script) {

View File

@ -7,17 +7,25 @@
<div class="icon">&#xf0fd;</div>
<input type="text" class="input js-input" placeholder="搜索" />
<div class="m-search-result js-search-result"></div>
</div></div><nav class="m-header-nav js-nav"><ul class="m-header-items"><li class="item active"><a class="href" href="index.html">教程</a></li><li class="item "><a class="href" href="../devops/index.html">内网部署</a></li></ul></nav><div id="js-nav-btn" class="m-header-btn ui-font-ydoc"></div></header><div class="m-content" id="js-content"><div id="markdown-body" class="m-content-container markdown-body"><h3 id="v1.3.21">v1.3.21</h3>
</div></div><nav class="m-header-nav js-nav"><ul class="m-header-items"><li class="item active"><a class="href" href="index.html">教程</a></li><li class="item "><a class="href" href="../devops/index.html">内网部署</a></li></ul></nav><div id="js-nav-btn" class="m-header-btn ui-font-ydoc"></div></header><div class="m-content" id="js-content"><div id="markdown-body" class="m-content-container markdown-body"><h3 id="v1.3.22">v1.3.22</h3>
<ul>
<li>json schema number和integer支持枚举</li>
<li>服务端测试增加下载功能</li>
</ul>
<h3 id="v1.3.21">v1.3.21</h3>
<ul>
<li>请求配置增加 context.utils.CryptoJS</li>
<li>环境变量支持自定义全局变量</li>
<li>增加wiki数据导出功能</li>
<li>用户管理处增加搜索功能</li>
<li>增加项目全局 mock 脚本功能</li>
<li>高级 mock 期望 支持关闭开启功能</li>
</ul>
<h4>Bug Fixed</h4>
<ul>
<li>优化ldap登陆</li>
<li>swagger 导入公共params</li>
<li>接口编辑 mockEditor 修改为 AceEditor</li>
</ul>
<h3 id="v1.3.20">v1.3.20</h3>
<h4>Bug Fixed</h4>

View File

@ -101,6 +101,13 @@
<p>记录的 http 请求信息,假设需要获取 key 为 555 的接口参数或者响应数据,可通过 records[555].params 或 records[555].body 获取</p>
<h4>7.log</h4>
<p>logmessage 函数,调试时使用log 信息仅仅在断言失败后打印,失败断言前的信息</p>
<pre><code>log(234)
assert.equal(status, 400)
log(123)
</code></pre>
<p>输出结果:
log: 234<br>
AssertionError: 200 == 400</p>
<h3 id="断言脚本公共变量-示例">示例</h3>
<pre><code>
assert.equal(body.errcode, 0)

View File

@ -7,7 +7,7 @@
<div class="icon">&#xf0fd;</div>
<input type="text" class="input js-input" placeholder="搜索" />
<div class="m-search-result js-search-result"></div>
</div></div><nav class="m-header-nav js-nav"><ul class="m-header-items"><li class="item "><a class="href" href="documents/index.html">教程</a></li><li class="item "><a class="href" href="devops/index.html">内网部署</a></li></ul></nav><div id="js-nav-btn" class="m-header-btn ui-font-ydoc"></div></header><div class="m-content" id="js-content"><div><div class="g-home"><section class="m-section home"><div class="m-section-container"><div class="m-section-title"><h4 class="name">YApi</h4><p class="desc">旨在为开发、产品、测试人员提供更优雅的接口管理服务。可以帮助开发者轻松创建、发布、维护 API</p><div class="m-section-btngroup"><a href="./documents/index.html"><div class="btn ">开始</div></a><a href="https://github.com/ymfe/yapi"><div class="btn btn-ghost">Github &gt;</div></a></div><p class="caption">当前版本: v1.3.20</p></div><div class="m-section-banner"><img src="./ydoc/images/dogbg@1x.png" alt="bg" srcSet="./ydoc/images/dogbg@2x.png 2x"/></div></div></section><section class="m-section feature"><div class="m-section-container"><div class="m-section-box"><div class="item"><h6 class="title">权限管理</h6><p class="desc">YApi 成熟的团队管理扁平化项目权限配置满足各类企业的需求</p></div><div class="item"><h6 class="title">可视化接口管理</h6><p class="desc">基于 websocket 的多人协作接口编辑功能和类 postman 测试工具,让多人协作成倍提升开发效率</p></div><div class="item"><h6 class="title">Mock Server</h6><p class="desc">易用的 Mock Server再也不用担心 mock 数据的生成了</p></div><div class="item"><h6 class="title">自动化测试</h6><p class="desc">完善的接口自动化测试,保证数据的正确性</p></div><div class="item"><h6 class="title">数据导入</h6><p class="desc">支持导入 swagger, postman, har 数据格式,方便迁移旧项目</p></div><div class="item"><h6 class="title">插件机制</h6><p class="desc">强大的插件机制,满足各类业务需求</p></div></div></div></section></div><footer class="m-footer"><div class="m-footer-container"><div class="m-footer-links"><div class="group"><p class="title">团队网址</p><ul><li><a class="href" href="https://ymfe.org/">YMFE</a></li><li><a class="href" href="https://blog.ymfe.org/">YMFE Blog</a></li></ul></div><div class="group"><p class="title">Git仓库</p><ul><li><a class="href" href="https://github.com/YMFE/yapi">Github</a></li><li><a class="href" href="https://github.com/YMFE/yapi/issues">Github Issue</a></li></ul></div></div><div class="m-footer-title"><p class="copyright">© 2018 <a class="href" href="https://ymfe.org/">YMFE Team</a></p><p>Build by <a class="href" href="https://ydoc.ymfe.org/">ydoc</a></p></div></div></footer></div></div></div></div><div><div class="m-mask js-mask">
</div></div><nav class="m-header-nav js-nav"><ul class="m-header-items"><li class="item "><a class="href" href="documents/index.html">教程</a></li><li class="item "><a class="href" href="devops/index.html">内网部署</a></li></ul></nav><div id="js-nav-btn" class="m-header-btn ui-font-ydoc"></div></header><div class="m-content" id="js-content"><div><div class="g-home"><section class="m-section home"><div class="m-section-container"><div class="m-section-title"><h4 class="name">YApi</h4><p class="desc">旨在为开发、产品、测试人员提供更优雅的接口管理服务。可以帮助开发者轻松创建、发布、维护 API</p><div class="m-section-btngroup"><a href="./documents/index.html"><div class="btn ">开始</div></a><a href="https://github.com/ymfe/yapi"><div class="btn btn-ghost">Github &gt;</div></a></div><p class="caption">当前版本: v1.3.21</p></div><div class="m-section-banner"><img src="./ydoc/images/dogbg@1x.png" alt="bg" srcSet="./ydoc/images/dogbg@2x.png 2x"/></div></div></section><section class="m-section feature"><div class="m-section-container"><div class="m-section-box"><div class="item"><h6 class="title">权限管理</h6><p class="desc">YApi 成熟的团队管理扁平化项目权限配置满足各类企业的需求</p></div><div class="item"><h6 class="title">可视化接口管理</h6><p class="desc">基于 websocket 的多人协作接口编辑功能和类 postman 测试工具,让多人协作成倍提升开发效率</p></div><div class="item"><h6 class="title">Mock Server</h6><p class="desc">易用的 Mock Server再也不用担心 mock 数据的生成了</p></div><div class="item"><h6 class="title">自动化测试</h6><p class="desc">完善的接口自动化测试,保证数据的正确性</p></div><div class="item"><h6 class="title">数据导入</h6><p class="desc">支持导入 swagger, postman, har 数据格式,方便迁移旧项目</p></div><div class="item"><h6 class="title">插件机制</h6><p class="desc">强大的插件机制,满足各类业务需求</p></div></div></div></section></div><footer class="m-footer"><div class="m-footer-container"><div class="m-footer-links"><div class="group"><p class="title">团队网址</p><ul><li><a class="href" href="https://ymfe.org/">YMFE</a></li><li><a class="href" href="https://blog.ymfe.org/">YMFE Blog</a></li></ul></div><div class="group"><p class="title">Git仓库</p><ul><li><a class="href" href="https://github.com/YMFE/yapi">Github</a></li><li><a class="href" href="https://github.com/YMFE/yapi/issues">Github Issue</a></li></ul></div></div><div class="m-footer-title"><p class="copyright">© 2018 <a class="href" href="https://ymfe.org/">YMFE Team</a></p><p>Build by <a class="href" href="https://ydoc.ymfe.org/">ydoc</a></p></div></div></footer></div></div></div></div><div><div class="m-mask js-mask">
<div class="container">
<img src="" alt="" class="img js-mask-img" />
</div>

View File

@ -646,7 +646,7 @@ window.ydoc_plugin_search_json = {
{
"title": "1.assert",
"url": "/documents/case.html#断言脚本公共变量-1.assert",
"content": "1.assert断言函数详细 api 可查看 document常用 api\nassert(value)\n判断 value 是否为 truth, 例如 assert(1) 通过, assert(0) 不通过,只要 value 不是 null, 0, false 等值验证通过\n\n\nassert.equal(actual, expected)\n判断 actual 是否等于 expected例如 assert(1, 1)通过\n\n\nassert.notEqual(actual, expected)\n判断 actual 是否不等于 expected\n\n\nassert.deepEqual(actual, expected)\n假设 actual = {a:1} 是一个对象,即便 expected = {a:1},如果使用 assert.equal 可能也是不相等的,因为在 js 引用的只是对象的一个指针,需要使用 assert.deepEqual 比较两个对象是否相等\n\n\nassert.notDeepEaual(actual, expected)\n深度比较两个对象是否不相等\n\n2.statushttp 状态码3.paramshttp request params, 合并了 query 和 body4.body返回 response body5.header返回 response header6.records记录的 http 请求信息,假设需要获取 key 为 555 的接口参数或者响应数据,可通过 records[555].params 或 records[555].body 获取7.loglogmessage 函数,调试时使用log 信息仅仅在断言失败后打印,失败断言前的信息"
"content": "1.assert断言函数详细 api 可查看 document常用 api\nassert(value)\n判断 value 是否为 truth, 例如 assert(1) 通过, assert(0) 不通过,只要 value 不是 null, 0, false 等值验证通过\n\n\nassert.equal(actual, expected)\n判断 actual 是否等于 expected例如 assert(1, 1)通过\n\n\nassert.notEqual(actual, expected)\n判断 actual 是否不等于 expected\n\n\nassert.deepEqual(actual, expected)\n假设 actual = {a:1} 是一个对象,即便 expected = {a:1},如果使用 assert.equal 可能也是不相等的,因为在 js 引用的只是对象的一个指针,需要使用 assert.deepEqual 比较两个对象是否相等\n\n\nassert.notDeepEaual(actual, expected)\n深度比较两个对象是否不相等\n\n2.statushttp 状态码3.paramshttp request params, 合并了 query 和 body4.body返回 response body5.header返回 response header6.records记录的 http 请求信息,假设需要获取 key 为 555 的接口参数或者响应数据,可通过 records[555].params 或 records[555].body 获取7.loglogmessage 函数,调试时使用log 信息仅仅在断言失败后打印,失败断言前的信息log(234) assert.equal(status, 400)\nlog(123)\n输出结果log: 234\nAssertionError: 200 == 400"
},
{
"title": "示例",
@ -703,7 +703,7 @@ window.ydoc_plugin_search_json = {
{
"title": "1.assert",
"url": "/documents/case.html#断言脚本公共变量-1.assert",
"content": "1.assert断言函数详细 api 可查看 document常用 api\nassert(value)\n判断 value 是否为 truth, 例如 assert(1) 通过, assert(0) 不通过,只要 value 不是 null, 0, false 等值验证通过\n\n\nassert.equal(actual, expected)\n判断 actual 是否等于 expected例如 assert(1, 1)通过\n\n\nassert.notEqual(actual, expected)\n判断 actual 是否不等于 expected\n\n\nassert.deepEqual(actual, expected)\n假设 actual = {a:1} 是一个对象,即便 expected = {a:1},如果使用 assert.equal 可能也是不相等的,因为在 js 引用的只是对象的一个指针,需要使用 assert.deepEqual 比较两个对象是否相等\n\n\nassert.notDeepEaual(actual, expected)\n深度比较两个对象是否不相等\n\n2.statushttp 状态码3.paramshttp request params, 合并了 query 和 body4.body返回 response body5.header返回 response header6.records记录的 http 请求信息,假设需要获取 key 为 555 的接口参数或者响应数据,可通过 records[555].params 或 records[555].body 获取7.loglogmessage 函数,调试时使用log 信息仅仅在断言失败后打印,失败断言前的信息"
"content": "1.assert断言函数详细 api 可查看 document常用 api\nassert(value)\n判断 value 是否为 truth, 例如 assert(1) 通过, assert(0) 不通过,只要 value 不是 null, 0, false 等值验证通过\n\n\nassert.equal(actual, expected)\n判断 actual 是否等于 expected例如 assert(1, 1)通过\n\n\nassert.notEqual(actual, expected)\n判断 actual 是否不等于 expected\n\n\nassert.deepEqual(actual, expected)\n假设 actual = {a:1} 是一个对象,即便 expected = {a:1},如果使用 assert.equal 可能也是不相等的,因为在 js 引用的只是对象的一个指针,需要使用 assert.deepEqual 比较两个对象是否相等\n\n\nassert.notDeepEaual(actual, expected)\n深度比较两个对象是否不相等\n\n2.statushttp 状态码3.paramshttp request params, 合并了 query 和 body4.body返回 response body5.header返回 response header6.records记录的 http 请求信息,假设需要获取 key 为 555 的接口参数或者响应数据,可通过 records[555].params 或 records[555].body 获取7.loglogmessage 函数,调试时使用log 信息仅仅在断言失败后打印,失败断言前的信息log(234) assert.equal(status, 400)\nlog(123)\n输出结果log: 234\nAssertionError: 200 == 400"
},
{
"title": "示例",
@ -1169,10 +1169,15 @@ window.ydoc_plugin_search_json = {
"content": "",
"url": "/documents/CHANGELOG.html",
"children": [
{
"title": "v1.3.22",
"url": "/documents/CHANGELOG.html#v1.3.22",
"content": "v1.3.22json schema number和integer支持枚举\n服务端测试增加下载功能\n"
},
{
"title": "v1.3.21",
"url": "/documents/CHANGELOG.html#v1.3.21",
"content": "v1.3.21请求配置增加 context.utils.CryptoJS\n环境变量支持自定义全局变量\n增加wiki数据导出功能\n用户管理处增加搜索功能\n增加项目全局 mock 脚本功能\nBug Fixed优化ldap登陆\n"
"content": "v1.3.21请求配置增加 context.utils.CryptoJS\n环境变量支持自定义全局变量\n增加wiki数据导出功能\n用户管理处增加搜索功能\n增加项目全局 mock 脚本功能\n高级 mock 期望 支持关闭开启功能\nBug Fixed优化ldap登陆\nswagger 导入公共params\n接口编辑 mockEditor 修改为 AceEditor\n"
},
{
"title": "v1.3.20",
@ -1341,10 +1346,15 @@ window.ydoc_plugin_search_json = {
"content": "",
"url": "/documents/CHANGELOG.html",
"children": [
{
"title": "v1.3.22",
"url": "/documents/CHANGELOG.html#v1.3.22",
"content": "v1.3.22json schema number和integer支持枚举\n服务端测试增加下载功能\n"
},
{
"title": "v1.3.21",
"url": "/documents/CHANGELOG.html#v1.3.21",
"content": "v1.3.21请求配置增加 context.utils.CryptoJS\n环境变量支持自定义全局变量\n增加wiki数据导出功能\n用户管理处增加搜索功能\n增加项目全局 mock 脚本功能\nBug Fixed优化ldap登陆\n"
"content": "v1.3.21请求配置增加 context.utils.CryptoJS\n环境变量支持自定义全局变量\n增加wiki数据导出功能\n用户管理处增加搜索功能\n增加项目全局 mock 脚本功能\n高级 mock 期望 支持关闭开启功能\nBug Fixed优化ldap登陆\nswagger 导入公共params\n接口编辑 mockEditor 修改为 AceEditor\n"
},
{
"title": "v1.3.20",