fix(测试跟踪): 测试计划接口Case请求响应体内容展示问题

--bug=1028193 --user=宋昌昌 【测试跟踪】github#25930,测试计划报告详情,打开某一个接口用例,查看接口请求内容,请求内容很长的时候,展示不全。 https://www.tapd.cn/55049933/s/1404778
This commit is contained in:
song-cc-rock 2023-08-17 10:57:57 +08:00 committed by 刘瑞斌
parent d9530350f6
commit d0e50060d1
2 changed files with 137 additions and 141 deletions

View File

@ -2,122 +2,122 @@
<div class="text-container" v-if="responseResult">
<el-tabs v-model="activeName" v-show="isActive">
<el-tab-pane
:label="$t('api_test.definition.request.response_body')"
name="body"
class="pane"
:label="$t('api_test.definition.request.response_body')"
name="body"
class="pane"
>
<ms-sql-result-table
v-if="isSqlType && activeName === 'body'"
:body="responseResult.body"
v-if="isSqlType && activeName === 'body'"
:body="responseResult.body"
/>
<ms-code-edit
v-if="!isSqlType && isMsCodeEditShow && activeName === 'body'"
:mode="mode"
:read-only="true"
:modes="modes"
:data.sync="responseResult.body"
ref="codeEdit"
v-if="!isSqlType && isMsCodeEditShow && activeName === 'body'"
:mode="mode"
:read-only="true"
:modes="modes"
:data.sync="responseResult.body"
ref="codeEdit"
/>
</el-tab-pane>
<el-tab-pane
:label="$t('api_test.definition.request.response_header')"
name="headers"
class="pane"
:label="$t('api_test.definition.request.response_header')"
name="headers"
class="pane"
>
<ms-code-edit
:mode="'text'"
:read-only="true"
:data.sync="responseResult.headers"
v-if="activeName === 'headers'"
:mode="'text'"
:read-only="true"
:data.sync="responseResult.headers"
v-if="activeName === 'headers'"
/>
</el-tab-pane>
<el-tab-pane
v-if="isTestPlan"
:label="$t('api_test.definition.request.console')"
name="console"
class="pane"
v-if="isTestPlan"
:label="$t('api_test.definition.request.console')"
name="console"
class="pane"
>
<ms-code-edit
:mode="'text'"
:read-only="true"
:data.sync="responseResult.console"
v-if="activeName === 'console'"
height="420px"
:mode="'text'"
:read-only="true"
:data.sync="responseResult.console"
v-if="activeName === 'console'"
height="420px"
/>
</el-tab-pane>
<el-tab-pane
v-if="!isTestPlan"
:label="$t('api_test.definition.request.console')"
name="console"
class="pane"
v-if="!isTestPlan"
:label="$t('api_test.definition.request.console')"
name="console"
class="pane"
>
<ms-code-edit
:mode="'text'"
:read-only="true"
:data.sync="responseResult.console"
v-if="activeName === 'console'"
:mode="'text'"
:read-only="true"
:data.sync="responseResult.console"
v-if="activeName === 'console'"
/>
</el-tab-pane>
<el-tab-pane
:label="$t('api_report.assertions')"
name="assertions"
class="pane assertions"
:label="$t('api_report.assertions')"
name="assertions"
class="pane assertions"
>
<ms-assertion-results
:assertions="responseResult.assertions"
v-if="activeName === 'assertions'"
:assertions="responseResult.assertions"
v-if="activeName === 'assertions'"
/>
</el-tab-pane>
<el-tab-pane
:label="$t('api_test.request.extract.label')"
name="label"
class="pane"
:label="$t('api_test.request.extract.label')"
name="label"
class="pane"
>
<ms-code-edit
:mode="'text'"
:read-only="true"
:data.sync="responseResult.vars"
v-if="activeName === 'label'"
:mode="'text'"
:read-only="true"
:data.sync="responseResult.vars"
v-if="activeName === 'label'"
/>
</el-tab-pane>
<el-tab-pane
:label="$t('api_report.request_body')"
name="request_body"
class="pane"
:label="$t('api_report.request_body')"
name="request_body"
class="pane"
>
<ms-code-edit
:mode="'text'"
:read-only="true"
:data.sync="reqMessages"
v-if="activeName === 'request_body'"
:mode="'text'"
:read-only="true"
:data.sync="reqMessages"
v-if="activeName === 'request_body'"
/>
</el-tab-pane>
<el-tab-pane
v-if="activeName == 'body'"
:disabled="true"
name="mode"
class="pane cookie"
v-if="activeName === 'body'"
:disabled="true"
name="mode"
class="pane cookie"
>
<template v-slot:label>
<ms-dropdown
v-if="currentProtocol === 'SQL'"
:commands="sqlModes"
:default-command="mode"
@command="sqlModeChange"
v-if="currentProtocol === 'SQL'"
:commands="sqlModes"
:default-command="mode"
@command="sqlModeChange"
/>
<ms-dropdown
v-else
:commands="modes"
:default-command="mode"
@command="modeChange"
ref="modeDropdown"
v-else
:commands="modes"
:default-command="mode"
@command="modeChange"
ref="modeDropdown"
/>
</template>
</el-tab-pane>
@ -179,12 +179,12 @@ export default {
},
setBodyType() {
if (
this.response &&
this.response.responseResult &&
this.response.responseResult.headers &&
this.response.responseResult.headers.indexOf(
"Content-Type: application/json"
) > 0
this.response &&
this.response.responseResult &&
this.response.responseResult.headers &&
this.response.responseResult.headers.indexOf(
"Content-Type: application/json"
) > 0
) {
this.mode = BODY_FORMAT.JSON;
this.$nextTick(() => {
@ -222,20 +222,20 @@ export default {
this.response.responseResult.vars = "";
}
this.reqMessages =
this.$t("api_test.request.address") +
":\n" +
this.response.url +
"\n" +
this.$t("api_test.scenario.headers") +
":\n" +
this.response.headers +
"\n" +
"Cookie:\n" +
this.response.cookies +
"\n" +
"Body:" +
"\n" +
this.response.body;
this.$t("api_test.request.address") +
":\n" +
this.response.url +
"\n" +
this.$t("api_test.scenario.headers") +
":\n" +
this.response.headers +
"\n" +
"Cookie:\n" +
this.response.cookies +
"\n" +
"Body:" +
"\n" +
this.response.body;
}
},
},
@ -246,15 +246,15 @@ export default {
computed: {
isSqlType() {
return (
this.currentProtocol === "SQL" &&
this.response.responseResult.responseCode === "200" &&
this.mode === "table"
this.currentProtocol === "SQL" &&
this.response.responseResult['responseCode'] === "200" &&
this.mode === "table"
);
},
responseResult() {
return this.response && this.response.responseResult
? this.response.responseResult
: {};
? this.response.responseResult
: {};
},
},
};
@ -280,7 +280,7 @@ export default {
.text-container .pane {
background-color: #f5f5f5;
padding: 1px 0;
height: 250px;
height: 400px;
overflow-y: auto;
}
@ -289,7 +289,7 @@ export default {
}
:deep(.el-tabs__nav-wrap::after) {
height: 0px;
height: 0;
}
.ms-div {

View File

@ -1,21 +1,21 @@
<template>
<el-container>
<ms-aside-container
width="500px"
:default-hidden-bottom-top="200"
:enable-auto-height="true"
width="500px"
:default-hidden-bottom-top="200"
:enable-auto-height="true"
>
<el-card>
<el-scrollbar>
<ms-table
v-loading="loading"
:show-select-all="false"
:screen-height="null"
:enable-selection="false"
:highlight-current-row="true"
@refresh="getScenarioApiCase"
@handleRowClick="rowClick"
:data="apiCases"
v-loading="loading"
:show-select-all="false"
:screen-height="null"
:enable-selection="false"
:highlight-current-row="true"
@refresh="getScenarioApiCase"
@handleRowClick="rowClick"
:data="apiCases"
>
<ms-table-column :width="100" :label="$t('commons.id')" prop="num">
</ms-table-column>
@ -24,30 +24,30 @@
</ms-table-column>
<el-table-column
prop="principalName"
:label="$t('test_track.plan.plan_principal')"
prop="principalName"
:label="$t('test_track.plan.plan_principal')"
/>
<ms-table-column
:label="$t('test_track.case.priority')"
:width="80"
prop="priority"
:label="$t('test_track.case.priority')"
:width="80"
prop="priority"
>
<template v-slot:default="scope">
<priority-table-item
:value="scope.row.priority"
ref="priority"
:value="scope.row.priority"
ref="priority"
/>
</template>
</ms-table-column>
<ms-table-column
:width="80"
:label="$t('test_track.plan_view.execute_result')"
prop="lastResult"
:width="80"
:label="$t('test_track.plan_view.execute_result')"
prop="lastResult"
>
<template v-slot:default="scope">
<ms-test-plan-api-status :status="scope.row.execResult" />
<ms-test-plan-api-status :status="scope.row['execResult']"/>
</template>
</ms-table-column>
</ms-table>
@ -61,9 +61,9 @@
</el-card>
<el-card v-else>
<ms-request-result-tail
:response="response"
:is-test-plan="showResponse"
ref="debugResult"
:response="response"
:is-test-plan="showResponse"
ref="debugResult"
/>
</el-card>
</div>
@ -150,30 +150,30 @@ export default {
getScenarioApiCase() {
if (this.isTemplate || this.isDb) {
if (this.isErrorReport) {
this.apiCases = this.report.errorReportCases
? this.report.errorReportCases
: [];
this.apiCases = this.report['errorReportCases']
? this.report['errorReportCases']
: [];
} else if (this.isUnExecute) {
this.apiCases = this.report.unExecuteCases
? this.report.unExecuteCases
: [];
this.apiCases = this.report['unExecuteCases']
? this.report['unExecuteCases']
: [];
} else if (this.isAll) {
this.apiCases = this.report.apiAllCases
? this.report.apiAllCases
: [];
this.apiCases = this.report['apiAllCases']
? this.report['apiAllCases']
: [];
} else {
this.apiCases = this.report.apiFailureCases
? this.report.apiFailureCases
: [];
this.apiCases = this.report['apiFailureCases']
? this.report['apiFailureCases']
: [];
}
} else if (this.isShare) {
if (this.isErrorReport) {
this.loading = true;
getSharePlanApiErrorReportCase(this.shareId, this.planId).then(
(r) => {
this.loading = false;
this.apiCases = r.data;
}
(r) => {
this.loading = false;
this.apiCases = r.data;
}
);
} else if (this.isUnExecute) {
this.loading = true;
@ -308,14 +308,10 @@ export default {
height: 550px;
}
:deep(.text-container .pane) {
height: 550px !important;
}
.ms-aside-container {
border: 0px;
border: 0;
height: 550px;
padding: 10px 0px 0px 10px;
padding: 10px 0 0 10px;
}
.ms-main-container {