fix(接口测试): 修复jsonpath断言描述不准确的缺陷

--bug=1024854 --user=王孝刚 [接口测试] github#23072断言,Not
Contains类型的,在报告里体现的描述不准确。 https://www.tapd.cn/55049933/s/1355501
This commit is contained in:
wxg0103 2023-03-24 11:17:49 +08:00 committed by fit2-zhao
parent b14e26a1f6
commit f932748609
2 changed files with 20 additions and 18 deletions

View File

@ -9,7 +9,7 @@
maxlength="500"
size="small"
show-word-limit
:placeholder="$t('api_test.request.extract.json_path_expression')" />
:placeholder="$t('api_test.request.extract.json_path_expression')"/>
</el-tooltip>
</el-col>
<el-col>
@ -19,14 +19,14 @@
class="ms-col-type"
size="small"
style="width: 40%; margin-right: 10px"
@change="reload">
<el-option :label="$t('api_test.request.assertions.contains')" value="CONTAINS" />
<el-option :label="$t('api_test.request.assertions.not_contains')" value="NOT_CONTAINS" />
<el-option :label="$t('api_test.request.assertions.equals')" value="EQUALS" />
<el-option :label="$t('commons.adv_search.operators.not_equals')" value="NOT_EQUALS" />
<el-option :label="$t('commons.adv_search.operators.gt')" value="GT" />
<el-option :label="$t('commons.adv_search.operators.lt')" value="LT" />
<el-option :label="$t('api_test.request.assertions.regular_match')" value="REGEX" />
@change="setJSONPathDescription">
<el-option :label="$t('api_test.request.assertions.contains')" value="CONTAINS"/>
<el-option :label="$t('api_test.request.assertions.not_contains')" value="NOT_CONTAINS"/>
<el-option :label="$t('api_test.request.assertions.equals')" value="EQUALS"/>
<el-option :label="$t('commons.adv_search.operators.not_equals')" value="NOT_EQUALS"/>
<el-option :label="$t('commons.adv_search.operators.gt')" value="GT"/>
<el-option :label="$t('commons.adv_search.operators.lt')" value="LT"/>
<el-option :label="$t('api_test.request.assertions.regular_match')" value="REGEX"/>
</el-select>
<el-input
:disabled="isReadOnly"
@ -34,12 +34,12 @@
size="small"
show-word-limit
:placeholder="$t('api_test.request.assertions.expect')"
style="width: 50%" />
style="width: 50%"/>
<el-tooltip placement="top" v-if="jsonPath.option === 'REGEX'">
<div slot="content">
{{ $t('api_test.request.assertions.regex_info') }}
</div>
<i class="el-icon-question" style="cursor: pointer" />
<i class="el-icon-question" style="cursor: pointer"/>
</el-tooltip>
</el-col>
<el-col class="assertion-btn">
@ -49,7 +49,7 @@
class="enable-switch"
size="mini"
:disabled="isReadOnly"
style="width: 30px; margin-right: 10px" />
style="width: 30px; margin-right: 10px"/>
</el-tooltip>
<el-button
:disabled="isReadOnly"
@ -57,7 +57,7 @@
icon="el-icon-copy-document"
circle
@click="copyRow"
v-if="edit" />
v-if="edit"/>
<el-button
:disabled="isReadOnly"
type="danger"
@ -65,7 +65,7 @@
icon="el-icon-delete"
circle
@click="remove"
v-if="edit" />
v-if="edit"/>
<el-button :disabled="isReadOnly" type="primary" size="mini" @click="add" v-else>
{{ $t('api_test.request.assertions.add') }}
</el-button>
@ -75,7 +75,7 @@
</template>
<script>
import { JSONPath } from '../../model/ApiTestModel';
import {JSONPath} from '../../model/ApiTestModel';
export default {
name: 'MsApiAssertionJsonPath',
@ -145,7 +145,8 @@ export default {
setJSONPathDescription() {
this.showTip = !this.jsonPath || !this.jsonPath.expression || this.jsonPath.expression.length < 50;
this.jsonPath.description =
this.jsonPath.expression + ' expect: ' + (this.jsonPath.expect ? this.jsonPath.expect : '');
this.jsonPath.expression + " " + this.jsonPath.option + ": " + (this.jsonPath.expect ? this.jsonPath.expect : '');
this.reload();
},
copyRow() {
let jsonPath = new JSONPath(this.jsonPath);

View File

@ -9,7 +9,7 @@
</el-col>
<el-col>
<el-select :disabled="isReadOnly" v-model="jsonPath.option" class="ms-col-type" size="small"
style="width:40%;margin-right: 10px" @change="reload">
style="width:40%;margin-right: 10px" @change="setJSONPathDescription">
<el-option :label="$t('api_test.request.assertions.contains')" value="CONTAINS"/>
<el-option :label="$t('api_test.request.assertions.not_contains')" value="NOT_CONTAINS"/>
<el-option :label="$t('api_test.request.assertions.equals')" value="EQUALS"/>
@ -110,7 +110,8 @@ export default {
},
setJSONPathDescription() {
this.showTip = !this.jsonPath || !this.jsonPath.expression || this.jsonPath.expression.length < 50;
this.jsonPath.description = this.jsonPath.expression + " expect: " + (this.jsonPath.expect ? this.jsonPath.expect : '');
this.jsonPath.description = this.jsonPath.expression + " " + this.jsonPath.option + ": " + (this.jsonPath.expect ? this.jsonPath.expect : '');
this.reload();
}
}
}