fix(接口测试): 修复调试场景时没有展示运行环境的问题

--bug=1015004 --user=宋天阳 【接口测试】场景,列表执行或者调试生成报告,没有展示环境信息
https://www.tapd.cn/55049933/s/1208087
This commit is contained in:
song-tianyang 2022-07-23 14:56:03 +08:00 committed by 建国
parent fc1cb7de5a
commit 8eeb6ba40a
1 changed files with 45 additions and 30 deletions

View File

@ -5,28 +5,29 @@
<section class="report-container"> <section class="report-container">
<div style="margin-top: 10px"> <div style="margin-top: 10px">
<ms-api-report-view-header <ms-api-report-view-header
:show-cancel-button="false" :show-cancel-button="false"
:debug="debug" :debug="debug"
:export-flag="exportFlag" :export-flag="exportFlag"
:report="report" :report="report"
@reportExport="handleExport" :project-env-map="projectEnvMap"
@reportSave="handleSave"/> @reportExport="handleExport"
@reportSave="handleSave"/>
</div> </div>
<main> <main>
<ms-metric-chart <ms-metric-chart
:content="content" :content="content"
:totalTime="totalTime" :totalTime="totalTime"
:report="report" :report="report"
v-if="!loading"/> v-if="!loading"/>
<div> <div>
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane :label="$t('api_report.total')" name="total"> <el-tab-pane :label="$t('api_report.total')" name="total">
<ms-scenario-results <ms-scenario-results
:treeData="fullTreeNodes" :treeData="fullTreeNodes"
:report="report" :report="report"
:default-expand="true" :default-expand="true"
:console="content.console" :console="content.console"
v-on:requestResult="requestResult" v-on:requestResult="requestResult"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane name="fail"> <el-tab-pane name="fail">
@ -36,11 +37,11 @@
</span> </span>
</template> </template>
<ms-scenario-results <ms-scenario-results
:console="content.console" :console="content.console"
:report="report" :report="report"
:treeData="fullTreeNodes" :treeData="fullTreeNodes"
v-on:requestResult="requestResult" v-on:requestResult="requestResult"
ref="failsTree" ref="failsTree"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane name="errorReport" v-if="content.errorCode > 0"> <el-tab-pane name="errorReport" v-if="content.errorCode > 0">
@ -52,7 +53,9 @@
</el-tab-pane> </el-tab-pane>
<el-tab-pane name="unExecute" v-if="content.unExecute > 0"> <el-tab-pane name="unExecute" v-if="content.unExecute > 0">
<template slot="label"> <template slot="label">
<span class="fail" style="color: #9C9B9A">{{ $t('api_test.home_page.detail_card.unexecute') }}</span> <span class="fail" style="color: #9C9B9A">{{
$t('api_test.home_page.detail_card.unexecute')
}}</span>
</template> </template>
<ms-scenario-results v-on:requestResult="requestResult" <ms-scenario-results v-on:requestResult="requestResult"
:report="report" :report="report"
@ -69,11 +72,12 @@
</el-tabs> </el-tabs>
</div> </div>
<ms-api-report-export <ms-api-report-export
:title="report.testName" :title="report.testName"
:content="content" :content="content"
:total-time="totalTime" :total-time="totalTime"
id="apiTestReport" :project-env-map="projectEnvMap"
v-if="reportExportVisible" id="apiTestReport"
v-if="reportExportVisible"
/> />
</main> </main>
</section> </section>
@ -93,9 +97,9 @@ import MsContainer from "@/business/components/common/components/MsContainer";
import MsMainContainer from "@/business/components/common/components/MsMainContainer"; import MsMainContainer from "@/business/components/common/components/MsMainContainer";
import MsApiReportExport from "./ApiReportExport"; import MsApiReportExport from "./ApiReportExport";
import MsApiReportViewHeader from "./ApiReportViewHeader"; import MsApiReportViewHeader from "./ApiReportViewHeader";
import {KeyValue, RequestFactory} from "../../definition/model/ApiTestModel"; import {RequestFactory} from "../../definition/model/ApiTestModel";
import {windowPrint, getCurrentProjectID, getUUID} from "@/common/js/utils"; import {getCurrentProjectID, windowPrint} from "@/common/js/utils";
import {ELEMENT_TYPE, STEP, TYPE_TO_C} from "../scenario/Setting"; import {STEP} from "../scenario/Setting";
export default { export default {
name: "SysnApiReportDetail", name: "SysnApiReportDetail",
@ -128,6 +132,7 @@ export default {
websocket: {}, websocket: {},
stepFilter: new STEP, stepFilter: new STEP,
tempResult: [], tempResult: [],
projectEnvMap: {},
} }
}, },
activated() { activated() {
@ -160,7 +165,14 @@ export default {
methods: { methods: {
initTree() { initTree() {
this.fullTreeNodes = []; this.fullTreeNodes = [];
let obj = {resId: "root", index: 1, label: this.scenario.name, value: {responseResult: {}, unexecute: true, testing: false}, children: [], unsolicited: true}; let obj = {
resId: "root",
index: 1,
label: this.scenario.name,
value: {responseResult: {}, unexecute: true, testing: false},
children: [],
unsolicited: true
};
this.formatContent(this.scenario.scenarioDefinition.hashTree, obj, "", "root"); this.formatContent(this.scenario.scenarioDefinition.hashTree, obj, "", "root");
this.fullTreeNodes.push(obj); this.fullTreeNodes.push(obj);
}, },
@ -332,6 +344,9 @@ export default {
if (!this.content) { if (!this.content) {
this.content = {scenarios: []}; this.content = {scenarios: []};
} }
if (this.content.projectEnvMap) {
this.projectEnvMap = this.content.projectEnvMap;
}
this.content.error = this.content.error; this.content.error = this.content.error;
this.content.success = (this.content.total - this.content.error - this.content.errorCode - this.content.unExecute); this.content.success = (this.content.total - this.content.error - this.content.errorCode - this.content.unExecute);