fix(接口自动化): 断言将忽略移到最外层

--bug=1004217 --user=郭雨琦 断言将忽略移到最外层
This commit is contained in:
guoyuqi 2021-12-23 15:49:01 +08:00 committed by 刘瑞斌
parent 80431d81d5
commit d04602ae67
5 changed files with 23 additions and 24 deletions

View File

@ -33,6 +33,9 @@
<div class="header-right" @click.stop> <div class="header-right" @click.stop>
<slot name="message"></slot> <slot name="message"></slot>
<slot name="debugStepCode"></slot> <slot name="debugStepCode"></slot>
<el-checkbox v-model="data.assumeSuccess" class="assertion-checkbox" >
{{ $t('api_test.request.assertions.ignore_status') }}
</el-checkbox>
<el-tooltip :content="$t('test_resource_pool.enable_disable')" placement="top" v-if="showBtn"> <el-tooltip :content="$t('test_resource_pool.enable_disable')" placement="top" v-if="showBtn">
<el-switch v-model="data.enable" class="enable-switch" size="mini" :disabled="data.disabled && !data.root" style="width: 30px"/> <el-switch v-model="data.enable" class="enable-switch" size="mini" :disabled="data.disabled && !data.root" style="width: 30px"/>
</el-tooltip> </el-tooltip>
@ -259,5 +262,8 @@ fieldset {
cursor: pointer; cursor: pointer;
border-color: #783887; border-color: #783887;
} }
.assertion-checkbox {
text-align: center;
width: 120px;
}
</style> </style>

View File

@ -13,11 +13,6 @@
<el-input :disabled="isReadOnly" v-model="regex.expression" size="small" show-word-limit <el-input :disabled="isReadOnly" v-model="regex.expression" size="small" show-word-limit
:placeholder="$t('api_test.request.assertions.expression')"/> :placeholder="$t('api_test.request.assertions.expression')"/>
</el-col> </el-col>
<el-col class="assertion-checkbox">
<el-checkbox v-model="regex.assumeSuccess" :disabled="isReadOnly">
{{ $t('api_test.request.assertions.ignore_status') }}
</el-checkbox>
</el-col>
<el-col class="assertion-btn"> <el-col class="assertion-btn">
<el-button :disabled="isReadOnly" type="danger" size="mini" icon="el-icon-delete" circle @click="remove" <el-button :disabled="isReadOnly" type="danger" size="mini" icon="el-icon-delete" circle @click="remove"
v-if="edit"/> v-if="edit"/>
@ -51,7 +46,11 @@ export default {
isReadOnly: { isReadOnly: {
type: Boolean, type: Boolean,
default: false default: false
} },
assumeSuccess: {
type: Boolean,
default: false
},
}, },
data() { data() {
@ -80,6 +79,7 @@ export default {
getRegex() { getRegex() {
let regex = new Regex(this.regex); let regex = new Regex(this.regex);
regex.description = regex.subject + " has: " + regex.expression; regex.description = regex.subject + " has: " + regex.expression;
regex.assumeSuccess = this.assumeSuccess;
return regex; return regex;
}, },
setRegexDescription() { setRegexDescription() {
@ -98,11 +98,6 @@ export default {
width: 100%; width: 100%;
} }
.assertion-checkbox {
text-align: center;
width: 120px;
}
.assertion-btn { .assertion-btn {
text-align: center; text-align: center;
width: 60px; width: 60px;

View File

@ -35,6 +35,7 @@
<ms-api-assertion-regex <ms-api-assertion-regex
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
:list="assertions.regex" :list="assertions.regex"
:assume-success = "assertions.assumeSuccess"
:callback="after" :callback="after"
v-if="type === options.REGEX" v-if="type === options.REGEX"
/> />
@ -173,6 +174,7 @@ export default {
this.reload(); this.reload();
}, },
copyRow() { copyRow() {
console.log("添加")
this.$emit('copyRow', this.assertions, this.node); this.$emit('copyRow', this.assertions, this.node);
}, },
suggestJsonOpen() { suggestJsonOpen() {
@ -217,6 +219,7 @@ export default {
this.assertions.jsonPath = []; this.assertions.jsonPath = [];
} }
} }
} }
</script> </script>

View File

@ -13,11 +13,6 @@
<el-input :disabled="isReadOnly" v-model="regex.expression" size="small" show-word-limit <el-input :disabled="isReadOnly" v-model="regex.expression" size="small" show-word-limit
:placeholder="$t('api_test.request.assertions.expression')"/> :placeholder="$t('api_test.request.assertions.expression')"/>
</el-col> </el-col>
<el-col class="assertion-checkbox">
<el-checkbox v-model="regex.assumeSuccess" :disabled="isReadOnly">
{{ $t('api_test.request.assertions.ignore_status') }}
</el-checkbox>
</el-col>
<el-col class="assertion-btn"> <el-col class="assertion-btn">
<el-button :disabled="isReadOnly" type="danger" size="mini" icon="el-icon-delete" circle @click="remove" <el-button :disabled="isReadOnly" type="danger" size="mini" icon="el-icon-delete" circle @click="remove"
v-if="edit"/> v-if="edit"/>
@ -52,7 +47,11 @@ export default {
isReadOnly: { isReadOnly: {
type: Boolean, type: Boolean,
default: false default: false
} },
assumeSuccess: {
type: Boolean,
default: false
},
}, },
data() { data() {
@ -81,6 +80,7 @@ export default {
getRegex() { getRegex() {
let regex = new Regex(this.regex); let regex = new Regex(this.regex);
regex.description = regex.subject + " has: " + regex.expression; regex.description = regex.subject + " has: " + regex.expression;
regex.assumeSuccess = this.assumeSuccess;
return regex; return regex;
}, },
setRegexDescription() { setRegexDescription() {
@ -99,11 +99,6 @@ export default {
width: 100%; width: 100%;
} }
.assertion-checkbox {
text-align: center;
width: 120px;
}
.assertion-btn { .assertion-btn {
text-align: center; text-align: center;
width: 60px; width: 60px;

View File

@ -17,7 +17,7 @@
<el-col :span="20"> <el-col :span="20">
<ms-api-assertion-text :is-read-only="isReadOnly" :list="assertions.regex" v-if="type === options.TEXT" <ms-api-assertion-text :is-read-only="isReadOnly" :list="assertions.regex" v-if="type === options.TEXT"
:callback="after"/> :callback="after"/>
<ms-api-assertion-regex :is-read-only="isReadOnly" :list="assertions.regex" v-if="type === options.REGEX" <ms-api-assertion-regex :is-read-only="isReadOnly" :list="assertions.regex" :assume-success = "assertions.assumeSuccess" v-if="type === options.REGEX"
:callback="after"/> :callback="after"/>
<ms-api-assertion-json-path :is-read-only="isReadOnly" :list="assertions.jsonPath" <ms-api-assertion-json-path :is-read-only="isReadOnly" :list="assertions.jsonPath"
v-if="type === options.JSON_PATH" :callback="after"/> v-if="type === options.JSON_PATH" :callback="after"/>