feat(接口定义): 断言规则处理
This commit is contained in:
parent
0f0b11fd85
commit
064735b2a4
|
@ -58,7 +58,7 @@
|
||||||
<!--<ms-api-jsonpath-suggest-list @addJsonpathSuggest="addJsonpathSuggest" :request="request"-->
|
<!--<ms-api-jsonpath-suggest-list @addJsonpathSuggest="addJsonpathSuggest" :request="request"-->
|
||||||
<!--ref="jsonpathSuggestList"/>-->
|
<!--ref="jsonpathSuggestList"/>-->
|
||||||
|
|
||||||
<ms-api-assertions-edit :is-read-only="isReadOnly" :assertions="assertions" style="margin-bottom: 20px"/>
|
<ms-api-assertions-edit :is-read-only="isReadOnly" :assertions="assertions" :reloadData="reloadData" style="margin-bottom: 20px"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@
|
||||||
import MsApiAssertionJsr223 from "./ApiAssertionJsr223";
|
import MsApiAssertionJsr223 from "./ApiAssertionJsr223";
|
||||||
import MsApiJsonpathSuggestList from "./ApiJsonpathSuggestList";
|
import MsApiJsonpathSuggestList from "./ApiJsonpathSuggestList";
|
||||||
import MsApiAssertionXPath2 from "./ApiAssertionXPath2";
|
import MsApiAssertionXPath2 from "./ApiAssertionXPath2";
|
||||||
|
import {getUUID} from "@/common/js/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsApiAssertions",
|
name: "MsApiAssertions",
|
||||||
|
@ -100,12 +101,14 @@
|
||||||
time: "",
|
time: "",
|
||||||
type: "",
|
type: "",
|
||||||
loading: false,
|
loading: false,
|
||||||
|
reloadData: "",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
after() {
|
after() {
|
||||||
this.type = "";
|
this.type = "";
|
||||||
|
this.reloadData = getUUID().substring(0, 8);
|
||||||
this.reload();
|
this.reload();
|
||||||
},
|
},
|
||||||
suggestJsonOpen() {
|
suggestJsonOpen() {
|
||||||
|
@ -121,7 +124,7 @@
|
||||||
this.loading = false
|
this.loading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
remove(){
|
remove() {
|
||||||
this.$emit('remove', this.assertions);
|
this.$emit('remove', this.assertions);
|
||||||
},
|
},
|
||||||
addJsonpathSuggest(jsonPathList) {
|
addJsonpathSuggest(jsonPathList) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div v-loading="loading">
|
||||||
<div class="assertion-item-editing regex" v-if="assertions.regex.length > 0">
|
<div class="assertion-item-editing regex" v-if="assertions.regex.length > 0">
|
||||||
<div>
|
<div>
|
||||||
{{ $t("api_test.request.assertions.regex") }}
|
{{ $t("api_test.request.assertions.regex") }}
|
||||||
|
@ -52,65 +52,84 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsApiAssertionRegex from "./ApiAssertionRegex";
|
import MsApiAssertionRegex from "./ApiAssertionRegex";
|
||||||
import MsApiAssertionDuration from "./ApiAssertionDuration";
|
import MsApiAssertionDuration from "./ApiAssertionDuration";
|
||||||
import MsApiAssertionJsonPath from "./ApiAssertionJsonPath";
|
import MsApiAssertionJsonPath from "./ApiAssertionJsonPath";
|
||||||
import MsApiAssertionJsr223 from "@/business/components/api/test/components/assertion/ApiAssertionJsr223";
|
import MsApiAssertionJsr223 from "@/business/components/api/test/components/assertion/ApiAssertionJsr223";
|
||||||
import MsApiAssertionXPath2 from "./ApiAssertionXPath2";
|
import MsApiAssertionXPath2 from "./ApiAssertionXPath2";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsApiAssertionsEdit",
|
name: "MsApiAssertionsEdit",
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
MsApiAssertionXPath2,
|
MsApiAssertionXPath2,
|
||||||
MsApiAssertionJsr223, MsApiAssertionJsonPath, MsApiAssertionDuration, MsApiAssertionRegex},
|
MsApiAssertionJsr223, MsApiAssertionJsonPath, MsApiAssertionDuration, MsApiAssertionRegex
|
||||||
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
assertions: {},
|
assertions: {},
|
||||||
|
reloadData: String,
|
||||||
isReadOnly: {
|
isReadOnly: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isShow() {
|
isShow() {
|
||||||
let rt = this.assertions.duration;
|
let rt = this.assertions.duration;
|
||||||
return rt.value !== undefined;
|
return rt.value !== undefined;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
reloadData() {
|
||||||
|
this.reload();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
reload() {
|
||||||
|
this.loading = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.assertion-item-editing {
|
.assertion-item-editing {
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.assertion-item-editing.regex {
|
.assertion-item-editing.regex {
|
||||||
border-left: 2px solid #7B0274;
|
border-left: 2px solid #7B0274;
|
||||||
}
|
}
|
||||||
|
|
||||||
.assertion-item-editing.json_path {
|
.assertion-item-editing.json_path {
|
||||||
border-left: 2px solid #44B3D2;
|
border-left: 2px solid #44B3D2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.assertion-item-editing.response-time {
|
.assertion-item-editing.response-time {
|
||||||
border-left: 2px solid #DD0240;
|
border-left: 2px solid #DD0240;
|
||||||
}
|
}
|
||||||
|
|
||||||
.assertion-item-editing.jsr223 {
|
.assertion-item-editing.jsr223 {
|
||||||
border-left: 2px solid #1FDD02;
|
border-left: 2px solid #1FDD02;
|
||||||
}
|
}
|
||||||
|
|
||||||
.assertion-item-editing.x_path {
|
.assertion-item-editing.x_path {
|
||||||
border-left: 2px solid #fca130;
|
border-left: 2px solid #fca130;
|
||||||
}
|
}
|
||||||
|
|
||||||
.regex-item {
|
.regex-item {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ms-api-extract-edit :is-read-only="isReadOnly" :extract="extract"/>
|
<ms-api-extract-edit :is-read-only="isReadOnly" :reloadData="reloadData" :extract="extract"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -34,6 +34,7 @@
|
||||||
import {EXTRACT_TYPE} from "../../model/ApiTestModel";
|
import {EXTRACT_TYPE} from "../../model/ApiTestModel";
|
||||||
import MsApiExtractEdit from "./ApiExtractEdit";
|
import MsApiExtractEdit from "./ApiExtractEdit";
|
||||||
import MsApiExtractCommon from "./ApiExtractCommon";
|
import MsApiExtractCommon from "./ApiExtractCommon";
|
||||||
|
import {getUUID} from "@/common/js/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsApiExtract",
|
name: "MsApiExtract",
|
||||||
|
@ -55,12 +56,14 @@
|
||||||
return {
|
return {
|
||||||
options: EXTRACT_TYPE,
|
options: EXTRACT_TYPE,
|
||||||
type: "",
|
type: "",
|
||||||
|
reloadData: "",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
after() {
|
after() {
|
||||||
this.type = "";
|
this.type = "";
|
||||||
|
this.reloadData = getUUID().substring(0, 8);
|
||||||
},
|
},
|
||||||
remove() {
|
remove() {
|
||||||
this.$emit('remove', this.extract);
|
this.$emit('remove', this.extract);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div v-loading="loading">
|
||||||
<div class="extract-item-editing regex" v-if="extract.regex.length > 0">
|
<div class="extract-item-editing regex" v-if="extract.regex.length > 0">
|
||||||
<div>
|
<div>
|
||||||
{{$t("api_test.request.extract.regex")}}
|
{{$t("api_test.request.extract.regex")}}
|
||||||
|
@ -47,12 +47,27 @@
|
||||||
isReadOnly: {
|
isReadOnly: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
reloadData: String,
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
reloadData() {
|
||||||
|
this.reload();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
reload() {
|
||||||
|
this.loading = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
type: EXTRACT_TYPE
|
type: EXTRACT_TYPE,
|
||||||
|
loading: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue