Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
98a5ede3
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 大约 3 年
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
98a5ede3
编写于
4月 20, 2020
作者:
Q
q4speed
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
api测试界面,未完待续
上级
22be52a5
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
302 addition
and
29 deletion
+302
-29
frontend/src/business/components/api/test/ApiTestConfig.vue
frontend/src/business/components/api/test/ApiTestConfig.vue
+94
-0
frontend/src/business/components/api/test/components/ApiAssertionRegex.vue
...ness/components/api/test/components/ApiAssertionRegex.vue
+10
-5
frontend/src/business/components/api/test/components/ApiAssertionResponseTime.vue
...mponents/api/test/components/ApiAssertionResponseTime.vue
+5
-4
frontend/src/business/components/api/test/components/ApiAssertionText.vue
...iness/components/api/test/components/ApiAssertionText.vue
+14
-6
frontend/src/business/components/api/test/components/ApiAssertions.vue
...business/components/api/test/components/ApiAssertions.vue
+1
-1
frontend/src/business/components/api/test/components/ApiAssertionsEdit.vue
...ness/components/api/test/components/ApiAssertionsEdit.vue
+1
-1
frontend/src/business/components/api/test/components/ApiBody.vue
...d/src/business/components/api/test/components/ApiBody.vue
+1
-1
frontend/src/business/components/api/test/components/ApiKeyValue.vue
...c/business/components/api/test/components/ApiKeyValue.vue
+8
-4
frontend/src/business/components/api/test/components/ApiRequestConfig.vue
...iness/components/api/test/components/ApiRequestConfig.vue
+2
-2
frontend/src/business/components/api/test/components/ApiRequestForm.vue
...usiness/components/api/test/components/ApiRequestForm.vue
+0
-1
frontend/src/business/components/api/test/components/ApiScenarioConfig.vue
...ness/components/api/test/components/ApiScenarioConfig.vue
+161
-0
frontend/src/business/components/api/test/components/ApiScenarioForm.vue
...siness/components/api/test/components/ApiScenarioForm.vue
+0
-1
frontend/src/business/components/api/test/model/ScenarioModel.js
...d/src/business/components/api/test/model/ScenarioModel.js
+0
-0
frontend/src/business/components/common/router/router.js
frontend/src/business/components/common/router/router.js
+3
-3
frontend/src/i18n/zh-CN.js
frontend/src/i18n/zh-CN.js
+2
-0
未找到文件。
frontend/src/business/components/api/test/ApiTestConfig.vue
0 → 100644
浏览文件 @
98a5ede3
<
template
>
<div
class=
"container"
>
<div
class=
"main-content"
>
<el-card>
<el-container
class=
"test-container"
v-loading=
"result.loading"
>
<el-header>
<el-row
type=
"flex"
align=
"middle"
>
<el-input
class=
"test-name"
v-model=
"test.name"
maxlength=
"64"
:placeholder=
"$t('api_test.input_name')"
>
<el-select
class=
"test-project"
v-model=
"test.projectId"
slot=
"prepend"
:placeholder=
"$t('api_test.select_project')"
>
<el-option
v-for=
"item in projects"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
/>
</el-select>
</el-input>
<el-button
type=
"primary"
plain
:disabled=
"isDisabled"
@
click=
"saveTest"
>
保存
</el-button>
</el-row>
</el-header>
<ms-api-scenario-config
:scenarios=
"test.scenario_definition"
/>
</el-container>
</el-card>
</div>
</div>
</
template
>
<
script
>
import
MsApiScenarioConfig
from
"
./components/ApiScenarioConfig
"
;
export
default
{
name
:
"
MsApiTestConfig
"
,
components
:
{
MsApiScenarioConfig
},
data
()
{
return
{
result
:
{},
projects
:
[],
change
:
false
,
test
:
{
projectId
:
null
,
name
:
null
,
scenario_definition
:
[]
}
}
},
watch
:
{
test
:
{
handler
:
function
()
{
this
.
change
=
true
;
},
deep
:
true
}
},
methods
:
{
saveTest
:
function
()
{
this
.
change
=
false
;
this
.
$message
({
message
:
this
.
$t
(
'
commons.save_success
'
),
type
:
'
success
'
});
}
},
computed
:
{
isDisabled
()
{
return
!
(
this
.
test
.
projectId
&&
this
.
test
.
name
&&
this
.
change
)
}
},
created
()
{
this
.
result
=
this
.
$get
(
"
/project/listAll
"
,
response
=>
{
this
.
projects
=
response
.
data
;
})
}
}
</
script
>
<
style
scoped
>
.test-container
{
height
:
calc
(
100vh
-
150px
);
min-height
:
600px
;
}
.test-name
{
width
:
600px
;
margin-left
:
-20px
;
margin-right
:
20px
;
}
.test-project
{
min-width
:
150px
;
}
</
style
>
frontend/src/business/components/api/test/components/ApiAssertionRegex.vue
浏览文件 @
98a5ede3
<
template
>
<div>
<el-row
:gutter=
"10"
type=
"flex"
align=
"middle"
>
<el-col
:span=
"4
"
>
<el-row
:gutter=
"10"
type=
"flex"
justify=
"space-between"
align=
"middle"
>
<el-col
class=
"assertion-select
"
>
<el-select
class=
"assertion-item"
v-model=
"regex.subject"
size=
"small"
:placeholder=
"$t('api_test.request.assertions.select_subject')"
>
<el-option
label=
"Http-Code"
value=
"HTTP-CODE"
></el-option>
...
...
@@ -9,11 +9,11 @@
<el-option
label=
"Body"
value=
"BODY"
></el-option>
</el-select>
</el-col>
<el-col
:span=
"19"
>
<el-col>
<el-input
v-model=
"regex.expression"
maxlength=
"255"
size=
"small"
show-word-limit
:placeholder=
"$t('api_test.request.assertions.expression')"
/>
</el-col>
<el-col
:span=
"1"
class=
"assertion-btn"
>
<el-col
class=
"assertion-btn"
>
<el-button
type=
"danger"
size=
"mini"
icon=
"el-icon-delete"
circle
@
click=
"remove"
v-if=
"edit"
/>
<el-button
type=
"primary"
size=
"small"
icon=
"el-icon-plus"
plain
@
click=
"add"
v-else
/>
</el-col>
...
...
@@ -22,7 +22,7 @@
</
template
>
<
script
>
import
{
Regex
}
from
"
../model/
API
Model
"
;
import
{
Regex
}
from
"
../model/
Scenario
Model
"
;
export
default
{
name
:
"
MsApiAssertionRegex
"
,
...
...
@@ -54,11 +54,16 @@
</
script
>
<
style
scoped
>
.assertion-select
{
width
:
250px
;
}
.assertion-item
{
width
:
100%
;
}
.assertion-btn
{
text-align
:
center
;
width
:
60px
;
}
</
style
>
frontend/src/business/components/api/test/components/ApiAssertionResponseTime.vue
浏览文件 @
98a5ede3
<
template
>
<div>
<el-row
:gutter=
"10"
align=
"middle"
>
<el-col
:span=
"23"
>
<el-row
:gutter=
"10"
type=
"flex"
justify=
"space-between"
align=
"middle"
>
<el-col>
<el-input
v-model=
"time"
step=
"100"
size=
"small"
type=
"number"
:placeholder=
"$t('api_test.request.assertions.response_in_time')"
/>
</el-col>
<el-col
:span=
"1"
class=
"assertion-btn"
>
<el-col
class=
"assertion-btn"
>
<el-button
type=
"danger"
size=
"mini"
icon=
"el-icon-delete"
circle
@
click=
"remove"
v-if=
"edit"
/>
<el-button
type=
"primary"
size=
"small"
icon=
"el-icon-plus"
plain
@
click=
"add"
v-else
/>
</el-col>
...
...
@@ -14,7 +14,7 @@
</
template
>
<
script
>
import
{
ResponseTime
}
from
"
../model/
API
Model
"
;
import
{
ResponseTime
}
from
"
../model/
Scenario
Model
"
;
export
default
{
name
:
"
MsApiAssertionResponseTime
"
,
...
...
@@ -47,5 +47,6 @@
<
style
scoped
>
.assertion-btn
{
text-align
:
center
;
width
:
60px
;
}
</
style
>
frontend/src/business/components/api/test/components/ApiAssertionText.vue
浏览文件 @
98a5ede3
<
template
>
<div>
<el-row
:gutter=
"10"
>
<el-col
:span=
"4
"
>
<el-row
:gutter=
"10"
type=
"flex"
justify=
"space-between"
align=
"middle"
>
<el-col
class=
"assertion-select
"
>
<el-select
class=
"assertion-item"
v-model=
"subject"
size=
"small"
:placeholder=
"$t('api_test.request.assertions.select_subject')"
>
<el-option
label=
"Http-Code"
value=
"HTTP-CODE"
></el-option>
...
...
@@ -9,7 +9,7 @@
<el-option
label=
"Body"
value=
"BODY"
></el-option>
</el-select>
</el-col>
<el-col
:span=
"4
"
>
<el-col
class=
"assertion-select
"
>
<el-select
class=
"assertion-item"
v-model=
"condition"
size=
"small"
:placeholder=
"$t('api_test.request.assertions.select_contains')"
>
<el-option
:label=
"$t('api_test.request.assertions.contains')"
value=
"CONTAINS"
></el-option>
...
...
@@ -19,11 +19,11 @@
<el-option
:label=
"$t('api_test.request.assertions.end_with')"
value=
"END_WITH"
></el-option>
</el-select>
</el-col>
<el-col
:span=
"15"
>
<el-col>
<el-input
v-model=
"value"
maxlength=
"255"
size=
"small"
show-word-limit
:placeholder=
"$t('api_test.request.assertions.value')"
/>
</el-col>
<el-col
:span=
"1
"
>
<el-col
class=
"assertion-btn
"
>
<el-button
type=
"primary"
size=
"small"
icon=
"el-icon-plus"
plain
@
click=
"add"
/>
</el-col>
</el-row>
...
...
@@ -31,7 +31,7 @@
</
template
>
<
script
>
import
{
Regex
}
from
"
../model/
API
Model
"
;
import
{
Regex
}
from
"
../model/
Scenario
Model
"
;
export
default
{
name
:
"
MsApiAssertionText
"
,
...
...
@@ -89,7 +89,15 @@
</
script
>
<
style
scoped
>
.assertion-select
{
width
:
250px
;
}
.assertion-item
{
width
:
100%
;
}
.assertion-btn
{
width
:
60px
;
}
</
style
>
frontend/src/business/components/api/test/components/ApiAssertions.vue
浏览文件 @
98a5ede3
...
...
@@ -24,7 +24,7 @@
import
MsApiAssertionText
from
"
./ApiAssertionText
"
;
import
MsApiAssertionRegex
from
"
./ApiAssertionRegex
"
;
import
MsApiAssertionResponseTime
from
"
./ApiAssertionResponseTime
"
;
import
{
ASSERTION_TYPE
,
Assertions
,
Regex
}
from
"
../model/
API
Model
"
;
import
{
ASSERTION_TYPE
,
Assertions
,
Regex
}
from
"
../model/
Scenario
Model
"
;
import
MsApiAssertionsEdit
from
"
./ApiAssertionsEdit
"
;
export
default
{
...
...
frontend/src/business/components/api/test/components/ApiAssertionsEdit.vue
浏览文件 @
98a5ede3
...
...
@@ -22,7 +22,7 @@
<
script
>
import
MsApiAssertionRegex
from
"
./ApiAssertionRegex
"
;
import
MsApiAssertionResponseTime
from
"
./ApiAssertionResponseTime
"
;
import
{
Assertions
}
from
"
../model/
API
Model
"
;
import
{
Assertions
}
from
"
../model/
Scenario
Model
"
;
export
default
{
name
:
"
MsApiAssertionsEdit
"
,
...
...
frontend/src/business/components/api/test/components/ApiBody.vue
浏览文件 @
98a5ede3
...
...
@@ -18,7 +18,7 @@
<
script
>
import
MsApiKeyValue
from
"
./ApiKeyValue
"
;
import
{
Body
,
BODY_TYPE
}
from
"
../model/
API
Model
"
;
import
{
Body
,
BODY_TYPE
}
from
"
../model/
Scenario
Model
"
;
export
default
{
name
:
"
MsApiBody
"
,
...
...
frontend/src/business/components/api/test/components/ApiKeyValue.vue
浏览文件 @
98a5ede3
...
...
@@ -5,13 +5,13 @@
</span>
<div
class=
"kv-row"
v-for=
"(item, index) in items"
:key=
"index"
>
<el-row
type=
"flex"
:gutter=
"20"
justify=
"space-between"
align=
"middle"
>
<el-col
:span=
"11"
>
<el-col>
<el-input
v-model=
"item.key"
placeholder=
"Key"
size=
"small"
maxlength=
"100"
@
change=
"check"
/>
</el-col>
<el-col
:span=
"11"
>
<el-col>
<el-input
v-model=
"item.value"
placeholder=
"Value"
size=
"small"
maxlength=
"100"
@
change=
"check"
/>
</el-col>
<el-col
:span=
"1
"
>
<el-col
class=
"kv-delete
"
>
<el-button
size=
"mini"
class=
"el-icon-delete-solid"
circle
@
click=
"remove(index)"
:disabled=
"isDisable(index)"
/>
</el-col>
...
...
@@ -21,7 +21,7 @@
</
template
>
<
script
>
import
{
KeyValue
}
from
"
../model/
API
Model
"
;
import
{
KeyValue
}
from
"
../model/
Scenario
Model
"
;
export
default
{
name
:
"
MsApiKeyValue
"
,
...
...
@@ -83,4 +83,8 @@
.kv-row
{
margin-top
:
10px
;
}
.kv-delete
{
width
:
60px
;
}
</
style
>
frontend/src/business/components/api/test/components/ApiRequest.vue
→
frontend/src/business/components/api/test/components/ApiRequest
Config
.vue
浏览文件 @
98a5ede3
...
...
@@ -25,10 +25,10 @@
</
template
>
<
script
>
import
{
Request
}
from
"
../model/
API
Model
"
;
import
{
Request
}
from
"
../model/
Scenario
Model
"
;
export
default
{
name
:
"
MsApiRequest
"
,
name
:
"
MsApiRequest
Config
"
,
props
:
{
requests
:
Array
,
open
:
Function
...
...
frontend/src/business/components/api/test/components/ApiRequestForm.vue
浏览文件 @
98a5ede3
...
...
@@ -56,7 +56,6 @@
activeName
:
"
parameters
"
,
rules
:
{
name
:
[
{
required
:
true
,
message
:
this
.
$t
(
'
api_test.scenario.input_name
'
),
trigger
:
'
blur
'
},
{
max
:
100
,
message
:
this
.
$t
(
'
commons.input_limit
'
,
[
0
,
100
]),
trigger
:
'
blur
'
}
],
url
:
[
...
...
frontend/src/business/components/api/test/ApiScenarioConfig.vue
→
frontend/src/business/components/api/test/
components/
ApiScenarioConfig.vue
浏览文件 @
98a5ede3
<
template
>
<div
class=
"container"
>
<div
class=
"main-content"
>
<el-card>
<el-container
class=
"scenario-container"
>
<el-header>
<span
class=
"scenario-title"
>
场景配置
</span>
</el-header>
<el-container>
<el-aside
class=
"scenario-aside"
>
<div
class=
"scenario-list"
>
...
...
@@ -22,7 +14,7 @@
</el-dropdown-menu>
</el-dropdown>
</
template
>
<ms-api-request
:requests=
"scenario.requests"
:open=
"select"
/>
<ms-api-request-config
:requests=
"scenario.requests"
:open=
"select"
/>
</ms-api-collapse-item>
</ms-api-collapse>
</div>
...
...
@@ -37,30 +29,35 @@
</div>
</el-main>
</el-container>
</el-container>
</el-card>
</div>
</div>
</template>
<
script
>
import
MsApiCollapseItem
from
"
./
components/
ApiCollapseItem
"
;
import
MsApiCollapse
from
"
./
components/
ApiCollapse
"
;
import
MsApiRequest
from
"
./components/ApiRequest
"
;
import
MsApiRequestForm
from
"
./
components/
ApiRequestForm
"
;
import
MsApiScenarioForm
from
"
./
components/
ApiScenarioForm
"
;
import
{
Scenario
,
Request
}
from
"
.
/model/API
Model
"
;
import
MsApiCollapseItem
from
"
./ApiCollapseItem
"
;
import
MsApiCollapse
from
"
./ApiCollapse
"
;
import
MsApiRequest
Config
from
"
./ApiRequestConfig
"
;
import
MsApiRequestForm
from
"
./ApiRequestForm
"
;
import
MsApiScenarioForm
from
"
./ApiScenarioForm
"
;
import
{
Scenario
,
Request
}
from
"
.
./model/Scenario
Model
"
;
export
default
{
name
:
"
MsApiScenarioConfig
"
,
components
:
{
MsApiScenarioForm
,
MsApiRequestForm
,
MsApiRequest
,
MsApiCollapse
,
MsApiCollapseItem
},
components
:
{
MsApiRequestConfig
,
MsApiScenarioForm
,
MsApiRequestForm
,
MsApiCollapse
,
MsApiCollapseItem
},
props
:
{
scenarios
:
Array
},
data
()
{
return
{
activeName
:
0
,
scenarios
:
[],
selected
:
Object
}
},
...
...
@@ -111,16 +108,6 @@
</
script
>
<
style
scoped
>
.scenario-container
{
height
:
calc
(
100vh
-
150px
);
min-height
:
600px
;
}
.scenario-title
{
font-size
:
16px
;
margin-left
:
-20px
;
}
.scenario-aside
{
position
:
relative
;
border-radius
:
4px
;
...
...
frontend/src/business/components/api/test/components/ApiScenarioForm.vue
浏览文件 @
98a5ede3
...
...
@@ -34,7 +34,6 @@
activeName
:
"
variables
"
,
rules
:
{
name
:
[
{
required
:
true
,
message
:
this
.
$t
(
'
api_test.scenario.input_name
'
),
trigger
:
'
blur
'
},
{
max
:
100
,
message
:
this
.
$t
(
'
commons.input_limit
'
,
[
0
,
100
]),
trigger
:
'
blur
'
}
],
url
:
[
...
...
frontend/src/business/components/api/test/model/
API
Model.js
→
frontend/src/business/components/api/test/model/
Scenario
Model.js
浏览文件 @
98a5ede3
文件已移动
frontend/src/business/components/common/router/router.js
浏览文件 @
98a5ede3
...
...
@@ -18,7 +18,7 @@ import PerformanceTestReport from "../../performance/report/PerformanceTestRepor
import
ApiTestReport
from
"
../../api/report/ApiTestReport
"
;
import
ApiTest
from
"
../../api/ApiTest
"
;
import
PerformanceTest
from
"
../../performance/PerformanceTest
"
;
import
Api
ScenarioConfig
from
"
../../api/test/ApiScenario
Config
"
;
import
Api
TestConfig
from
"
../../api/test/ApiTest
Config
"
;
import
PerformanceTestHome
from
"
../../performance/home/PerformanceTestHome
"
;
import
ApiTestList
from
"
../../api/test/ApiTestList
"
;
import
ApiTestHome
from
"
../../api/home/ApiTestHome
"
;
...
...
@@ -97,12 +97,12 @@ const router = new VueRouter({
{
path
:
'
test/create
'
,
name
:
"
createAPITest
"
,
component
:
Api
Scenario
Config
,
component
:
Api
Test
Config
,
},
{
path
:
"
test/edit/:testId
"
,
name
:
"
editAPITest
"
,
component
:
Api
Scenario
Config
,
component
:
Api
Test
Config
,
props
:
{
content
:
(
route
)
=>
{
return
{
...
...
frontend/src/i18n/zh-CN.js
浏览文件 @
98a5ede3
...
...
@@ -169,6 +169,8 @@ export default {
'
resource_pool_is_null
'
:
'
资源池为空
'
,
},
api_test
:
{
input_name
:
"
请输入测试名称
"
,
select_project
:
"
请选择项目
"
,
scenario
:
{
input_name
:
"
请输入场景名称
"
,
name
:
"
场景名称
"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录