fix(测试跟踪): 报告-场景-点击查看执行结果-点击步骤-不能向下展开

--bug=1027885 --user=白奇 【测试跟踪】&【接口测试】报告-场景-点击查看执行结果-点击步骤-不能向下展开 https://www.tapd.cn/55049933/s/1396341https://www.tapd.cn/55049933/s/1393977
This commit is contained in:
baiqi 2023-07-24 11:08:02 +08:00 committed by fit2-zhao
parent d43cb36b3c
commit 4dc42df9b6
4 changed files with 82 additions and 71 deletions

View File

@ -27,7 +27,7 @@
<ms-scenario-result <ms-scenario-result
:key="data.resourceId" :key="data.resourceId"
:node="data" :node="data"
:expanded="node.expanded" :expanded.sync="node.expanded"
:console="console" :console="console"
v-on:requestResult="requestResult" v-on:requestResult="requestResult"
:is-share="isShare" :is-share="isShare"
@ -99,6 +99,7 @@ export default {
this.$emit('requestResult', requestResult); this.$emit('requestResult', requestResult);
}, },
nodeClick(data, node) { nodeClick(data, node) {
console.log('nodeClick', e);
node.expanded = !node.expanded; node.expanded = !node.expanded;
}, },
// //

View File

@ -1,7 +1,7 @@
<template> <template>
<el-card class="ms-cards" v-if="request && request.responseResult"> <el-card class="ms-cards" v-if="request && request.responseResult">
<div class="request-result"> <div class="request-result">
<div @click="active"> <div @click.stop="active">
<el-row :gutter="18" type="flex" align="middle" class="info"> <el-row :gutter="18" type="flex" align="middle" class="info">
<el-col class="ms-req-name-col" :span="18" v-if="indexNumber != undefined"> <el-col class="ms-req-name-col" :span="18" v-if="indexNumber != undefined">
<el-tooltip :content="getName(request.name)" placement="top" style="z-index: 999"> <el-tooltip :content="getName(request.name)" placement="top" style="z-index: 999">
@ -70,7 +70,7 @@
</div> </div>
<el-collapse-transition> <el-collapse-transition>
<div v-show="showActive && !request.unexecute" style="width: 99%"> <div v-show="showActive && !request.unexecute" style="width: 99%" @click.stop>
<ms-request-result-tail <ms-request-result-tail
v-loading="requestInfo.loading" v-loading="requestInfo.loading"
:scenario-name="scenarioName" :scenario-name="scenarioName"
@ -151,9 +151,12 @@ export default {
}; };
}, },
watch: { watch: {
expanded() { expanded(val) {
this.loadRequestInfoExpand(); this.loadRequestInfoExpand();
this.showActive = this.expanded; this.showActive = val;
},
showActive(val) {
this.$emit('update:expanded', val);
}, },
errorCode() { errorCode() {
this.baseErrorCode = this.errorCode; this.baseErrorCode = this.errorCode;
@ -174,7 +177,7 @@ export default {
created() { created() {
this.showActive = this.expanded; this.showActive = this.expanded;
this.baseErrorCode = this.errorCode; this.baseErrorCode = this.errorCode;
if(this.expanded === true) { if (this.expanded === true) {
this.loadRequestInfoExpand(); this.loadRequestInfoExpand();
} }
}, },

View File

@ -1,66 +1,58 @@
<template> <template>
<div class="text-container"> <div class="text-container">
<el-collapse-transition> <el-tabs v-model="activeName">
<el-tabs v-model="activeName" v-show="isActive"> <el-tab-pane
<el-tab-pane :class="'body-pane'"
:class="'body-pane'" :label="$t('api_test.definition.request.response_body')"
:label="$t('api_test.definition.request.response_body')" name="body"
name="body" class="pane">
class="pane"> <ms-sql-result-table v-if="isSqlType" :body="response.body" />
<ms-sql-result-table v-if="isSqlType" :body="response.body" /> <ms-code-edit v-else :mode="mode" :read-only="true" :data="response.body" :modes="modes" ref="codeEdit" />
<ms-code-edit </el-tab-pane>
v-if="!isSqlType"
:mode="mode"
:read-only="true"
:data="response.body"
:modes="modes"
ref="codeEdit" />
</el-tab-pane>
<el-tab-pane :label="$t('api_test.definition.request.response_header')" name="headers" class="pane"> <el-tab-pane :label="$t('api_test.definition.request.response_header')" name="headers" class="pane">
<pre>{{ response.headers }}</pre> <pre>{{ response.headers }}</pre>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('api_report.assertions')" name="assertions" class="pane assertions"> <el-tab-pane :label="$t('api_report.assertions')" name="assertions" class="pane assertions">
<ms-assertion-results :assertions="response.assertions" /> <ms-assertion-results :assertions="response.assertions" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('api_test.request.extract.label')" name="label" class="pane"> <el-tab-pane :label="$t('api_test.request.extract.label')" name="label" class="pane">
<pre>{{ response.vars }}</pre> <pre>{{ response.vars }}</pre>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('api_report.request_body')" name="request_body" class="pane"> <el-tab-pane :label="$t('api_report.request_body')" name="request_body" class="pane">
<div class="ms-div" v-if="request.url && request.url !== ''"> <div class="ms-div" v-if="request.url && request.url !== ''">
{{ $t('api_test.request.address') }} : {{ $t('api_test.request.address') }} :
<pre>{{ request.url }}</pre> <pre>{{ request.url }}</pre>
</div> </div>
<!--这里判断url而不是判断cookies是因为通过url来判断是否是http请求http请求展示以下信息--> <!--这里判断url而不是判断cookies是因为通过url来判断是否是http请求http请求展示以下信息-->
<div class="ms-div" v-if="request.url && request.url !== ''"> <div class="ms-div" v-if="request.url && request.url !== ''">
{{ $t('api_test.scenario.headers') }} : {{ $t('api_test.scenario.headers') }} :
<pre>{{ request.headers }}</pre> <pre>{{ request.headers }}</pre>
</div> </div>
<div class="ms-div" v-if="request.url && request.url !== ''"> <div class="ms-div" v-if="request.url && request.url !== ''">
Cookie: Cookie:
<pre>{{ request.cookies }}</pre> <pre>{{ request.cookies }}</pre>
</div> </div>
<div class="ms-div"> <div class="ms-div">
Body : Body :
<pre>{{ request.body }}</pre> <pre>{{ request.body }}</pre>
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane v-if="activeName == 'body'" :disabled="true" name="mode" class="pane assertions"> <el-tab-pane v-if="activeName == 'body'" :disabled="true" name="mode" class="pane assertions">
<template v-slot:label> <template v-slot:label>
<ms-dropdown <ms-dropdown
v-if="request.method === 'SQL'" v-if="request.method === 'SQL'"
:commands="sqlModes" :commands="sqlModes"
:default-command="mode" :default-command="mode"
@command="sqlModeChange" /> @command="sqlModeChange" />
<ms-dropdown v-else :commands="modes" :default-command="mode" @command="modeChange" ref="modeDropdown" /> <ms-dropdown v-else :commands="modes" :default-command="mode" @command="modeChange" ref="modeDropdown" />
</template> </template>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-collapse-transition>
</div> </div>
</template> </template>
@ -90,7 +82,6 @@ export default {
data() { data() {
return { return {
isActive: true,
activeName: 'body', activeName: 'body',
modes: ['text', 'json', 'xml', 'html'], modes: ['text', 'json', 'xml', 'html'],
sqlModes: ['text', 'table'], sqlModes: ['text', 'table'],
@ -99,9 +90,6 @@ export default {
}, },
methods: { methods: {
active() {
this.isActive = !this.isActive;
},
modeChange(mode) { modeChange(mode) {
this.mode = mode; this.mode = mode;
}, },

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="scenario-result"> <div class="scenario-result" @click.stop="handleClick">
<div <div
v-if=" v-if="
(node.children && node.children.length > 0) || (node.children && node.children.length > 0) ||
@ -23,8 +23,14 @@
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
<div style="float: right"> <div style="float: right">
<ms-api-report-status :status="node.totalStatus" v-if="node.type !=='ConstantTimer' && node.type !=='Assertion' <ms-api-report-status
&& node.children && node.children.length > 0"/> :status="node.totalStatus"
v-if="
node.type !== 'ConstantTimer' &&
node.type !== 'Assertion' &&
node.children &&
node.children.length > 0
" />
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
@ -40,7 +46,7 @@
:scenarioName="node.label" :scenarioName="node.label"
:resourceId="node.resourceId" :resourceId="node.resourceId"
:total-status="node.totalStatus" :total-status="node.totalStatus"
:expanded="expanded" :expanded.sync="innerExpanded"
:console="console" :console="console"
:is-share="isShare" :is-share="isShare"
:share-id="shareId" :share-id="shareId"
@ -58,7 +64,8 @@ import MsApiReportStatus from '../ApiReportStatus';
export default { export default {
name: 'MsScenarioResult', name: 'MsScenarioResult',
components: { components: {
MsRequestResult, MsApiReportStatus MsRequestResult,
MsApiReportStatus,
}, },
props: { props: {
scenario: Object, scenario: Object,
@ -71,8 +78,17 @@ export default {
data() { data() {
return { return {
stepFilter: new STEP(), stepFilter: new STEP(),
innerExpanded: false,
}; };
}, },
watch: {
expanded(val) {
this.innerExpanded = val;
},
innerExpanded(val) {
this.$emit('update:expanded', val);
},
},
methods: { methods: {
getLabel(label) { getLabel(label) {
switch (label) { switch (label) {
@ -114,6 +130,9 @@ export default {
requestResult(requestResult) { requestResult(requestResult) {
this.$emit('requestResult', requestResult); this.$emit('requestResult', requestResult);
}, },
handleClick() {
this.innerExpanded = !this.innerExpanded;
},
}, },
computed: { computed: {