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"> <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"
:response="apiCase.responseData" :headers="apiCase.request.headers "
v-if="api.method==='TCP'"/> :response="apiCase.responseData"
<esb-definition v-xpack :request="apiCase.request" :show-pre-script="true" :showScript="true" :request="apiCase.request" v-if="api.protocol==='HTTP'"/>
:response="apiCase.responseData" <tcp-format-parameters
v-if="isXpack&&api.method==='ESB'" ref="esbDefinition"/> :showScript="true"
<ms-sql-basis-parameters :showScript="true" :request="apiCase.request" :response="apiCase.responseData" :show-pre-script="true"
v-if="api.protocol==='SQL'"/> :request="apiCase.request"
<ms-dubbo-basis-parameters :showScript="true" :request="apiCase.request" :response="apiCase.responseData" :response="apiCase.responseData"
v-if="api.protocol==='DUBBO'"/> 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 请求返回数据 --> <!-- 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

@ -32,7 +32,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>
@ -40,8 +39,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>
@ -68,6 +73,7 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
saveButtonText: String,
refreshSign: String, refreshSign: String,
currentApi: { currentApi: {
type: Object type: Object
@ -82,7 +88,6 @@ export default {
batchLoadingIds: [], batchLoadingIds: [],
singleLoading: false, singleLoading: false,
singleRunId: "", singleRunId: "",
runResult: {},
runData: [], runData: [],
reportId: "", reportId: "",
testCaseId: "", testCaseId: "",
@ -248,7 +253,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};
} }