text: webpackJsonp([2],{"9Jqq":function(t,e){},CD3M:function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=s("gRE1"),o=s.n(a),l=s("XLwt"),r=s.n(l),i=s("PJh5"),n=s.n(i),u=s("/FC1"),c={name:"TestReportDetail",data:function(){return{activeName:1,testReport:{testEnv:"",executionUser:"",cronJobId:"",testStartTime:"",totalCount:0,passCount:0,failCount:0,errorCount:0,spendTimeInSec:0,createAt:""},testSuites:[],reportChart:null,showDetailDialog:!1,result:{}}},methods:{getReport:function(){var t=this;Object(u.b)(this.$route.params.project_id,this.$route.params.report_id).then(function(e){if("ok"===e.status&&(t.testReport=e.data,e.data.testSuites)){t.testSuites=o()(e.data.testSuites);for(var s=function(e){var s=t.testSuites[e];s.testCaseReports=[];var a={sortBy:"createAt",order:"ascending",testSuiteId:s._id,reportId:t.$route.params.report_id};Object(u.c)(s._id,t.$route.params.report_id,a).then(function(t){"ok"==t.status&&t.data.rows.forEach(function(t){s.testCaseReports.push(t)})})},a=0;a<t.testSuites.length;a++)s(a)}})},getPassRate:function(t,e,s){return t=parseFloat(t),e=parseFloat(e),isNaN(t)||isNaN(e)?"-":s?e<=0?"0%":Math.round(t/e*1e4)/100+"%":e<=0?0:Math.round(t/e*1e4)/100},setChartOptions:function(t,e,s){this.reportChart.setOption({title:{text:"通过率统计"},legend:{data:["Pass","Fail","Error"]},series:[{type:"pie",radius:"55%",center:["50%","50%"],data:[{value:t,name:"Pass",itemStyle:{color:"#54ac21"}},{value:e,name:"Fail",itemStyle:{color:"#d6443f"}},{value:s,name:"Error",itemStyle:{color:"#e0aa1c"}}]}]})},showDetail:function(t){this.result.name=t.name,this.result.url=t.testCaseDetail.url,this.result.requestMethod=t.testCaseDetail.requestMethod,this.result.delaySeconds=t.testCaseDetail.delaySeconds,t.testCaseDetail.filePath&&(this.result.filePath=t.testCaseDetail.filePath),t.dataInitResult&&t.dataInitResult.length>0&&t.dataInitResult.forEach(function(t){try{t.query&&"string"==typeof t.query&&(t.query=JSON.parse(t.query)),t.set&&"string"==typeof t.set&&(t.set=JSON.parse(t.set))}catch(t){console.log(t)}}),this.result.dataInitResult=t.dataInitResult,this.result.headers=t.headers,this.result.cookies=t.testCaseDetail.cookies,this.result.requestBody=t.testCaseDetail.requestBody,t.checkResponseCode?this.result.checkResponseCode=t.checkResponseCode:this.result.checkResponseCode="无",t.checkSpendSeconds?this.result.checkSpendSeconds=t.checkSpendSeconds+" s":this.result.checkSpendSeconds="无",!t.checkResponseBody||1===t.checkResponseBody&&""==t.checkResponseBody[0].regex.trim()?this.result.checkResponseBody="无":this.result.checkResponseBody=t.checkResponseBody,this.result.result=t.status,this.result.responseStatusCode=t.responseStatusCode;try{this.result.responseData=JSON.parse(t.responseData)}catch(e){this.result.responseData=t.responseData}this.result.testConclusion=t.testConclusion,this.result.testStartTime=n()(t.testStartTime).format("YYYY年MM月DD日HH时mm分ss秒"),this.result.spendTimeInSec=t.spendTimeInSec,this.result.elapsedSeconds=t.elapsedSeconds,this.showDetailDialog=!0}},mounted:function(){this.reportChart=r.a.init(document.getElementById("report-chart")),this.setChartOptions(this.testReport.passCount,this.testReport.failCount,this.testReport.errorCount)},watch:{testReport:{handler:function(t,e){this.setChartOptions(t.passCount,t.failCount,t.errorCount)},deep:!0}},beforeDestroy:function(){this.reportChart&&(this.reportChart.dispose(),this.reportChart=null)},created:function(){this.getReport()}},d={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("section",{staticClass:"report"},[a("el-row",[a("el-col",{staticClass:"title",attrs:{span:24}},[a("span",[t._v(t._s(t.$route.meta.title)+" ")]),t._v(" "),a("span",{staticClass:"report-id"},[t._v("- ID: "+t._s(t.$route.params.report_id))]),t._v(" "),t.testReport.executionUser?a("span",{staticClass:"execution-info"},[t._v("执行人："+t._s(t.testReport.executionUser))]):t._e(),t._v(" "),t.testReport.cronJobId?a("span",{staticClass:"execution-info"},[t._v("定时任务："+t._s(t.testReport.cronJobId))]):t._e()])],1),t._v(" "),a("el-row",{staticClass:"report-basic"},[a("el-col",{attrs:{span:10}},[a("el-col",{staticStyle:{width:"160px"}},[a("span",{staticStyle:{"text-align":"left","font-size":"18px","font-weight":"bold"}},[t._v("测试基本信息")])]),t._v(" "),a("table",{staticStyle:{"margin-right":"30px",width:"70%",height:"12px"}},[a("tbody",[a("tr",{staticClass:"info"},[a("td",{staticClass:"label"},[t._v("测试环境")]),t._v(" "),a("td",{staticClass:"text-center"},[t._v(t._s(t.testReport.testEnvName))])]),t._v(" "),a("tr",{staticClass:"info"},[a("td",{staticClass:"label"},[t._v("开始时间")]),t._v(" "),a("td",{staticClass:"text-center"},[t._v(t._s(t.testReport.testStartTime))])]),t._v(" "),a("tr",{staticClass:"info"},[a("td",{staticClass:"label"},[t._v("测试用时")]),t._v(" "),a("td",{staticClass:"text-center"},[t._v(t._s(t.testReport.spendTimeInSec)+" s")])]),t._v(" "),a("tr",{staticClass:"info"},[a("td",{staticClass:"label"},[t._v("总用例数")]),t._v(" "),a("td",{staticClass:"text-center"},[t._v(t._s(t.testReport.totalCount))])]),t._v(" "),a("tr",{staticClass:"info"},[a("td",{staticClass:"label"},[t._v("通过数")]),t._v(" "),a("td",{staticClass:"text-center"},[t._v(t._s(t.testReport.passCount))])]),t._v(" "),a("tr",{staticClass:"info"},[a("td",{staticClass:"label"},[t._v("失败数")]),t._v(" "),a("td",{staticClass:"text-center"},[t._v(t._s(t.testReport.failCount))])]),t._v(" "),a("tr",{staticClass:"info"},[a("td",{staticClass:"label"},[t._v("错误数")]),t._v(" "),a("td",{staticClass:"text-center"},[t._v(t._s(t.testReport.errorCount))])]),t._v(" "),a("tr",{staticClass:"info"},[a("td",{staticClass:"label"},[t._v("通过率")]),t._v(" "),a("td",{staticClass:"text-center"},[t._v(t._s(t.getPassRate(t.testReport.passCount,t.testReport.totalCount,!0)))])])])])],1),t._v(" "),a("el-col",{attrs:{span:10}},[a("div",{staticStyle:{height:"230px",width:"100%"},attrs:{id:"report-chart"}})])],1),t._v(" "),a("el-row",[a("el-table",{staticStyle:{width:"100%"},attrs:{data:t.testSuites,"highlight-current-row":""}},[a("el-table-column",{attrs:{prop:"suiteName",label:"用例组名","min-width":"10%","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"testStartTime",label:"开始时间","min-width":"12%",sortable:"custom","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"spendTimeInSec",label:"用时(秒)","min-width":"10%",sortable:"custom","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"totalCount",label:"总数","min-width":"8%","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"passCount",label:"通过数","min-width":"8%","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"failCount",label:"失败数","min-width":"8%","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"errorCount",label:"错误数","min-width":"8%","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"passRate",label:"通过率","min-width":"10%","show-overflow-tooltip":""},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v("\n          "+t._s(t.getPassRate(e.row.passCount,e.row.totalCount,!0))+"\n        ")]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"status",label:"测试结果","min-width":"10%"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("img",{directives:[{name:"show",rawName:"v-show",value:e.row.totalCount==e.row.passCount,expression:"scope.row.totalCount==scope.row.passCount"}],attrs:{src:s("7shL")}}),t._v(" "),a("img",{directives:[{name:"show",rawName:"v-show",value:e.row.totalCount>e.row.passCount,expression:"scope.row.totalCount>scope.row.passCount"}],attrs:{src:s("IT+J")}})]}}])}),t._v(" "),a("el-table-column",{attrs:{type:"expand"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-table",{staticStyle:{width:"100%"},attrs:{data:e.row.testCaseReports,"highlight-current-row":""}},[a("el-table-column",{attrs:{label:"序号",prop:"",width:"50",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v("\n                "+t._s(e.$index+1)+"\n              ")]}}],null,!0)}),t._v(" "),a("el-table-column",{attrs:{prop:"resultDetail.name",label:"用例名","min-width":"15%","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"resultDetail.testCaseDetail.requestMethod",label:"Method","min-width":"8%","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"resultDetail.testCaseDetail.url",label:"URL","min-width":"25%","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"headers",label:"Headers","min-width":"8%","show-overflow-tooltip":""},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v("\n                "+t._s(e.row.resultDetail.headers)+"\n              ")]}}],null,!0)}),t._v(" "),a("el-table-column",{attrs:{prop:"requestBody",label:"请求参数","min-width":"8%","show-overflow-tooltip":""},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v("\n                "+t._s(e.row.resultDetail.testCaseDetail.requestBody)+"\n              ")]}}],null,!0)}),t._v(" "),a("el-table-column",{attrs:{prop:"resultDetail.responseStatusCode",label:"返回状态","min-width":"8%","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"resultDetail.responseData",label:"返回值","min-width":"8%","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"status",label:"结果","min-width":"5%"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("img",{directives:[{name:"show",rawName:"v-show",value:"ok"===e.row.resultDetail.status,expression:"scope.row.resultDetail.status==='ok'"}],attrs:{src:s("7shL")}}),t._v(" "),a("img",{directives:[{name:"show",rawName:"v-show",value:"failed"===e.row.resultDetail.status,expression:"scope.row.resultDetail.status==='failed'"}],attrs:{src:s("IT+J")}})]}}],null,!0)}),t._v(" "),a("el-table-column",{attrs:{prop:"resultDetail.testStartTime",label:"开始时间","min-width":"10%","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"resultDetail.spendTimeInSec",label:"用时(s)","min-width":"8%","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{label:"操作","min-width":"10%"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(s){return t.showDetail(e.row.resultDetail)}}},[t._v("查看详情")])]}}],null,!0)})],1)]}}])})],1)],1),t._v(" "),a("el-dialog",{attrs:{title:"测试结果",visible:t.showDetailDialog,"close-on-click-modal":!1},on:{"update:visible":function(e){t.showDetailDialog=e}}},[a("div",{staticClass:"header-title",attrs:{slot:"title"},slot:"title"},[a("span",{staticStyle:{"font-size":"28px"}},[t._v("测试结果")]),t._v(" "),a("span",{directives:[{name:"show",rawName:"v-show",value:t.result.name,expression:"result.name"}],staticStyle:{"font-size":"20px"}},[t._v(" - "+t._s(t.result.name))])]),t._v(" "),a("div",{staticClass:"test-result-dialog"},[a("div",[t._v("请求地址 : "+t._s(t.result.url))]),t._v(" "),a("div",[t._v("请求方式 : "+t._s(t.result.requestMethod))]),t._v(" "),a("div",[t._v("请求开始时间 : "+t._s(t.result.testStartTime))]),t._v(" "),a("div",[t._v("延迟调用时间 : "+t._s(t.result.delaySeconds)+"s")]),t._v(" "),a("div",[t._v("请求所用时间 : "+t._s(t.result.elapsedSeconds)+"s")]),t._v(" "),a("div",[t._v("用例执行时间 : "+t._s(t.result.spendTimeInSec)+"s")]),t._v(" "),a("div",{staticClass:"divider-line"}),t._v(" "),a("div",{staticStyle:{"font-size":"25px"}},[t._v("测试结论:")]),t._v(" "),t._l(t.result.testConclusion,function(e,s){return a("div",{directives:[{name:"show",rawName:"v-show",value:t.result.testConclusion,expression:"result.testConclusion"}],key:s,staticStyle:{overflow:"auto","overflow-x":"hidden",border:"1px solid #e6e6e6",padding:"10px",width:"88%","word-break":"break-all","line-height":"25px"}},[t._v("\n        结论："+t._s(e.resultType)+" "),a("br"),t._v("\n        原因："+t._s(e.reason)+"\n      ")])}),t._v(" "),a("div",{directives:[{name:"show",rawName:"v-show",value:!t.result.testConclusion,expression:"!result.testConclusion"}],staticStyle:{overflow:"auto","overflow-x":"hidden",border:"1px solid #e6e6e6",padding:"10px",width:"90%","word-break":"break-all","line-height":"25px","text-align":"center"}},[t._v("\n        无测试结论\n      ")]),t._v(" "),a("div",{staticClass:"divider-line"}),t._v(" "),a("div",{staticStyle:{"font-size":"25px"}},[t._v("数据初始化:")]),t._v(" "),t._l(t.result.dataInitResult,function(e,s){return a("div",[a("pre",[t._v(t._s(e))])])}),t._v(" "),!t.result.dataInitResult||t.result.dataInitResult&&Object.keys(t.result.dataInitResult).length<=0?a("div",[t._v("\n        (无需数据初始化)\n      ")]):t._e(),t._v(" "),a("div",{staticClass:"divider-line"}),t._v(" "),a("div",{staticStyle:{"font-size":"25px"}},[t._v("请求头部:")]),t._v(" "),t._l(t.result.headers,function(e,s){return a("div",{key:s},[t._v(t._s(s)+":  "+t._s(e))])}),t._v(" "),!t.result.headers||t.result.headers&&Object.keys(t.result.headers).length<=0?a("div",[t._v("\n        (无任何header)\n      ")]):t._e(),t._v(" "),a("div",{staticClass:"divider-line"}),t._v(" "),a("div",{staticStyle:{"font-size":"25px"}},[t._v("Cookies:")]),t._v(" "),t._l(t.result.cookies,function(e,s){return a("div",[t._v(t._s(e.name)+" = "+t._s(e.value))])}),t._v(" "),!t.result.cookies||t.result.cookies&&t.result.cookies.length<=0?a("div",[t._v("(无任何Cookie)\n      ")]):t._e(),t._v(" "),a("div",{staticClass:"divider-line"}),t._v(" "),a("div",{staticStyle:{"font-size":"25px"}},[t._v("请求参数:")]),t._v(" "),a("div",{directives:[{name:"show",rawName:"v-show",value:t.result.filePath,expression:"result.filePath"}]},[t._v("FilePath:  "+t._s(t.result.filePath))]),t._v(" "),a("div",{directives:[{name:"show",rawName:"v-show",value:t.result.requestBody,expression:"result.requestBody"}],staticClass:"resultStyle resultData"},[a("pre",[t._v(t._s(t.result.requestBody))])]),t._v(" "),a("div",{directives:[{name:"show",rawName:"v-show",value:!t.result.requestBody,expression:"!result.requestBody"}],staticClass:"resultStyle resultData"},[t._v("无")]),t._v(" "),a("div",{staticClass:"divider-line"}),t._v(" "),a("div",{staticStyle:{"font-size":"25px"}},[t._v("预期结果:")]),t._v(" "),a("div",[t._v("HTTP状态码: "+t._s(t.result.checkResponseCode))]),t._v(" "),a("div",[t._v("请求耗时: "+t._s(t.result.checkSpendSeconds))]),t._v(" "),a("div",[t._v("JSON正则校验:\n        "),a("pre",[t._v(t._s(t.result.checkResponseBody))]),t._v(" "),a("span",{directives:[{name:"show",rawName:"v-show",value:!t.result.checkResponseBody,expression:"!result.checkResponseBody"}]},[t._v("(无)")])]),t._v(" "),a("div",{staticClass:"divider-line"}),t._v(" "),a("div",{staticStyle:{"font-size":"25px"}},[t._v("实际结果:")]),t._v(" "),a("div",[t._v("HTTP状态码: "+t._s(t.result.responseStatusCode))]),t._v(" "),a("div",[t._v("请求耗时: "+t._s(t.result.elapsedSeconds)+"s")]),t._v(" "),a("div",[t._v("实际返回内容:")]),t._v(" "),a("div",{directives:[{name:"show",rawName:"v-show",value:t.result.responseData,expression:"result.responseData"}],staticClass:"resultStyle resultData"},[a("pre",[t._v(t._s(t.result.responseData))])]),t._v(" "),a("div",{directives:[{name:"show",rawName:"v-show",value:!t.result.responseData,expression:"!result.responseData"}],staticClass:"resultStyle resultData"},[t._v("(无返回内容)")])],2)])],1)},staticRenderFns:[]};var v=s("VU/8")(c,d,!1,function(t){s("9Jqq")},"data-v-0bf1ab72",null);e.default=v.exports},TmV0:function(t,e,s){s("fZOM"),t.exports=s("FeBl").Object.values},fZOM:function(t,e,s){var a=s("kM2E"),o=s("mbce")(!1);a(a.S,"Object",{values:function(t){return o(t)}})},gRE1:function(t,e,s){t.exports={default:s("TmV0"),__esModule:!0}},mbce:function(t,e,s){var a=s("+E39"),o=s("lktj"),l=s("TcQ7"),r=s("NpIQ").f;t.exports=function(t){return function(e){for(var s,i=l(e),n=o(i),u=n.length,c=0,d=[];u>c;)s=n[c++],a&&!r.call(i,s)||d.push(t?[s,i[s]]:i[s]);return d}}}});
  //# sourceMappingURL=2.fabf222f2a0ab1c88bd2.js.map