Commit 9d1fed1b authored by Wallen姚文辉's avatar Wallen姚文辉

优化接口测试功能

parent dd2e719e
{
"registry-mirrors": ["https://registry.docker-cn.com","https://nrbewqda.mirror.aliyuncs.com","https://dmmxhzvq.mirror.aliyuncs.com"]
}
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>yinhe_test</title><script defer="defer" src="/js/chunk-vendors.822ae491.js"></script><script defer="defer" src="/js/app.5e0ba442.js"></script><link href="/css/chunk-vendors.187ae3e6.css" rel="stylesheet"><link href="/css/app.787b06e3.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but yinhe_test doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html> <!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>yinhe_test</title><script defer="defer" src="/js/chunk-vendors.822ae491.js"></script><script defer="defer" src="/js/app.d66ad2de.js"></script><link href="/css/chunk-vendors.187ae3e6.css" rel="stylesheet"><link href="/css/app.787b06e3.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but yinhe_test doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
\ No newline at end of file \ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -151,11 +151,20 @@ ...@@ -151,11 +151,20 @@
<Button icon="ios-cloud-upload-outline">上传apifox的html文件</Button> <Button icon="ios-cloud-upload-outline">上传apifox的html文件</Button>
</Upload> --> </Upload> -->
<br> <br>
<Input v-if="(!apitestinfo) || edit" v-model="api_url" @on-blur="renderapihtml()" <template v-if="(apitestinfos.length == 1 && !Object.keys(apitestinfos[0]).length) || edit"
v-for="(api_url, index) in api_urls">
<Input v-model="api_urls[index]" @on-blur="renderapihtml(api_url, index)"
placeholder="请输入apifox分享的报告链接" style="width: 300px" /> placeholder="请输入apifox分享的报告链接" style="width: 300px" />
<Icon v-if="api_urls.length > 1" type="ios-remove-circle" style="color: crimson;"
@click="this.api_urls.splice(index, 1); this.apitestinfos.splice(index, 1)" size="15" />
</template>
<template v-if="edit">
<Icon type="md-add-circle" style="color: #2b85e4;"
@click="this.api_urls.push(''); this.apitestinfos.push({})" size="15" />
</template>
<br> <br>
<div v-if="apitestinfo"> <template v-for="apitestinfo in apitestinfos">
<div class="info-card"> <div v-if="Object.keys(apitestinfo).length" class="info-card">
<div class="header_style"> <div class="header_style">
<p style="height: 35px;"> <p style="height: 35px;">
&nbsp;&nbsp; &nbsp;&nbsp;
...@@ -286,7 +295,7 @@ ...@@ -286,7 +295,7 @@
</template> </template>
</div> --> </div> -->
</div> </div>
</div> </template>
</template> </template>
<Button shape="circle" style="margin-top: 10px;margin-bottom: 10px;" type="primary">测试用例</Button> <Button shape="circle" style="margin-top: 10px;margin-bottom: 10px;" type="primary">测试用例</Button>
<div> <div>
...@@ -453,13 +462,13 @@ export default { ...@@ -453,13 +462,13 @@ export default {
all_script: [], all_script: [],
plugs: [], plugs: [],
// apihtmlfile: null, // apihtmlfile: null,
api_url: null, api_urls: [''],
apitestinfo: null, apitestinfos: [{}],
apirenderinfo: { // apirenderinfo: {
p0: ["循环数", "HTTP 接口请求数", "断言数"], // p0: ["循环数", "HTTP 接口请求数", "断言数"],
p1: ["总耗时", "总返回数据", "接口请求耗时", "平均接口请求耗时", "通过率", "失败率", "未测率"], // p1: ["总耗时", "总返回数据", "接口请求耗时", "平均接口请求耗时", "通过率", "失败率", "未测率"],
p2: ["Method", "耗时", "返回数据", "HTTP 状态码", "断言通过数", "断言失败数"] // p2: ["Method", "耗时", "返回数据", "HTTP 状态码", "断言通过数", "断言失败数"]
}, // },
jenkins_columns: [ jenkins_columns: [
{ {
title: '脚本名', title: '脚本名',
...@@ -765,7 +774,7 @@ export default { ...@@ -765,7 +774,7 @@ export default {
// } // }
// return false; // return false;
// }, // },
renderapihtml() { renderapihtml(url, index) {
// const reader = new FileReader() // const reader = new FileReader()
// reader.readAsText(this.apihtmlfile, 'utf8') // reader.readAsText(this.apihtmlfile, 'utf8')
// reader.onload = () => { // reader.onload = () => {
...@@ -775,9 +784,10 @@ export default { ...@@ -775,9 +784,10 @@ export default {
// }) // })
// } // }
if (!this.api_url) return if (!this.api_urls || !url) return
this.$request("post", '/tool/testport/getapitestinfo', { url: this.api_url }, this, (data) => { console.info(url)
this.apitestinfo = data.data this.$request("post", '/tool/testport/getapitestinfo', { url: url.indexOf('?') == -1 ? url : url.slice(0, url.indexOf('?')) }, this, (data) => {
this.apitestinfos[index] = data.data
}) })
}, },
show() { show() {
...@@ -1058,6 +1068,7 @@ export default { ...@@ -1058,6 +1068,7 @@ export default {
this.getprojects(); this.getprojects();
this.getJenkinsInfo(); this.getJenkinsInfo();
this.myname = JSON.parse(localStorage.getItem("userinfo")).name this.myname = JSON.parse(localStorage.getItem("userinfo")).name
console.info(!{})
}, },
beforeUnmount() { beforeUnmount() {
this.quit = true this.quit = true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment