fix(测试计划): 修复测试计划跳转场景提示场景被删除的缺陷

--bug=1019236 --user=王孝刚 【测试跟踪】测试计划-场景用例列表-执行单个场景后报告链接跳转提示报告被删除
https://www.tapd.cn/55049933/s/1285572
This commit is contained in:
wxg0103 2022-11-01 17:58:58 +08:00 committed by wxg0103
parent c394ca8576
commit 68ccaa2a1f
4 changed files with 31 additions and 5 deletions

View File

@ -123,4 +123,9 @@ public class TestPlanScenarioCaseController {
public void orderCase(@RequestBody ResetOrderRequest request) { public void orderCase(@RequestBody ResetOrderRequest request) {
testPlanScenarioCaseService.updateOrder(request); testPlanScenarioCaseService.updateOrder(request);
} }
@GetMapping("/get-scenario-id/{id}")
public String getScenarioId(@PathVariable("id") String planScenarioId) {
return testPlanScenarioCaseService.getScenarioId(planScenarioId);
}
} }

View File

@ -654,4 +654,12 @@ public class TestPlanScenarioCaseService {
extTestPlanScenarioCaseMapper.getFailureList(planId, "unExecute"); extTestPlanScenarioCaseMapper.getFailureList(planId, "unExecute");
return buildCases(apiTestCases); return buildCases(apiTestCases);
} }
public String getScenarioId(String planScenarioId) {
TestPlanApiScenario planApiScenario = testPlanApiScenarioMapper.selectByPrimaryKey(planScenarioId);
if (planApiScenario != null) {
return planApiScenario.getApiScenarioId();
}
return planScenarioId;
}
} }

View File

@ -82,6 +82,7 @@
import {generateShareInfoWithExpired} from "@/network/share"; import {generateShareInfoWithExpired} from "@/network/share";
import {getCurrentProjectID, getCurrentWorkspaceId, getUUID} from "@/common/js/utils"; import {getCurrentProjectID, getCurrentWorkspaceId, getUUID} from "@/common/js/utils";
import MsTag from "@/business/components/common/components/MsTag"; import MsTag from "@/business/components/common/components/MsTag";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const UiDownloadScreenshot = requireComponent.keys().length > 0 ? requireComponent("./ui/automation/report/UiDownloadScreenshot.vue") : {}; const UiDownloadScreenshot = requireComponent.keys().length > 0 ? requireComponent("./ui/automation/report/UiDownloadScreenshot.vue") : {};
@ -155,6 +156,18 @@ export default {
$event.target.blur(); $event.target.blur();
}, },
redirect() { redirect() {
let resourceId = this.scenarioId;
if (this.isPlan) {
this.$get('/test/plan/scenario/case/get-scenario-id/' + resourceId , res => {
resourceId = res.data;
this.showDetail(resourceId);
});
} else {
resourceId = this.scenarioId;
this.showDetail(resourceId);
}
},
showDetail(resourceId) {
let data = this.$router.resolve({ let data = this.$router.resolve({
name: this.isUi ? 'uiAutomation' : 'ApiAutomation', name: this.isUi ? 'uiAutomation' : 'ApiAutomation',
query: { query: {
@ -162,7 +175,7 @@ export default {
dataType: "scenario", dataType: "scenario",
projectId: getCurrentProjectID(), projectId: getCurrentProjectID(),
workspaceId: getCurrentWorkspaceId(), workspaceId: getCurrentWorkspaceId(),
resourceId: this.scenarioId resourceId: resourceId
} }
}); });
window.open(data.href, '_blank'); window.open(data.href, '_blank');

View File

@ -186,7 +186,7 @@
<!-- 执行结果 --> <!-- 执行结果 -->
<el-drawer :visible.sync="runVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false" <el-drawer :visible.sync="runVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false"
size="90%"> size="90%">
<ms-api-report-detail @invisible="runVisible = false" @refresh="search" :infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId"/> <ms-api-report-detail @invisible="runVisible = false" @refresh="search" :infoDb="infoDb" :report-id="reportId" :currentProjectId="projectId" :is-plan="true"/>
</el-drawer> </el-drawer>
</div> </div>
</el-card> </el-card>