fix(接口测试): 修复新建接口case执行完成后点击JSONPath推荐失效问题

--bug=1012120 --user=赵勇 [接口测试]github #125681.19.2版本,新建接口case,执行完成后,点击JSONPath抓取功能无法使用了 https://www.tapd.cn/55049933/s/1133885
This commit is contained in:
fit2-zhao 2022-04-13 15:46:36 +08:00 committed by 刘瑞斌
parent a566384497
commit ddd7fa4587
2 changed files with 51 additions and 20 deletions

View File

@ -110,25 +110,52 @@
<div v-if="apiCase.active||type==='detail'" v-loading="loading">
<el-divider></el-divider>
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
<ms-api-request-form :isShowEnable="true" :showScript="true" :headers="apiCase.request.headers "
:response="apiCase.responseData" :request="apiCase.request" v-if="api.protocol==='HTTP'"/>
<tcp-format-parameters :showScript="true" :show-pre-script="true" :request="apiCase.request"
:response="apiCase.responseData"
v-if="api.method==='TCP'"/>
<esb-definition v-xpack :request="apiCase.request" :show-pre-script="true" :showScript="true"
:response="apiCase.responseData"
v-if="isXpack&&api.method==='ESB'" ref="esbDefinition"/>
<ms-sql-basis-parameters :showScript="true" :request="apiCase.request" :response="apiCase.responseData"
v-if="api.protocol==='SQL'"/>
<ms-dubbo-basis-parameters :showScript="true" :request="apiCase.request" :response="apiCase.responseData"
v-if="api.protocol==='DUBBO'"/>
<ms-api-request-form
:isShowEnable="true"
:showScript="true"
:headers="apiCase.request.headers "
:response="apiCase.responseData"
:request="apiCase.request" v-if="api.protocol==='HTTP'"/>
<tcp-format-parameters
:showScript="true"
:show-pre-script="true"
:request="apiCase.request"
:response="apiCase.responseData"
v-if="api.method==='TCP'"/>
<esb-definition
v-xpack
:request="apiCase.request"
:show-pre-script="true"
:showScript="true"
:response="apiCase.responseData"
v-if="isXpack&&api.method==='ESB'" ref="esbDefinition"/>
<ms-sql-basis-parameters
:showScript="true"
:request="apiCase.request"
:response="apiCase.responseData"
v-if="api.protocol==='SQL'"/>
<ms-dubbo-basis-parameters
:showScript="true"
:request="apiCase.request"
:response="apiCase.responseData"
v-if="api.protocol==='DUBBO'"/>
<!-- HTTP 请求返回数据 -->
<p class="tip">{{ $t('api_test.definition.request.res_param') }}</p>
<div v-if="isXpack&&api.method==='ESB'">
<esb-definition-response v-xpack v-if="isXpack" :currentProtocol="apiCase.request.protocol" :request="apiCase.request" :is-api-component="false" :show-options-button="false" :show-header="true" :api-item="apiCase"/>
<esb-definition-response
v-xpack v-if="isXpack"
:currentProtocol="apiCase.request.protocol"
:request="apiCase.request"
:is-api-component="false"
:show-options-button="false"
:show-header="true"
:api-item="apiCase"/>
</div>
<div v-else>
<api-response-component :currentProtocol="apiCase.request.protocol" :api-item="apiCase" :result="runResult"/>
<api-response-component
:currentProtocol="apiCase.request.protocol"
:api-item="apiCase"
:result="apiCase.responseData"/>
</div>
</div>
</el-collapse-transition>
@ -226,7 +253,6 @@ export default {
}
},
props: {
runResult: {},
loaded: {
type: Boolean,
default: false,

View File

@ -32,7 +32,6 @@
:api="api"
:currentApi="currentApi"
:loaded="loaded"
:runResult="runResult"
:maintainerOptions="maintainerOptions"
:api-case="apiCaseList[0]" ref="apiCaseItem"/>
</el-main>
@ -40,8 +39,14 @@
</ms-drawer>
<!-- 执行组件 -->
<ms-run :debug="false" :reportId="reportId" :run-data="runData" :env-map="envMap" :edit-case-request="true"
@runRefresh="runRefresh" @errorRefresh="errorRefresh" ref="runTest"/>
<ms-run
:debug="false"
:reportId="reportId"
:run-data="runData"
:env-map="envMap"
:edit-case-request="true"
@runRefresh="runRefresh"
@errorRefresh="errorRefresh" ref="runTest"/>
<ms-task-center ref="taskCenter" :show-menu="false"/>
</div>
</template>
@ -68,6 +73,7 @@ export default {
type: Boolean,
default: false
},
saveButtonText: String,
refreshSign: String,
currentApi: {
type: Object
@ -82,7 +88,6 @@ export default {
batchLoadingIds: [],
singleLoading: false,
singleRunId: "",
runResult: {},
runData: [],
reportId: "",
testCaseId: "",
@ -248,7 +253,7 @@ export default {
if (data) {
let status = data.error > 0 ? "error" : "success";
this.apiCaseList[0].execResult = status
this.runResult = data;
this.apiCaseList[0].responseData = data;
this.$refs.apiCaseItem.runLoading = false;
this.$store.state.currentApiCase = {refresh: true, id: data.id, status: status};
}