Merge branch 'master' of github.com:metersphere/metersphere

This commit is contained in:
Captain.B 2020-12-24 14:24:58 +08:00
commit e929c0f6a9
7 changed files with 58 additions and 16 deletions

View File

@ -195,14 +195,23 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
} else { } else {
String[] sceneNameArr = scenaName.split("-"); String[] sceneNameArr = scenaName.split("-");
if (sceneNameArr.length >= 4) { if (sceneNameArr.length >= 4) {
//如果以yyyy-MM-dd 时间类型结尾
String endStr = "-" + sceneNameArr[sceneNameArr.length - 3] + "-" + sceneNameArr[sceneNameArr.length - 2] + "-" + sceneNameArr[sceneNameArr.length - 1]; String endStr = "-" + sceneNameArr[sceneNameArr.length - 3] + "-" + sceneNameArr[sceneNameArr.length - 2] + "-" + sceneNameArr[sceneNameArr.length - 1];
scenaName = scenaName.split(endStr)[0]; scenaName = scenaName.split(endStr)[0];
} else { } else {
//如果以时间戳结尾
scenaName = scenaName.split("-")[0]; scenaName = scenaName.split("-")[0];
} }
} }
ApiScenarioReport savedReport = apiScenarioReportService.get(testId);
String scenarioID = null;
if(savedReport!=null){
scenarioID = savedReport.getScenarioId();
}
if(scenarioID==null){
scenarioID = apiScenarioReportService.getApiScenarioId(scenaName, scenarioReport.getProjectId());
}
String scenarioID = apiScenarioReportService.getApiScenarioId(scenaName, scenarioReport.getProjectId());
testResult.setTestId(scenarioID); testResult.setTestId(scenarioID);
} else { } else {
apiTestService.changeStatus(testId, APITestStatus.Completed); apiTestService.changeStatus(testId, APITestStatus.Completed);

View File

@ -5,7 +5,7 @@
</el-link> </el-link>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="ref">{{ $t('api_test.automation.view_ref') }}</el-dropdown-item> <el-dropdown-item command="ref">{{ $t('api_test.automation.view_ref') }}</el-dropdown-item>
<el-dropdown-item command="schedule">{{ $t('api_test.automation.schedule') }}</el-dropdown-item> <el-dropdown-item command="schedule" v-tester>{{ $t('api_test.automation.schedule') }}</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
<ms-reference-view ref="viewRef"/> <ms-reference-view ref="viewRef"/>
<ms-schedule-maintain ref="scheduleMaintain" /> <ms-schedule-maintain ref="scheduleMaintain" />

View File

@ -10,7 +10,7 @@
prop="cronValue"> prop="cronValue">
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp" <el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
:placeholder="$t('schedule.please_input_cron_expression')"/> :placeholder="$t('schedule.please_input_cron_expression')"/>
<el-button :disabled="isReadOnly" type="primary" @click="saveCron">{{ <el-button :disabled="isReadOnly" type="primary" @click="saveCron" v-tester>{{
$t('commons.save') $t('commons.save')
}} }}
</el-button> </el-button>

View File

@ -6,10 +6,10 @@
🤔天凉了保温杯买了吗 🤔天凉了保温杯买了吗
</div> </div>
<div v-else-if="dateType==='2'"> <div v-else-if="dateType==='2'">
<el-link href="https://github.com/metersphere/metersphere/issues" target="_blank" type="primary">😔觉得MeterSphere不好用就来https://github.com/metersphere/metersphere/issues</el-link> 😔觉得MeterSphere不好用就来 <el-link href="https://github.com/metersphere/metersphere/issues" target="_blank" style="color: black" type="primary">https://github.com/metersphere/metersphere/issues</el-link>
</div> </div>
<div v-else-if="dateType==='3'"> <div v-else-if="dateType==='3'">
<el-link href="https://github.com/metersphere/metersphere" target="_blank" type="primary">😄觉得MeterSphere好用就来 https://github.com/metersphere/metersphere star</el-link> 😄觉得MeterSphere好用就来 <el-link href="https://github.com/metersphere/metersphere" target="_blank" style="color: black" type="primary">https://github.com/metersphere/metersphere</el-link> star
</div> </div>
<div v-else> <div v-else>
😊 MeterSphere温馨提醒 多喝热水哟 😊 MeterSphere温馨提醒 多喝热水哟

View File

@ -10,7 +10,7 @@
@dataChange="changePlan"/> @dataChange="changePlan"/>
</template> </template>
<template v-slot:menu> <template v-slot:menu>
<el-menu active-text-color="#6d317c" :default-active="activeIndex" <el-menu v-if="isMenuShow" active-text-color="#6d317c" :default-active="activeIndex"
class="el-menu-demo header-menu" mode="horizontal" @select="handleSelect"> class="el-menu-demo header-menu" mode="horizontal" @select="handleSelect">
<el-menu-item index="functional">功能测试用例</el-menu-item> <el-menu-item index="functional">功能测试用例</el-menu-item>
<el-menu-item index="api">接口测试用例</el-menu-item> <el-menu-item index="api">接口测试用例</el-menu-item>
@ -21,6 +21,9 @@
<test-plan-functional v-if="activeIndex === 'functional'" :plan-id="planId"/> <test-plan-functional v-if="activeIndex === 'functional'" :plan-id="planId"/>
<test-plan-api v-if="activeIndex === 'api'" :plan-id="planId"/> <test-plan-api v-if="activeIndex === 'api'" :plan-id="planId"/>
<test-case-statistics-report-view :test-plan="currentPlan" v-if="activeIndex === 'report'"/> <test-case-statistics-report-view :test-plan="currentPlan" v-if="activeIndex === 'report'"/>
<test-report-template-list @openReport="openReport" ref="testReportTemplateList"/>
</div> </div>
</template> </template>
@ -38,10 +41,12 @@
import TestPlanFunctional from "./comonents/functional/TestPlanFunctional"; import TestPlanFunctional from "./comonents/functional/TestPlanFunctional";
import TestPlanApi from "./comonents/api/TestPlanApi"; import TestPlanApi from "./comonents/api/TestPlanApi";
import TestCaseStatisticsReportView from "./comonents/report/statistics/TestCaseStatisticsReportView"; import TestCaseStatisticsReportView from "./comonents/report/statistics/TestCaseStatisticsReportView";
import TestReportTemplateList from "./comonents/TestReportTemplateList";
export default { export default {
name: "TestPlanView", name: "TestPlanView",
components: { components: {
TestReportTemplateList,
TestCaseStatisticsReportView, TestCaseStatisticsReportView,
TestPlanApi, TestPlanApi,
TestPlanFunctional, TestPlanFunctional,
@ -52,7 +57,8 @@
return { return {
testPlans: [], testPlans: [],
currentPlan: {}, currentPlan: {},
activeIndex: "functional" activeIndex: "functional",
isMenuShow: true
} }
}, },
computed: { computed: {
@ -62,6 +68,7 @@
}, },
watch: { watch: {
'$route.params.planId'() { '$route.params.planId'() {
this.activeIndex = "functional";
this.getTestPlans(); this.getTestPlans();
} }
}, },
@ -85,8 +92,23 @@
}, },
handleSelect(key) { handleSelect(key) {
this.activeIndex = key; this.activeIndex = key;
if (key === 'report' && !this.currentPlan.reportId) {
this.$refs.testReportTemplateList.open(this.planId);
}
},
openTemplateReport() {
this.$refs.testReportTemplateList.open(this.planId);
},
openReport(planId, id) {
this.currentPlan.reportId = id;
},
reloadMenu() {
this.isMenuShow = false;
this.$nextTick(() => {
this.isMenuShow = true;
});
} }
} },
} }
</script> </script>

View File

@ -2,6 +2,7 @@
<el-dialog :title="$t('test_track.plan_view.select_template')" <el-dialog :title="$t('test_track.plan_view.select_template')"
:visible.sync="templateVisible" :visible.sync="templateVisible"
class="report-template-list"
width="50%"> width="50%">
<el-main> <el-main>
@ -59,4 +60,7 @@
display: none; display: none;
} }
.report-template-list {
text-align: left;
}
</style> </style>

View File

@ -1,16 +1,15 @@
<template> <template>
<div v-loading="result.loading"> <div v-loading="result.loading" :class="{'text-align': !reportId}">
<el-button v-if="!reportId" class="create-button" :disabled="!isTestManagerOrTestUser" plain size="mini" @click="openTemplateReport">
{{$t('test_track.plan_view.create_report')}}
</el-button>
<el-row type="flex" class="head-bar"> <el-row type="flex" class="head-bar">
<el-col :span="12"> <el-col :span="12">
</el-col> </el-col>
<el-col v-if="!reportId" :span="11" class="head-right"> <el-col v-if="reportId" :span="11" class="head-right">
<el-button :disabled="!isTestManagerOrTestUser" plain size="mini" @click="openTemplateReport">
{{$t('test_track.plan_view.create_report')}}
</el-button>
</el-col>
<el-col v-else :span="11" class="head-right">
<el-button :disabled="!isTestManagerOrTestUser" plain size="mini" @click="handleSave"> <el-button :disabled="!isTestManagerOrTestUser" plain size="mini" @click="handleSave">
{{$t('commons.save')}} {{$t('commons.save')}}
</el-button> </el-button>
@ -255,6 +254,14 @@
width: 80px; width: 80px;
} }
.text-align {
text-align: center;
}
.create-button {
margin: 20px auto;
}
.head-bar { .head-bar {
position: fixed; position: fixed;
right: 10px; right: 10px;