fix(接口测试): 定义-CASE-修复取消关注用例接口掉错的缺陷

--bug=1049149 --user=吕梦园
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001049149
This commit is contained in:
teukkk 2024-11-20 15:49:18 +08:00 committed by 刘瑞斌
parent 8c42da56c2
commit 1e10d0521c
3 changed files with 21 additions and 4 deletions

View File

@ -93,6 +93,7 @@ import {
SwitchDefinitionScheduleUrl, SwitchDefinitionScheduleUrl,
ToggleFollowCaseUrl, ToggleFollowCaseUrl,
ToggleFollowDefinitionUrl, ToggleFollowDefinitionUrl,
ToggleUnFollowCaseUrl,
TransferFileCaseUrl, TransferFileCaseUrl,
TransferFileModuleOptionCaseUrl, TransferFileModuleOptionCaseUrl,
TransferFileModuleOptionUrl, TransferFileModuleOptionUrl,
@ -550,11 +551,16 @@ export function getCaseDetail(id: string) {
return MSR.get<ApiCaseDetail>({ url: GetCaseDetailUrl, params: id }); return MSR.get<ApiCaseDetail>({ url: GetCaseDetailUrl, params: id });
} }
// 关注/取消关注接口用例 // 关注接口用例
export function toggleFollowCase(id: string | number) { export function toggleFollowCase(id: string | number) {
return MSR.get({ url: ToggleFollowCaseUrl, params: id }); return MSR.get({ url: ToggleFollowCaseUrl, params: id });
} }
// 取消关注接口用例
export function toggleUnFollowCase(id: string | number) {
return MSR.get({ url: ToggleUnFollowCaseUrl, params: id });
}
// 用例执行,传请求详情执行 // 用例执行,传请求详情执行
export function runCase(data: ExecuteRequestParams) { export function runCase(data: ExecuteRequestParams) {
return MSR.post({ url: RunCaseUrl, data }); return MSR.post({ url: RunCaseUrl, data });

View File

@ -92,7 +92,8 @@ export const ExecuteCaseUrl = '/api/case/run'; // 单独执行接口用例
export const GetExecuteHistoryUrl = '/api/case/execute/page'; // 获取用的执行历史 export const GetExecuteHistoryUrl = '/api/case/execute/page'; // 获取用的执行历史
export const GetDependencyUrl = '/api/case/get-reference'; // 获取用例的依赖关系 export const GetDependencyUrl = '/api/case/get-reference'; // 获取用例的依赖关系
export const GetChangeHistoryUrl = '/api/case/operation-history/page'; // 获取用例的依赖关系 export const GetChangeHistoryUrl = '/api/case/operation-history/page'; // 获取用例的依赖关系
export const ToggleFollowCaseUrl = '/api/case/follow'; // 接口定义-关注/取消关注 export const ToggleFollowCaseUrl = '/api/case/follow'; // 接口用例-关注
export const ToggleUnFollowCaseUrl = '/api/case/unfollow'; // 接口用例-取消关注
export const RunCaseUrl = '/api/case/run'; // 执行接口用例 export const RunCaseUrl = '/api/case/run'; // 执行接口用例
export const GetCaseReportByIdUrl = '/api/report/case/get/'; // 接口用例报告获取 export const GetCaseReportByIdUrl = '/api/report/case/get/'; // 接口用例报告获取
export const GetCaseReportDetailUrl = '/api/report/case/get/detail/'; // 接口用例报告获取 export const GetCaseReportDetailUrl = '/api/report/case/get/detail/'; // 接口用例报告获取

View File

@ -139,7 +139,13 @@
import TabCaseExecuteHistory from '@/views/api-test/management/components/management/case/tabContent/tabCaseExecuteHistory.vue'; import TabCaseExecuteHistory from '@/views/api-test/management/components/management/case/tabContent/tabCaseExecuteHistory.vue';
import { localExecuteApiDebug, stopLocalExecute } from '@/api/modules/api-test/common'; import { localExecuteApiDebug, stopLocalExecute } from '@/api/modules/api-test/common';
import { debugCase, deleteCase, runCase, toggleFollowCase } from '@/api/modules/api-test/management'; import {
debugCase,
deleteCase,
runCase,
toggleFollowCase,
toggleUnFollowCase,
} from '@/api/modules/api-test/management';
import { projectStopTask } from '@/api/modules/taskCenter/project'; import { projectStopTask } from '@/api/modules/taskCenter/project';
import useModal from '@/hooks/useModal'; import useModal from '@/hooks/useModal';
import useWebsocket from '@/hooks/useWebsocket'; import useWebsocket from '@/hooks/useWebsocket';
@ -200,7 +206,11 @@
async function follow() { async function follow() {
try { try {
followLoading.value = true; followLoading.value = true;
if (caseDetail.value.follow) {
await toggleUnFollowCase(caseDetail.value.id);
} else {
await toggleFollowCase(caseDetail.value.id); await toggleFollowCase(caseDetail.value.id);
}
Message.success(caseDetail.value.follow ? t('common.unFollowSuccess') : t('common.followSuccess')); Message.success(caseDetail.value.follow ? t('common.unFollowSuccess') : t('common.followSuccess'));
caseDetail.value.follow = !caseDetail.value.follow; caseDetail.value.follow = !caseDetail.value.follow;
emit('updateFollow'); emit('updateFollow');