fix(接口测试): 引用场景被删除后子步骤禁用执行

--bug=1029088 --user=赵勇 【接口测试】场景详情-引用原场景被删除-单步骤调试引用场景下子步骤-一直测试中-无法停止 https://www.tapd.cn/55049933/s/1408973

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2023-08-28 16:24:16 +08:00 committed by fit2-zhao
parent d1218645ea
commit 983faa8168
4 changed files with 34 additions and 27 deletions

View File

@ -89,7 +89,7 @@
<template v-slot:button v-if="!ifFromVariableAdvance"> <template v-slot:button v-if="!ifFromVariableAdvance">
<el-tooltip :content="$t('api_test.run')" placement="top" v-if="!request.testing"> <el-tooltip :content="$t('api_test.run')" placement="top" v-if="!request.testing">
<el-button <el-button
:disabled="!request.enable" :disabled="!request.enable || request.deleted"
@click="run" @click="run"
icon="el-icon-video-play" icon="el-icon-video-play"
class="ms-btn" class="ms-btn"

View File

@ -75,7 +75,7 @@
<template v-slot:button v-if="!ifFromVariableAdvance"> <template v-slot:button v-if="!ifFromVariableAdvance">
<el-tooltip :content="$t('api_test.run')" placement="top" v-if="!scenario.run"> <el-tooltip :content="$t('api_test.run')" placement="top" v-if="!scenario.run">
<el-button <el-button
:disabled="!scenario.enable" :disabled="stepDisabled()"
@click="run" @click="run"
icon="el-icon-video-play" icon="el-icon-video-play"
style="padding: 5px" style="padding: 5px"
@ -160,11 +160,13 @@ export default {
}, },
}, },
created() { created() {
this.isShowNum = this.scenario.num ? true : false; this.isShowNum = !!this.scenario.num;
if (this.scenario.id && this.scenario.referenced === 'REF' && !this.scenario.loaded && this.scenario.hashTree) { if (
(this.scenario.id && this.scenario.referenced === 'REF' && !this.scenario.loaded && this.scenario.hashTree) ||
this.refStepDeleted
) {
this.scenario.disabled = true; this.scenario.disabled = true;
this.scenario.showExtend = this.scenario.showExtend = !(this.node.parent && this.node.parent.data && this.node.parent.data.disabled);
this.node.parent && this.node.parent.data && this.node.parent.data.disabled ? false : true;
this.recursiveEnable(this.scenario.hashTree); this.recursiveEnable(this.scenario.hashTree);
} }
if (this.scenario.id && this.scenario.referenced === 'Copy' && !this.scenario.isCopy && !this.scenario.disabled) { if (this.scenario.id && this.scenario.referenced === 'Copy' && !this.scenario.isCopy && !this.scenario.disabled) {
@ -191,8 +193,14 @@ export default {
isDeletedOrRef() { isDeletedOrRef() {
return (this.scenario.referenced && this.scenario.referenced === 'Deleted') || this.scenario.referenced === 'REF'; return (this.scenario.referenced && this.scenario.referenced === 'Deleted') || this.scenario.referenced === 'REF';
}, },
refStepDeleted() {
return this.scenario.referenced === 'REF' && !this.isShowNum;
},
}, },
methods: { methods: {
stepDisabled() {
return !this.scenario.enable || this.refStepDeleted || this.scenario.deleted === 'Deleted';
},
run() { run() {
if (!this.scenario.enable) { if (!this.scenario.enable) {
this.$warning(this.$t('api_test.automation.debug_message')); this.$warning(this.$t('api_test.automation.debug_message'));
@ -283,6 +291,7 @@ export default {
for (let i in arr) { for (let i in arr) {
arr[i].disabled = true; arr[i].disabled = true;
arr[i].caseEnable = true; arr[i].caseEnable = true;
arr[i].deleted = this.refStepDeleted;
if (arr[i].hashTree && arr[i].hashTree.length > 0) { if (arr[i].hashTree && arr[i].hashTree.length > 0) {
this.recursiveEnable(arr[i].hashTree); this.recursiveEnable(arr[i].hashTree);
} }

View File

@ -63,7 +63,7 @@
<template v-slot:button> <template v-slot:button>
<el-button <el-button
:disabled="!controller.enable" :disabled="!controller.enable || controller.deleted"
:tip="$t('api_test.run')" :tip="$t('api_test.run')"
@click="conn" @click="conn"
icon="el-icon-video-play" icon="el-icon-video-play"
@ -75,7 +75,7 @@
<el-row> <el-row>
<el-col :span="9"> <el-col :span="9">
<span class="ms-span ms-radio">{{ $t('loop.loops') }}</span> <span class="ms-span ms-radio">{{ $t('loop.loops') }}</span>
<el-input size="small" v-model="controller.countController.loops" style="width: auto"/> <el-input size="small" v-model="controller.countController.loops" style="width: auto" />
<span class="ms-span ms-radio"></span> <span class="ms-span ms-radio"></span>
</el-col> </el-col>
<el-col :span="9"> <el-col :span="9">
@ -91,13 +91,13 @@
<span class="ms-span ms-radio">ms</span> <span class="ms-span ms-radio">ms</span>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-switch <el-switch
:inactive-text="$t('loop.proceed')" :inactive-text="$t('loop.proceed')"
:disabled="controller.disabled" :disabled="controller.disabled"
v-model="controller.countController.proceed" v-model="controller.countController.proceed"
class="ms-span ms-radio" class="ms-span ms-radio"
style="margin-top: 6px" style="margin-top: 6px"
@change="switchChange" /> @change="switchChange" />
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
@ -177,17 +177,13 @@
<span <span
class="ms-step-debug-code" class="ms-step-debug-code"
:class="'ms-req-error-report'" :class="'ms-req-error-report'"
v-if=" v-if="!loading && !node.data.testing && node.data.debug && node.data.code === 'FAKE_ERROR'">
!loading && !node.data.testing && node.data.debug &&
node.data.code === 'FAKE_ERROR'
">
FakeError FakeError
</span> </span>
<span <span
class="ms-step-debug-code" class="ms-step-debug-code"
:class="node.data.code && node.data.code.toUpperCase() === 'ERROR' ? 'ms-req-error' : 'ms-req-success'" :class="node.data.code && node.data.code.toUpperCase() === 'ERROR' ? 'ms-req-error' : 'ms-req-success'"
v-if="!loading && !node.data.testing && node.data.debug && v-if="!loading && !node.data.testing && node.data.debug && node.data.code !== 'FAKE_ERROR'">
node.data.code !== 'FAKE_ERROR'">
{{ getCode() }} {{ getCode() }}
</span> </span>
</template> </template>
@ -345,12 +341,14 @@ export default {
if (!this.node.data.code) { if (!this.node.data.code) {
this.node.data.code = 'SUCCESS'; this.node.data.code = 'SUCCESS';
} }
if (this.node.data.code ==='SUCCESS' && data.status && data.status === 'SUCCESS') { if (this.node.data.code === 'SUCCESS' && data.status && data.status === 'SUCCESS') {
this.node.data.code = 'SUCCESS'; this.node.data.code = 'SUCCESS';
} }
if ((this.node.data.code ==='SUCCESS' || if (
this.node.data.code === 'FAKE_ERROR') && (this.node.data.code === 'SUCCESS' || this.node.data.code === 'FAKE_ERROR') &&
data.status && data.status === 'FAKE_ERROR') { data.status &&
data.status === 'FAKE_ERROR'
) {
this.node.data.code = 'FAKE_ERROR'; this.node.data.code = 'FAKE_ERROR';
} }
if (data.status && data.status === 'ERROR') { if (data.status && data.status === 'ERROR') {
@ -513,7 +511,7 @@ export default {
font-size: 13px; font-size: 13px;
font-weight: normal; font-weight: normal;
} }
:deep(.el-switch__label *){ :deep(.el-switch__label *) {
color: #606266; color: #606266;
font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', Arial, sans-serif; font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', Arial, sans-serif;
font-size: 13px; font-size: 13px;

View File

@ -105,7 +105,7 @@
<template v-slot:button v-if="allSampler.indexOf(request.type) !== -1"> <template v-slot:button v-if="allSampler.indexOf(request.type) !== -1">
<el-tooltip :content="$t('api_test.run')" placement="top" v-if="!loading"> <el-tooltip :content="$t('api_test.run')" placement="top" v-if="!loading">
<el-button <el-button
:disabled="!request.enable" :disabled="!request.enable || request.deleted"
@click="run" @click="run"
icon="el-icon-video-play" icon="el-icon-video-play"
style="padding: 5px" style="padding: 5px"