fix(接口测试): 修复场景无数据源执行错误问题

--bug=1012630 --user=赵勇 【接口测试】场景中添加自定义sql请求-勾选引用环境-运行环境从无数据源切换为有数据源的-保存后单独执行提示未选环境 https://www.tapd.cn/55049933/s/1146461
This commit is contained in:
fit2-zhao 2022-04-25 14:08:21 +08:00 committed by fit2-zhao
parent 6cfd429869
commit 5887adc932
14 changed files with 75 additions and 102 deletions

View File

@ -210,7 +210,6 @@
:scenario="data" :scenario="data"
:response="response" :response="response"
:currentScenario="currentScenario" :currentScenario="currentScenario"
:currentEnvironmentId="currentEnvironmentId"
:node="node" :node="node"
:project-list="projectList" :project-list="projectList"
:env-map="projectEnvMap" :env-map="projectEnvMap"
@ -463,7 +462,6 @@ export default {
], ],
}, },
environments: [], environments: [],
currentEnvironmentId: "",
maintainerOptions: [], maintainerOptions: [],
value: API_STATUS[0].id, value: API_STATUS[0].id,
options: API_STATUS, options: API_STATUS,
@ -1423,16 +1421,6 @@ export default {
this.environments.forEach(environment => { this.environments.forEach(environment => {
parseEnvironment(environment); parseEnvironment(environment);
}); });
let hasEnvironment = false;
for (let i in this.environments) {
if (this.environments[i].id === this.currentEnvironmentId) {
hasEnvironment = true;
break;
}
}
if (!hasEnvironment) {
this.currentEnvironmentId = '';
}
// //
this.checkDataIsCopy(); this.checkDataIsCopy();
}); });
@ -1576,7 +1564,6 @@ export default {
if (response.data.scenarioDefinition != null) { if (response.data.scenarioDefinition != null) {
let obj = JSON.parse(response.data.scenarioDefinition); let obj = JSON.parse(response.data.scenarioDefinition);
if (obj) { if (obj) {
this.currentEnvironmentId = obj.environmentId;
if (response.data.environmentJson) { if (response.data.environmentJson) {
this.projectEnvMap = objToStrMap(JSON.parse(response.data.environmentJson)); this.projectEnvMap = objToStrMap(JSON.parse(response.data.environmentJson));
} else { } else {

View File

@ -99,7 +99,7 @@ export default {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
isScenario: String, scenarioId: String,
isReadOnly: { isReadOnly: {
type: Boolean, type: Boolean,
default: false default: false
@ -117,7 +117,7 @@ export default {
} }
}, },
created() { created() {
if (!this.isScenario) { if (!this.scenarioId) {
this.request.environmentId = this.$store.state.useEnvironment; this.request.environmentId = this.$store.state.useEnvironment;
} }
this.getEnvironments(); this.getEnvironments();
@ -135,7 +135,7 @@ export default {
deep: true deep: true
}, },
'$store.state.useEnvironment': function () { '$store.state.useEnvironment': function () {
if (!this.isScenario) { if (!this.scenarioId) {
this.request.environmentId = this.$store.state.useEnvironment; this.request.environmentId = this.$store.state.useEnvironment;
this.getEnvironments(); this.getEnvironments();
} }
@ -186,15 +186,15 @@ export default {
getEnvironments() { getEnvironments() {
let envId = ""; let envId = "";
let id = this.request.projectId ? this.request.projectId : this.projectId; let id = this.request.projectId ? this.request.projectId : this.projectId;
let scenarioEnvId = this.isScenario ? (this.isScenario + "_" + id) : id; let scenarioEnvId = this.scenarioId ? (this.scenarioId + "_" + id) : id;
if (this.$store.state.scenarioEnvMap && this.$store.state.scenarioEnvMap instanceof Map if (this.$store.state.scenarioEnvMap && this.$store.state.scenarioEnvMap instanceof Map
&& this.$store.state.scenarioEnvMap.has(scenarioEnvId)) { && this.$store.state.scenarioEnvMap.has(scenarioEnvId)) {
envId = this.$store.state.scenarioEnvMap.get(scenarioEnvId); envId = this.$store.state.scenarioEnvMap.get(scenarioEnvId);
} }
if (this.request.referenced === 'Created' && this.isScenario && !this.request.isRefEnvironment) { if (this.request.referenced === 'Created' && this.scenarioId && !this.request.isRefEnvironment) {
this.itselfEnvironment(); this.itselfEnvironment();
return; return;
} else if (!this.isScenario && !this.request.customizeReq) { } else if (!this.scenarioId && !this.request.customizeReq) {
this.itselfEnvironment(); this.itselfEnvironment();
return; return;
} }

View File

@ -84,7 +84,7 @@
:isShowEnable="true" :isShowEnable="true"
:response="response" :response="response"
:referenced="true" :referenced="true"
:isScenario="currentScenario.id" :scenarioId="currentScenario.id"
:headers="request.headers " :headers="request.headers "
:is-read-only="isCompReadOnly" :is-read-only="isCompReadOnly"
:request="request"/> :request="request"/>
@ -101,21 +101,21 @@
:is-read-only="isCompReadOnly" :is-read-only="isCompReadOnly"
:response="response" :response="response"
:show-pre-script="true" :show-pre-script="true"
:isScenario="currentScenario.id" :scenarioId="currentScenario.id"
:show-script="true" :request="request"/> :show-script="true" :request="request"/>
<ms-sql-basis-parameters <ms-sql-basis-parameters
v-if="request.protocol==='SQL'|| request.type==='JDBCSampler'" v-if="request.protocol==='SQL'|| request.type==='JDBCSampler'"
:request="request" :request="request"
:response="response" :response="response"
:isScenario="currentScenario.id" :scenarioId="currentScenario.id"
:is-read-only="isCompReadOnly" :is-read-only="isCompReadOnly"
:showScript="true"/> :showScript="true"/>
<ms-dubbo-basis-parameters <ms-dubbo-basis-parameters
v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'|| request.type==='DubboSampler'" v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'|| request.type==='DubboSampler'"
:request="request" :request="request"
:isScenario="currentScenario.id" :scenarioId="currentScenario.id"
:response="response" :response="response"
:is-read-only="isCompReadOnly" :is-read-only="isCompReadOnly"
:showScript="true"/> :showScript="true"/>
@ -196,7 +196,6 @@ export default {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
currentEnvironmentId: String,
projectList: Array, projectList: Array,
envMap: Map, envMap: Map,
message: String, message: String,
@ -501,17 +500,18 @@ export default {
this.reload(); this.reload();
}, },
run() { run() {
let selectEnvId;
//
if (this.isApiImport || this.request.isRefEnvironment) { if (this.isApiImport || this.request.isRefEnvironment) {
if (this.request.type && (this.request.type === "HTTPSamplerProxy" || this.request.type === "JDBCSampler" || this.request.type === "TCPSampler")) { if (this.request.type && (this.request.type === "HTTPSamplerProxy" || this.request.type === "JDBCSampler" || this.request.type === "TCPSampler")) {
if (!this.environmentMap || this.environmentMap.size === 0) { if (this.$store.state.scenarioEnvMap && this.$store.state.scenarioEnvMap instanceof Map
&& this.$store.state.scenarioEnvMap.has((this.currentScenario.id + "_" + this.request.projectId))) {
selectEnvId = this.$store.state.scenarioEnvMap.get((this.currentScenario.id + "_" + this.request.projectId));
this.environmentMap = this.envMap;
}
if (!selectEnvId) {
this.$warning(this.$t('api_test.automation.env_message')); this.$warning(this.$t('api_test.automation.env_message'));
return false; return false;
} else if (this.environmentMap && this.environmentMap.size > 0) {
const env = this.environmentMap.get(this.request.projectId);
if (!env) {
this.$warning(this.$t('api_test.automation.env_message'));
return false;
}
} }
} }
} }
@ -523,12 +523,15 @@ export default {
this.request.active = true; this.request.active = true;
this.loading = true; this.loading = true;
this.runData = []; this.runData = [];
this.request.useEnvironment = this.currentEnvironmentId; if (selectEnvId) {
this.request.useEnvironment = selectEnvId;
this.request.environmentId = selectEnvId;
}
this.request.customizeReq = this.isCustomizeReq; this.request.customizeReq = this.isCustomizeReq;
let debugData = { let debugData = {
id: this.currentScenario.id, name: this.currentScenario.name, type: "scenario", id: this.currentScenario.id, name: this.currentScenario.name, type: "scenario",
variables: this.currentScenario.variables, referenced: 'Created', headers: this.currentScenario.headers, variables: this.currentScenario.variables, referenced: 'Created', headers: this.currentScenario.headers,
enableCookieShare: this.enableCookieShare, environmentId: this.currentEnvironmentId, hashTree: [this.request], enableCookieShare: this.enableCookieShare, environmentId: selectEnvId, hashTree: [this.request],
}; };
this.runData.push(debugData); this.runData.push(debugData);
this.request.requestResult = []; this.request.requestResult = [];

View File

@ -93,7 +93,6 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
currentEnvironmentId: String,
projectList: Array, projectList: Array,
environmentType: String, environmentType: String,
environmentGroupId: String, environmentGroupId: String,

View File

@ -14,7 +14,6 @@
:jsr223-processor="scenario" :jsr223-processor="scenario"
:request="scenario" :request="scenario"
:currentScenario="currentScenario" :currentScenario="currentScenario"
:currentEnvironmentId="currentEnvironmentId"
:node="node" :node="node"
:draggable="draggable" :draggable="draggable"
:title="title" :title="title"
@ -97,7 +96,6 @@ export default {
default: true, default: true,
}, },
currentScenario: {}, currentScenario: {},
currentEnvironmentId: String,
response: {}, response: {},
node: {}, node: {},
projectList: Array, projectList: Array,

View File

@ -15,7 +15,7 @@
<template v-slot:request> <template v-slot:request>
<jdbc-processor-content <jdbc-processor-content
:showScript="false" :showScript="false"
:isScenario="isScenario" :scenarioId="scenarioId"
:request="request"/> :request="request"/>
</template> </template>
</api-base-component> </api-base-component>
@ -35,7 +35,7 @@ export default {
ApiBaseComponent, MsDropdown, MsInstructionsIcon, MsCodeEdit ApiBaseComponent, MsDropdown, MsInstructionsIcon, MsCodeEdit
}, },
props: { props: {
isScenario: String, scenarioId: String,
draggable: { draggable: {
type: Boolean, type: Boolean,
default: false, default: false,

View File

@ -1,7 +1,8 @@
<template> <template>
<div> <div>
<ms-run :debug="true" :environment="envMap" :reportId="reportId" :saved="false" :runMode="'DEFINITION'" :run-data="debugData" @runRefresh="runRefresh" ref="runTest"/> <ms-run :debug="true" :environment="envMap" :reportId="reportId" :saved="false" :runMode="'DEFINITION'" :run-data="debugData" @errorRefresh="errorRefresh" @runRefresh="runRefresh" ref="runTest"/>
<api-base-component :if-from-variable-advance="ifFromVariableAdvance" @copy="copyRow" @active="active(controller)" @remove="remove" :data="controller" :draggable="draggable" :is-max="isMax" :show-btn="showBtn" :show-version="showVersion" color="#02A7F0" background-color="#F4F4F5" :title="$t('api_test.automation.loop_controller')" v-loading="loading"> <api-base-component :if-from-variable-advance="ifFromVariableAdvance" @copy="copyRow" @active="active(controller)" @remove="remove" :data="controller" :draggable="draggable" :is-max="isMax" :show-btn="showBtn" :show-version="showVersion" color="#02A7F0"
background-color="#F4F4F5" :title="$t('api_test.automation.loop_controller')">
<template v-slot:headerLeft> <template v-slot:headerLeft>
<i class="icon el-icon-arrow-right" :class="{'is-active': controller.active}" style="margin-right: 10px" v-if="!isMax"/> <i class="icon el-icon-arrow-right" :class="{'is-active': controller.active}" style="margin-right: 10px" v-if="!isMax"/>
@ -18,7 +19,7 @@
<template v-slot:button> <template v-slot:button>
<el-button @click="runDebug" :disabled="!controller.enable" :tip="$t('api_test.run')" icon="el-icon-video-play" style="background-color: #409EFF;color: white;padding: 5px" size="mini" circle/> <el-button @click="runDebug" :disabled="!controller.enable" :tip="$t('api_test.run')" icon="el-icon-video-play" style="background-color: #409EFF;color: white;padding: 5px" size="mini" circle/>
</template> </template>
<div v-if="controller.loopType==='LOOP_COUNT'" draggable> <div v-if="controller.loopType==='LOOP_COUNT'" draggable v-loading="loading">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<span class="ms-span ms-radio">{{ $t('loop.loops') }}</span> <span class="ms-span ms-radio">{{ $t('loop.loops') }}</span>
@ -40,7 +41,7 @@
</el-row> </el-row>
</div> </div>
<div v-else-if="controller.loopType==='FOREACH'" draggable> <div v-else-if="controller.loopType==='FOREACH'" draggable v-loading="loading">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-input :placeholder="$t('api_test.automation.loop_return_val')" v-model="controller.forEachController.returnVal" size="small"/> <el-input :placeholder="$t('api_test.automation.loop_return_val')" v-model="controller.forEachController.returnVal" size="small"/>
@ -58,7 +59,7 @@
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<div v-else draggable> <div v-else draggable v-loading="loading">
<el-input size="small" v-model="controller.whileController.variable" style="width: 20%" :placeholder="$t('api_test.request.condition_variable')"/> <el-input size="small" v-model="controller.whileController.variable" style="width: 20%" :placeholder="$t('api_test.request.condition_variable')"/>
<el-select v-model="controller.whileController.operator" :placeholder="$t('commons.please_select')" size="small" @change="change" style="width: 10%;margin-left: 10px"> <el-select v-model="controller.whileController.operator" :placeholder="$t('commons.please_select')" size="small" @change="change" style="width: 10%;margin-left: 10px">
<el-option v-for="o in operators" :key="o.value" :label="$t(o.label)" :value="o.value"/> <el-option v-for="o in operators" :key="o.value" :label="$t(o.label)" :value="o.value"/>
@ -95,7 +96,6 @@ export default {
components: {ApiBaseComponent, ApiResponseComponent, MsRun}, components: {ApiBaseComponent, ApiResponseComponent, MsRun},
props: { props: {
controller: {}, controller: {},
currentEnvironmentId: String,
currentScenario: {}, currentScenario: {},
node: {}, node: {},
message: String, message: String,
@ -254,11 +254,16 @@ export default {
this.$warning("当前循环下没有请求,不能执行"); this.$warning("当前循环下没有请求,不能执行");
return; return;
} }
if(!this.controller.enable){ if (!this.controller.enable) {
this.$warning(this.$t('api_test.automation.debug_message')); this.$warning(this.$t('api_test.automation.debug_message'));
return; return;
} }
this.loading = true; this.loading = true;
let currentEnvironmentId;
if (this.$store.state.scenarioEnvMap && this.$store.state.scenarioEnvMap instanceof Map
&& this.$store.state.scenarioEnvMap.has((this.currentScenario.id + "_" + this.controller.projectId))) {
currentEnvironmentId = this.$store.state.scenarioEnvMap.get((this.currentScenario.id + "_" + this.controller.projectId));
}
this.debugData = { this.debugData = {
id: this.currentScenario.id, id: this.currentScenario.id,
name: this.currentScenario.name, name: this.currentScenario.name,
@ -267,7 +272,7 @@ export default {
headers: this.currentScenario.headers, headers: this.currentScenario.headers,
referenced: "Created", referenced: "Created",
enableCookieShare: this.enableCookieShare, enableCookieShare: this.enableCookieShare,
environmentId: this.currentEnvironmentId, environmentId: currentEnvironmentId,
hashTree: [this.controller], hashTree: [this.controller],
}; };
if (this.node && this.node.data) { if (this.node && this.node.data) {
@ -307,6 +312,9 @@ export default {
runRefresh() { runRefresh() {
this.initMessageSocket(); this.initMessageSocket();
}, },
errorRefresh() {
this.loading = false;
},
setResult(hashTree) { setResult(hashTree) {
if (hashTree) { if (hashTree) {
hashTree.forEach((item) => { hashTree.forEach((item) => {

View File

@ -43,7 +43,7 @@
<div class="el-step__icon-inner">{{ request.preSize }}</div> <div class="el-step__icon-inner">{{ request.preSize }}</div>
</div> </div>
</span> </span>
<ms-jmx-step :request="request" :apiId="request.id" :is-scenario="true" :response="response" :tab-type="'pre'" ref="preStep"/> <ms-jmx-step :request="request" :apiId="request.id" :scenario-id="currentScenario.id" :response="response" :tab-type="'pre'" ref="preStep"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('api_test.definition.request.post_operation')" name="postOperate"> <el-tab-pane :label="$t('api_test.definition.request.post_operation')" name="postOperate">
<span class="item-tabs" effect="dark" placement="top-start" slot="label"> <span class="item-tabs" effect="dark" placement="top-start" slot="label">
@ -52,7 +52,7 @@
<div class="el-step__icon-inner">{{ request.postSize }}</div> <div class="el-step__icon-inner">{{ request.postSize }}</div>
</div> </div>
</span> </span>
<ms-jmx-step :request="request" :apiId="request.id" :is-scenario="true" :response="response" :tab-type="'post'" ref="postStep"/> <ms-jmx-step :request="request" :apiId="request.id" :scenario-id="currentScenario.id" :response="response" :tab-type="'post'" ref="postStep"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('api_test.definition.request.assertions_rule')" name="assertionsRule"> <el-tab-pane :label="$t('api_test.definition.request.assertions_rule')" name="assertionsRule">
<span class="item-tabs" effect="dark" placement="top-start" slot="label"> <span class="item-tabs" effect="dark" placement="top-start" slot="label">
@ -62,7 +62,7 @@
</div> </div>
</span> </span>
<div style="margin-right: 20px"> <div style="margin-right: 20px">
<ms-jmx-step :request="request" :apiId="request.id" :is-scenario="true" :response="response" @reload="reload" :tab-type="'assertionsRule'" ref="assertionsRule"/> <ms-jmx-step :request="request" :apiId="request.id" :scenario-id="currentScenario.id" :response="response" @reload="reload" :tab-type="'assertionsRule'" ref="assertionsRule"/>
</div> </div>
</el-tab-pane> </el-tab-pane>
@ -302,30 +302,20 @@ export default {
} }
}, },
run() { run() {
if (this.isApiImport || this.request.isRefEnvironment) {
if (this.request.type && (this.request.type === "HTTPSamplerProxy" || this.request.type === "JDBCSampler" || this.request.type === "TCPSampler")) {
if (!this.envMap || this.envMap.size === 0) {
this.$warning(this.$t('api_test.automation.env_message'));
return false;
} else if (this.envMap && this.envMap.size > 0) {
const env = this.envMap.get(this.request.projectId);
if (!env) {
this.$warning(this.$t('api_test.automation.env_message'));
return false;
}
}
}
}
this.request.debug = true; this.request.debug = true;
this.loading = true; this.loading = true;
this.runData = []; this.runData = [];
this.runData.projectId = this.request.projectId; this.runData.projectId = this.request.projectId;
this.request.useEnvironment = this.currentEnvironmentId;
this.request.customizeReq = this.isCustomizeReq; this.request.customizeReq = this.isCustomizeReq;
let currentEnvironmentId;
if (this.$store.state.scenarioEnvMap && this.$store.state.scenarioEnvMap instanceof Map
&& this.$store.state.scenarioEnvMap.has((this.currentScenario.id + "_" + this.request.projectId))) {
currentEnvironmentId = this.$store.state.scenarioEnvMap.get((this.currentScenario.id + "_" + this.request.projectId));
}
let debugData = { let debugData = {
id: this.currentScenario.id, name: this.currentScenario.name, type: "scenario", id: this.currentScenario.id, name: this.currentScenario.name, type: "scenario",
variables: this.currentScenario.variables, referenced: 'Created', headers: this.currentScenario.headers, variables: this.currentScenario.variables, referenced: 'Created', headers: this.currentScenario.headers,
enableCookieShare: this.enableCookieShare, environmentId: this.currentEnvironmentId, hashTree: [this.request], enableCookieShare: this.enableCookieShare, environmentId: currentEnvironmentId, hashTree: [this.request],
}; };
this.runData.push(debugData); this.runData.push(debugData);
this.request.requestResult = []; this.request.requestResult = [];

View File

@ -98,7 +98,6 @@
:scenario="data" :scenario="data"
:response="response" :response="response"
:currentScenario="currentScenario" :currentScenario="currentScenario"
:currentEnvironmentId="currentEnvironmentId"
:node="node" :node="node"
:project-list="projectList" :project-list="projectList"
:env-map="projectEnvMap" :env-map="projectEnvMap"
@ -146,7 +145,6 @@
:scenario="selectedTreeNode" :scenario="selectedTreeNode"
:response="response" :response="response"
:currentScenario="currentScenario" :currentScenario="currentScenario"
:currentEnvironmentId="currentEnvironmentId"
:node="selectedNode" :node="selectedNode"
:project-list="projectList" :project-list="projectList"
:env-map="projectEnvMap" :env-map="projectEnvMap"
@ -165,7 +163,6 @@
:scenario="item" :scenario="item"
:response="response" :response="response"
:currentScenario="currentScenario" :currentScenario="currentScenario"
:currentEnvironmentId="currentEnvironmentId"
:project-list="projectList" :project-list="projectList"
:env-map="projectEnvMap" :env-map="projectEnvMap"
:draggable="false" :draggable="false"
@ -287,7 +284,6 @@ export default {
}, },
environments: [], environments: [],
projectEnvMap: Map, projectEnvMap: Map,
currentEnvironmentId: "",
maintainerOptions: [], maintainerOptions: [],
value: API_STATUS[0].id, value: API_STATUS[0].id,
options: API_STATUS, options: API_STATUS,
@ -696,16 +692,6 @@ export default {
this.environments.forEach(environment => { this.environments.forEach(environment => {
parseEnvironment(environment); parseEnvironment(environment);
}); });
let hasEnvironment = false;
for (let i in this.environments) {
if (this.environments[i].id === this.currentEnvironmentId) {
hasEnvironment = true;
break;
}
}
if (!hasEnvironment) {
this.currentEnvironmentId = '';
}
// //
this.checkDataIsCopy(); this.checkDataIsCopy();
}); });

View File

@ -41,7 +41,7 @@
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
<el-checkbox <el-checkbox
v-if="request.referenced==='Created' && isScenario" v-if="request.referenced==='Created' && scenarioId !==''"
v-model="request.isRefEnvironment" :disabled="request.disabled" class="ref_environment" @change="getEnvironments"> v-model="request.isRefEnvironment" :disabled="request.disabled" class="ref_environment" @change="getEnvironments">
{{ $t('api_test.request.refer_to_environment') }} {{ $t('api_test.request.refer_to_environment') }}
</el-checkbox> </el-checkbox>
@ -73,7 +73,7 @@
<div class="el-step__icon-inner">{{ request.preSize }}</div> <div class="el-step__icon-inner">{{ request.preSize }}</div>
</div> </div>
</span> </span>
<ms-jmx-step :request="request" :isScenario="isScenario" :apiId="request.id" :response="response" :tab-type="'pre'" <ms-jmx-step :request="request" :scenarioId="scenarioId" :apiId="request.id" :response="response" :tab-type="'pre'"
ref="preStep"/> ref="preStep"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('api_test.definition.request.post_operation')" name="postOperate" <el-tab-pane :label="$t('api_test.definition.request.post_operation')" name="postOperate"
@ -84,7 +84,7 @@
<div class="el-step__icon-inner">{{ request.postSize }}</div> <div class="el-step__icon-inner">{{ request.postSize }}</div>
</div> </div>
</span> </span>
<ms-jmx-step :request="request" :isScenario="isScenario" :apiId="request.id" :response="response" :tab-type="'post'" <ms-jmx-step :request="request" :scenarioId="scenarioId" :apiId="request.id" :response="response" :tab-type="'post'"
ref="postStep"/> ref="postStep"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('api_test.definition.request.assertions_rule')" name="assertionsRule" <el-tab-pane :label="$t('api_test.definition.request.assertions_rule')" name="assertionsRule"
@ -95,7 +95,7 @@
<div class="el-step__icon-inner">{{ request.ruleSize }}</div> <div class="el-step__icon-inner">{{ request.ruleSize }}</div>
</div> </div>
</span> </span>
<ms-jmx-step :request="request" :apiId="request.id" :response="response" :isScenario="isScenario" @reload="reloadBody" <ms-jmx-step :request="request" :apiId="request.id" :response="response" :scenarioId="scenarioId" @reload="reloadBody"
:tab-type="'assertionsRule'" ref="assertionsRule"/> :tab-type="'assertionsRule'" ref="assertionsRule"/>
</el-tab-pane> </el-tab-pane>
@ -149,7 +149,7 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
isScenario: String, scenarioId: String,
isReadOnly: { isReadOnly: {
type: Boolean, type: Boolean,
default: false default: false
@ -176,7 +176,7 @@ export default {
deep: true deep: true
}, },
'$store.state.useEnvironment': function () { '$store.state.useEnvironment': function () {
if (!this.isScenario) { if (!this.scenarioId) {
this.request.environmentId = this.$store.state.useEnvironment; this.request.environmentId = this.$store.state.useEnvironment;
this.getEnvironments(); this.getEnvironments();
} }
@ -281,10 +281,12 @@ export default {
&& this.$store.state.scenarioEnvMap.has(scenarioEnvId)) { && this.$store.state.scenarioEnvMap.has(scenarioEnvId)) {
envId = this.$store.state.scenarioEnvMap.get(scenarioEnvId); envId = this.$store.state.scenarioEnvMap.get(scenarioEnvId);
} }
if (this.request.referenced === 'Created' && this.isScenario && !this.request.isRefEnvironment) { if (this.request.referenced === 'Created' && this.scenarioId && !this.request.isRefEnvironment) {
alert(2222)
this.itselfEnvironment(); this.itselfEnvironment();
return; return;
} else if (!this.isScenario && !this.request.customizeReq) { } else if (!this.scenarioId && !this.request.customizeReq) {
alert(333)
this.itselfEnvironment(); this.itselfEnvironment();
return; return;
} }

View File

@ -46,7 +46,7 @@
<div class="el-step__icon-inner">{{ request.preSize }}</div> <div class="el-step__icon-inner">{{ request.preSize }}</div>
</div> </div>
</span> </span>
<ms-jmx-step :request="request" :apiId="request.id" :response="response" :is-scenario="isScenario" :tab-type="'pre'" <ms-jmx-step :request="request" :apiId="request.id" :response="response" :scenario-id="scenarioId" :tab-type="'pre'"
ref="preStep"/> ref="preStep"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('api_test.definition.request.post_operation')" name="postOperate" <el-tab-pane :label="$t('api_test.definition.request.post_operation')" name="postOperate"
@ -57,7 +57,7 @@
<div class="el-step__icon-inner">{{ request.postSize }}</div> <div class="el-step__icon-inner">{{ request.postSize }}</div>
</div> </div>
</span> </span>
<ms-jmx-step :request="request" :apiId="request.id" :isScenario="isScenario" <ms-jmx-step :request="request" :apiId="request.id" :scenarioId="scenarioId"
:response="response" :tab-type="'post'" :response="response" :tab-type="'post'"
ref="postStep"/> ref="postStep"/>
</el-tab-pane> </el-tab-pane>
@ -69,7 +69,7 @@
<div class="el-step__icon-inner">{{ request.ruleSize }}</div> <div class="el-step__icon-inner">{{ request.ruleSize }}</div>
</div> </div>
</span> </span>
<ms-jmx-step :request="request" :apiId="request.id" :isScenario="isScenario" <ms-jmx-step :request="request" :apiId="request.id" :scenarioId="scenarioId"
:response="response" @reload="reloadBody" :response="response" @reload="reloadBody"
:tab-type="'assertionsRule'" ref="assertionsRule"/> :tab-type="'assertionsRule'" ref="assertionsRule"/>
</el-tab-pane> </el-tab-pane>
@ -116,7 +116,7 @@ export default {
MsJmxStep MsJmxStep
}, },
props: { props: {
isScenario: String, scenarioId: String,
request: {}, request: {},
basisData: {}, basisData: {},
moduleOptions: Array, moduleOptions: Array,

View File

@ -121,7 +121,7 @@
:apiId="request.id" :apiId="request.id"
:response="response" :response="response"
:tab-type="'pre'" :tab-type="'pre'"
:isScenario="isScenario" :scenarioId="scenarioId"
ref="preStep" ref="preStep"
v-if="activeName === 'preOperate'" v-if="activeName === 'preOperate'"
/> />
@ -138,7 +138,7 @@
:apiId="request.id" :apiId="request.id"
:response="response" :response="response"
:tab-type="'post'" :tab-type="'post'"
:isScenario="isScenario" :scenarioId="scenarioId"
ref="postStep" ref="postStep"
v-if="activeName === 'postOperate'" v-if="activeName === 'postOperate'"
/> />
@ -153,7 +153,7 @@
<ms-jmx-step <ms-jmx-step
:request="request" :request="request"
:apiId="request.id" :apiId="request.id"
:isScenario="isScenario" :scenarioId="scenarioId"
:response="response" :response="response"
@reload="reloadBody" @reload="reloadBody"
:tab-type="'assertionsRule'" :tab-type="'assertionsRule'"
@ -210,7 +210,7 @@ export default {
return false; return false;
} }
}, },
isScenario: String, scenarioId: String,
showScript: { showScript: {
type: Boolean, type: Boolean,
default: true, default: true,

View File

@ -128,7 +128,7 @@
<div class="el-step__icon-inner">{{ request.preSize }}</div> <div class="el-step__icon-inner">{{ request.preSize }}</div>
</div> </div>
</span> </span>
<ms-jmx-step :request="request" :isScenario="isScenario" <ms-jmx-step :request="request" :scenarioId="scenarioId"
:apiId="request.id" protocol="TCP" :response="response" :apiId="request.id" protocol="TCP" :response="response"
:tab-type="'pre'" :tab-type="'pre'"
ref="preStep"/> ref="preStep"/>
@ -141,7 +141,7 @@
<div class="el-step__icon-inner">{{ request.postSize }}</div> <div class="el-step__icon-inner">{{ request.postSize }}</div>
</div> </div>
</span> </span>
<ms-jmx-step :request="request" :isScenario="isScenario" <ms-jmx-step :request="request" :scenarioId="scenarioId"
:apiId="request.id" protocol="TCP" :response="response" :apiId="request.id" protocol="TCP" :response="response"
:tab-type="'post'" :tab-type="'post'"
ref="postStep"/> ref="postStep"/>
@ -154,7 +154,7 @@
<div class="el-step__icon-inner">{{ request.ruleSize }}</div> <div class="el-step__icon-inner">{{ request.ruleSize }}</div>
</div> </div>
</span> </span>
<ms-jmx-step :request="request" :apiId="request.id" protocol="TCP" :is-scenario="isScenario" :response="response" <ms-jmx-step :request="request" :apiId="request.id" protocol="TCP" :scenario-id="scenarioId" :response="response"
@reload="reloadBody" @reload="reloadBody"
:tab-type="'assertionsRule'" ref="assertionsRule"/> :tab-type="'assertionsRule'" ref="assertionsRule"/>
</el-tab-pane> </el-tab-pane>
@ -202,7 +202,7 @@ export default {
MsJmxStep MsJmxStep
}, },
props: { props: {
isScenario: String, scenarioId: String,
request: {}, request: {},
basisData: {}, basisData: {},
response: {}, response: {},

View File

@ -49,7 +49,7 @@
@remove="remove" @remove="remove"
:title="$t('api_test.definition.request.pre_sql')" :title="$t('api_test.definition.request.pre_sql')"
:is-read-only="false" :is-read-only="false"
:isScenario="isScenario" :scenarioId="scenarioId"
:request="data" :request="data"
:jdbc-processor="data" :jdbc-processor="data"
color="#B8741A" color="#B8741A"
@ -80,7 +80,7 @@
:title="$t('api_test.definition.request.post_sql')" :title="$t('api_test.definition.request.post_sql')"
:is-read-only="false" :is-read-only="false"
:request="data" :request="data"
:isScenario="isScenario" :scenarioId="scenarioId"
:jdbc-processor="data" :jdbc-processor="data"
color="#783887" color="#783887"
background-color="#F2ECF3"/> background-color="#F2ECF3"/>
@ -139,7 +139,7 @@ export default {
tabType: String, tabType: String,
response: {}, response: {},
apiId: String, apiId: String,
isScenario: String, scenarioId: String,
showScript: { showScript: {
type: Boolean, type: Boolean,
default: true, default: true,