fix(接口测试): 接口用例停止执行

This commit is contained in:
baiqi 2024-10-29 14:26:27 +08:00 committed by Craftsman
parent 0e64f1ca53
commit 662d78ed17
1 changed files with 5 additions and 2 deletions

View File

@ -138,8 +138,9 @@
import TabCaseDependency from '@/views/api-test/management/components/management/case/tabContent/tabCaseDependency.vue'; import TabCaseDependency from '@/views/api-test/management/components/management/case/tabContent/tabCaseDependency.vue';
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, stopExecute, 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 } from '@/api/modules/api-test/management';
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';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
@ -304,6 +305,7 @@
await createSocket(); await createSocket();
websocket.value = _websocket.value; websocket.value = _websocket.value;
} }
const executeTaskId = ref('');
async function handleExecute(executeType?: 'localExec' | 'serverExec') { async function handleExecute(executeType?: 'localExec' | 'serverExec') {
try { try {
caseDetail.value.executeLoading = true; caseDetail.value.executeLoading = true;
@ -332,6 +334,7 @@
if (executeType === 'localExec') { if (executeType === 'localExec') {
await localExecuteApiDebug(executeRef.value?.localExecuteUrl as string, res); await localExecuteApiDebug(executeRef.value?.localExecuteUrl as string, res);
} }
executeTaskId.value = res.taskInfo?.taskId;
// //
executeHistoryRef.value?.loadExecuteList(); executeHistoryRef.value?.loadExecuteList();
} catch (error) { } catch (error) {
@ -346,7 +349,7 @@
if (caseDetail.value.frontendDebug) { if (caseDetail.value.frontendDebug) {
await stopLocalExecute(executeRef.value?.localExecuteUrl || '', reportId.value, ScenarioStepType.API_CASE); await stopLocalExecute(executeRef.value?.localExecuteUrl || '', reportId.value, ScenarioStepType.API_CASE);
} else { } else {
await stopExecute(reportId.value, ScenarioStepType.API_CASE); await projectStopTask(executeTaskId.value);
} }
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console