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 fit2-zhao
parent 5287294ae3
commit 48bd009f18
2 changed files with 51 additions and 21 deletions

View File

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

View File

@ -33,7 +33,6 @@
:api="api" :api="api"
:currentApi="currentApi" :currentApi="currentApi"
:loaded="loaded" :loaded="loaded"
:runResult="runResult"
:maintainerOptions="maintainerOptions" :maintainerOptions="maintainerOptions"
:api-case="apiCaseList[0]" ref="apiCaseItem"/> :api-case="apiCaseList[0]" ref="apiCaseItem"/>
</el-main> </el-main>
@ -41,8 +40,14 @@
</ms-drawer> </ms-drawer>
<!-- 执行组件 --> <!-- 执行组件 -->
<ms-run :debug="false" :reportId="reportId" :run-data="runData" :env-map="envMap" :edit-case-request="true" <ms-run
@runRefresh="runRefresh" @errorRefresh="errorRefresh" ref="runTest"/> :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"/> <ms-task-center ref="taskCenter" :show-menu="false"/>
</div> </div>
</template> </template>
@ -84,7 +89,6 @@ export default {
batchLoadingIds: [], batchLoadingIds: [],
singleLoading: false, singleLoading: false,
singleRunId: "", singleRunId: "",
runResult: {},
runData: [], runData: [],
reportId: "", reportId: "",
testCaseId: "", testCaseId: "",
@ -250,7 +254,7 @@ export default {
if (data) { if (data) {
let status = data.error > 0 ? "error" : "success"; let status = data.error > 0 ? "error" : "success";
this.apiCaseList[0].execResult = status this.apiCaseList[0].execResult = status
this.runResult = data; this.apiCaseList[0].responseData = data;
this.$refs.apiCaseItem.runLoading = false; this.$refs.apiCaseItem.runLoading = false;
this.$store.state.currentApiCase = {refresh: true, id: data.id, status: status}; this.$store.state.currentApiCase = {refresh: true, id: data.id, status: status};
} }