feat(接口测试): 场景步骤重构优化

This commit is contained in:
fit2-zhao 2022-03-04 18:33:52 +08:00 committed by fit2-zhao
parent a1f3cc8701
commit 777e62dbb8
14 changed files with 715 additions and 534 deletions

View File

@ -19,7 +19,6 @@
"@fortawesome/vue-fontawesome": "^0.1.9", "@fortawesome/vue-fontawesome": "^0.1.9",
"axios": "^0.21.3", "axios": "^0.21.3",
"core-js": "^3.4.3", "core-js": "^3.4.3",
"default-passive-events": "^2.0.0",
"diffable-html": "^4.0.0", "diffable-html": "^4.0.0",
"echarts": "^5.0.2", "echarts": "^5.0.2",
"el-table-infinite-scroll": "^1.0.10", "el-table-infinite-scroll": "^1.0.10",

View File

@ -1,6 +1,6 @@
<template> <template>
<ms-container v-if="renderComponent" v-loading="loading"> <ms-container v-if="renderComponent" v-loading="loading">
<ms-aside-container> <ms-aside-container v-show="isAsideHidden">
<ms-api-scenario-module <ms-api-scenario-module
:show-operator="true" :show-operator="true"
@nodeSelectEvent="nodeChange" @nodeSelectEvent="nodeChange"
@ -162,7 +162,8 @@ export default {
//API //API
initApiTableOpretion: 'init', initApiTableOpretion: 'init',
isLeave: false, isLeave: false,
isSave: false isSave: false,
isAsideHidden: true,
}; };
}, },
created() { created() {
@ -201,6 +202,7 @@ export default {
this.activeName = "default"; this.activeName = "default";
}, },
activeName() { activeName() {
this.isAsideHidden = this.activeName === 'default';
} }
}, },
methods: { methods: {
@ -502,7 +504,9 @@ export default {
this.$refs.nodeTree.list(); this.$refs.nodeTree.list();
}, },
refreshTree() { refreshTree() {
this.$refs.nodeTree.list(); if (this.$refs.nodeTree) {
this.$refs.nodeTree.list();
}
}, },
refreshAll() { refreshAll() {
this.$refs.nodeTree.list(); this.$refs.nodeTree.list();

View File

@ -1,117 +1,117 @@
export function STEP() { export function STEP() {
let map = new Map([ let map = new Map([
['ALL', init()], ['ALL', init()],
['scenario', init()], ['scenario', init()],
['HTTPSamplerProxy', getDefaultSamplerMenu()], ['HTTPSamplerProxy', getDefaultSamplerMenu()],
['DubboSampler', getDefaultSamplerMenu()], ['DubboSampler', getDefaultSamplerMenu()],
['JDBCSampler', getDefaultSamplerMenu()], ['JDBCSampler', getDefaultSamplerMenu()],
['TCPSampler', getDefaultSamplerMenu()], ['TCPSampler', getDefaultSamplerMenu()],
['OT_IMPORT', getDefaultSamplerMenu()], ['OT_IMPORT', getDefaultSamplerMenu()],
['AbstractSampler', getDefaultSamplerMenu()], ['AbstractSampler', getDefaultSamplerMenu()],
['IfController', getAll()], ['IfController', getAll()],
['TransactionController', getAll()], ['TransactionController', getAll()],
['LoopController', getAll()], ['LoopController', getAll()],
['ConstantTimer', []], ['ConstantTimer', []],
['JSR223Processor', getDefaultSamplerMenu()], ['JSR223Processor', getDefaultSamplerMenu()],
['JSR223PreProcessor', []], ['JSR223PreProcessor', []],
['JSR223PostProcessor', []], ['JSR223PostProcessor', []],
['JDBCPreProcessor', []], ['JDBCPreProcessor', []],
['JDBCPostProcessor', []], ['JDBCPostProcessor', []],
['Assertions', []], ['Assertions', []],
['Extract', []], ['Extract', []],
['JmeterElement', []], ['JmeterElement', []],
['CustomizeReq', getDefaultSamplerMenu()], ['CustomizeReq', getDefaultSamplerMenu()],
['MaxSamplerProxy', getDefaultSamplerMenu()], ['MaxSamplerProxy', getDefaultSamplerMenu()],
['GenericController', getAll()], ['GenericController', getAll()],
['AllSamplerProxy', ['HTTPSamplerProxy', 'DubboSampler', 'JDBCSampler', 'TCPSampler', 'Sampler', 'AbstractSampler', 'JSR223Processor', 'API']], ['AllSamplerProxy', ['HTTPSamplerProxy', 'DubboSampler', 'JDBCSampler', 'TCPSampler', 'Sampler', 'AbstractSampler', 'JSR223Processor', 'API']],
['DEFINITION', ['HTTPSamplerProxy', 'DubboSampler', 'JDBCSampler', 'TCPSampler']], ['DEFINITION', ['HTTPSamplerProxy', 'DubboSampler', 'JDBCSampler', 'TCPSampler']],
['ALlSamplerStep', ['JSR223Processor', 'JSR223PreProcessor', 'JSR223PostProcessor', 'JDBCPreProcessor', 'JDBCPostProcessor', 'Assertions', 'Extract','ConstantTimer']], ['ALlSamplerStep', ['JSR223PreProcessor', 'JSR223PostProcessor', 'JDBCPreProcessor', 'JDBCPostProcessor', 'Assertions', 'Extract', 'ConstantTimer']],
['AllCanExecType', ['HTTPSamplerProxy', 'DubboSampler', 'JDBCSampler', 'TCPSampler', 'JSR223Processor', 'AbstractSampler']]]); ['AllCanExecType', ['HTTPSamplerProxy', 'DubboSampler', 'JDBCSampler', 'TCPSampler', 'JSR223Processor', 'AbstractSampler']]]);
return map return map
} }
export const ELEMENT_TYPE = { export const ELEMENT_TYPE = {
scenario: 'scenario', scenario: 'scenario',
HTTPSamplerProxy: 'HTTPSamplerProxy', HTTPSamplerProxy: 'HTTPSamplerProxy',
OT_IMPORT: 'OT_IMPORT', OT_IMPORT: 'OT_IMPORT',
IfController: 'IfController', IfController: 'IfController',
TransactionController: 'TransactionController', TransactionController: 'TransactionController',
ConstantTimer: 'ConstantTimer', ConstantTimer: 'ConstantTimer',
JSR223Processor: 'JSR223Processor', JSR223Processor: 'JSR223Processor',
JSR223PreProcessor: 'JSR223PreProcessor', JSR223PreProcessor: 'JSR223PreProcessor',
JSR223PostProcessor: 'JSR223PostProcessor', JSR223PostProcessor: 'JSR223PostProcessor',
JDBCPostProcessor: 'JDBCPostProcessor', JDBCPostProcessor: 'JDBCPostProcessor',
JDBCPreProcessor: 'JDBCPreProcessor', JDBCPreProcessor: 'JDBCPreProcessor',
Assertions: 'Assertions', Assertions: 'Assertions',
Extract: 'Extract', Extract: 'Extract',
CustomizeReq: 'CustomizeReq', CustomizeReq: 'CustomizeReq',
LoopController: 'LoopController', LoopController: 'LoopController',
Plugin: 'Plugin' Plugin: 'Plugin'
} }
export const TYPE_TO_C = new Map([ export const TYPE_TO_C = new Map([
['scenario', 'io.metersphere.api.dto.definition.request.MsScenario'], ['scenario', 'io.metersphere.api.dto.definition.request.MsScenario'],
['HTTPSamplerProxy', 'io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy'], ['HTTPSamplerProxy', 'io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy'],
['DubboSampler', 'io.metersphere.api.dto.definition.request.sampler.MsDubboSampler'], ['DubboSampler', 'io.metersphere.api.dto.definition.request.sampler.MsDubboSampler'],
['JDBCSampler', 'io.metersphere.api.dto.definition.request.sampler.MsJDBCSampler'], ['JDBCSampler', 'io.metersphere.api.dto.definition.request.sampler.MsJDBCSampler'],
['TCPSampler', 'io.metersphere.api.dto.definition.request.sampler.MsTCPSampler'], ['TCPSampler', 'io.metersphere.api.dto.definition.request.sampler.MsTCPSampler'],
['IfController', 'io.metersphere.api.dto.definition.request.controller.MsIfController'], ['IfController', 'io.metersphere.api.dto.definition.request.controller.MsIfController'],
['TransactionController', 'io.metersphere.api.dto.definition.request.controller.MsTransactionController'], ['TransactionController', 'io.metersphere.api.dto.definition.request.controller.MsTransactionController'],
['LoopController', 'io.metersphere.api.dto.definition.request.controller.MsLoopController'], ['LoopController', 'io.metersphere.api.dto.definition.request.controller.MsLoopController'],
['ConstantTimer', 'io.metersphere.api.dto.definition.request.timer.MsConstantTimer'], ['ConstantTimer', 'io.metersphere.api.dto.definition.request.timer.MsConstantTimer'],
['JSR223Processor', 'io.metersphere.api.dto.definition.request.processors.MsJSR223Processor'], ['JSR223Processor', 'io.metersphere.api.dto.definition.request.processors.MsJSR223Processor'],
['JSR223PreProcessor', 'io.metersphere.api.dto.definition.request.processors.pre.MsJSR223PreProcessor'], ['JSR223PreProcessor', 'io.metersphere.api.dto.definition.request.processors.pre.MsJSR223PreProcessor'],
['JSR223PostProcessor', 'io.metersphere.api.dto.definition.request.processors.post.MsJSR223PostProcessor'], ['JSR223PostProcessor', 'io.metersphere.api.dto.definition.request.processors.post.MsJSR223PostProcessor'],
['JDBCPreProcessor', 'io.metersphere.api.dto.definition.request.processors.pre.MsJDBCPreProcessor'], ['JDBCPreProcessor', 'io.metersphere.api.dto.definition.request.processors.pre.MsJDBCPreProcessor'],
['JDBCPostProcessor', 'io.metersphere.api.dto.definition.request.processors.post.MsJDBCPostProcessor'], ['JDBCPostProcessor', 'io.metersphere.api.dto.definition.request.processors.post.MsJDBCPostProcessor'],
['Assertions', 'io.metersphere.api.dto.definition.request.assertions.MsAssertions'], ['Assertions', 'io.metersphere.api.dto.definition.request.assertions.MsAssertions'],
['Extract', 'io.metersphere.api.dto.definition.request.extract.MsExtract'], ['Extract', 'io.metersphere.api.dto.definition.request.extract.MsExtract'],
['JmeterElement', 'io.metersphere.api.dto.definition.request.unknown.MsJmeterElement'], ['JmeterElement', 'io.metersphere.api.dto.definition.request.unknown.MsJmeterElement'],
['TestPlan', 'io.metersphere.api.dto.definition.request.MsTestPlan'], ['TestPlan', 'io.metersphere.api.dto.definition.request.MsTestPlan'],
['ThreadGroup', 'io.metersphere.api.dto.definition.request.MsThreadGroup'], ['ThreadGroup', 'io.metersphere.api.dto.definition.request.MsThreadGroup'],
['DNSCacheManager', 'io.metersphere.api.dto.definition.request.dns.MsDNSCacheManager'], ['DNSCacheManager', 'io.metersphere.api.dto.definition.request.dns.MsDNSCacheManager'],
['DebugSampler', 'io.metersphere.api.dto.definition.request.sampler.MsDebugSampler'], ['DebugSampler', 'io.metersphere.api.dto.definition.request.sampler.MsDebugSampler'],
['AuthManager', 'io.metersphere.api.dto.definition.request.auth.MsAuthManager'] ['AuthManager', 'io.metersphere.api.dto.definition.request.auth.MsAuthManager']
]) ])
export const PLUGIN_ELEMENTS = new Map([ export const PLUGIN_ELEMENTS = new Map([
['menu_post_processors', ['HtmlExtractor', 'JMESPathExtractor', 'JSONPostProcessor', 'RegexExtractor', 'BoundaryExtractor', 'Separator', 'XPath2Extractor', 'XPathExtractor', 'ResultAction', 'DebugPostProcessor', 'BeanShellPostProcessor']], ['menu_post_processors', ['HtmlExtractor', 'JMESPathExtractor', 'JSONPostProcessor', 'RegexExtractor', 'BoundaryExtractor', 'Separator', 'XPath2Extractor', 'XPathExtractor', 'ResultAction', 'DebugPostProcessor', 'BeanShellPostProcessor']],
['menu_assertions', ['JSONPathAssertion', 'SizeAssertion', 'JSR223Assertion', 'XPath2Assertion', 'Separator', 'HTMLAssertion', 'JMESPathAssertion', 'MD5HexAssertion', 'SMIMEAssertion', 'XMLSchemaAssertion', 'XMLAssertion', 'XPathAssertion', 'DurationAssertion', 'CompareAssertion', 'BeanShellAssertion']], ['menu_assertions', ['JSONPathAssertion', 'SizeAssertion', 'JSR223Assertion', 'XPath2Assertion', 'Separator', 'HTMLAssertion', 'JMESPathAssertion', 'MD5HexAssertion', 'SMIMEAssertion', 'XMLSchemaAssertion', 'XMLAssertion', 'XPathAssertion', 'DurationAssertion', 'CompareAssertion', 'BeanShellAssertion']],
['menu_listener', ['AbstractVisualizer', 'AbstractListener', 'ViewResultsFullVisualizer', 'SummaryReport', 'StatVisualizer', 'BackendListener', 'Separator', 'JSR223Listener', 'ResultSaver', 'RespTimeGraphVisualizer', 'GraphVisualizer', 'AssertionVisualizer', 'ComparisonVisualizer', 'StatGraphVisualizer', 'Summariser', 'TableVisualizer', 'SimpleDataWriter', 'MailerVisualizer', 'BeanShellListener']], ['menu_listener', ['AbstractVisualizer', 'AbstractListener', 'ViewResultsFullVisualizer', 'SummaryReport', 'StatVisualizer', 'BackendListener', 'Separator', 'JSR223Listener', 'ResultSaver', 'RespTimeGraphVisualizer', 'GraphVisualizer', 'AssertionVisualizer', 'ComparisonVisualizer', 'StatGraphVisualizer', 'Summariser', 'TableVisualizer', 'SimpleDataWriter', 'MailerVisualizer', 'BeanShellListener']],
['menu_pre_processors', ['AbstractPostProcessor', 'UserParameters', 'Separator', 'AnchorModifier', 'URLRewritingModifier', 'SampleTimeout', 'RegExUserParameters', 'BeanShellPreProcessor']], ['menu_pre_processors', ['AbstractPostProcessor', 'UserParameters', 'Separator', 'AnchorModifier', 'URLRewritingModifier', 'SampleTimeout', 'RegExUserParameters', 'BeanShellPreProcessor']],
['menu_logic_controller', ['GenericController', 'scenario', 'IfController', 'LoopController', 'IfControllerPanel', 'TransactionController', 'LoopControlPanel', 'WhileController', 'Separator', 'ForeachControlPanel', 'IncludeController', 'RunTime', 'CriticalSectionController', 'InterleaveControl', 'OnceOnlyController', 'RecordController', 'LogicController', 'RandomControl', 'RandomOrderController', 'ThroughputController', 'SwitchController', 'ModuleController']], ['menu_logic_controller', ['GenericController', 'scenario', 'IfController', 'LoopController', 'IfControllerPanel', 'TransactionController', 'LoopControlPanel', 'WhileController', 'Separator', 'ForeachControlPanel', 'IncludeController', 'RunTime', 'CriticalSectionController', 'InterleaveControl', 'OnceOnlyController', 'RecordController', 'LogicController', 'RandomControl', 'RandomOrderController', 'ThroughputController', 'SwitchController', 'ModuleController']],
['menu_fragments', ['TestFragmentController']], ['menu_fragments', ['TestFragmentController']],
['menu_non_test_elements', ['ProxyControl', 'HttpMirrorControl', 'GenerateTree', 'PropertyControl']], ['menu_non_test_elements', ['ProxyControl', 'HttpMirrorControl', 'GenerateTree', 'PropertyControl']],
['menu_generative_controller', ['HTTPSamplerProxy', 'JSR223Processor', 'DubboSampler', 'JDBCSampler', 'TCPSampler', 'Sampler', 'AbstractSampler', 'CustomizeReq', 'HttpTestSample', 'TestAction', 'DebugSampler', 'JSR223Sampler', 'Separator', 'AjpSampler', 'AccessLogSampler', 'BeanShellSampler', 'BoltSampler', 'FtpTestSampler', 'GraphQLHTTPSampler', 'JDBCSampler', 'JMSPublisher', 'JMSSampler', 'JMSSubscriber', 'JUnitTestSampler', 'JavaTestSampler', 'LdapExtTestSampler', 'LdapTestSampler', 'SystemSampler', 'SmtpSampler', 'TCPSampler', 'MailReaderSampler']], ['menu_generative_controller', ['HTTPSamplerProxy', 'JSR223Processor', 'DubboSampler', 'JDBCSampler', 'TCPSampler', 'Sampler', 'AbstractSampler', 'CustomizeReq', 'HttpTestSample', 'TestAction', 'DebugSampler', 'JSR223Sampler', 'Separator', 'AjpSampler', 'AccessLogSampler', 'BeanShellSampler', 'BoltSampler', 'FtpTestSampler', 'GraphQLHTTPSampler', 'JDBCSampler', 'JMSPublisher', 'JMSSampler', 'JMSSubscriber', 'JUnitTestSampler', 'JavaTestSampler', 'LdapExtTestSampler', 'LdapTestSampler', 'SystemSampler', 'SmtpSampler', 'TCPSampler', 'MailReaderSampler']],
['menu_threads', ['SetupThreadGroup', 'PostThreadGroup', 'ThreadGroup']], ['menu_threads', ['SetupThreadGroup', 'PostThreadGroup', 'ThreadGroup']],
['menu_timer', ['ConstantTimer', 'UniformRandomTimer', 'PreciseThroughputTimer', 'ConstantThroughputTimer', 'Separator', 'JSR223Timer', 'SyncTimer', 'PoissonRandomTimer', 'GaussianRandomTimer', 'BeanShellTimer']], ['menu_timer', ['ConstantTimer', 'UniformRandomTimer', 'PreciseThroughputTimer', 'ConstantThroughputTimer', 'Separator', 'JSR223Timer', 'SyncTimer', 'PoissonRandomTimer', 'GaussianRandomTimer', 'BeanShellTimer']],
['menu_config_element', ['CSVDataSet', 'HeaderPanel', 'CookiePanel', 'CacheManager', 'HttpDefaults', 'Separator', 'BoltConnectionElement', 'DNSCachePanel', 'FtpConfig', 'AuthPanel', 'DataSourceElement', 'JavaConfig', 'LdapExtConfig', 'LdapConfig', 'TCPConfig', 'KeystoreConfig', 'ArgumentsPanel', 'LoginConfig', 'SimpleConfig', 'CounterConfig', 'RandomVariableConfig']], ['menu_config_element', ['CSVDataSet', 'HeaderPanel', 'CookiePanel', 'CacheManager', 'HttpDefaults', 'Separator', 'BoltConnectionElement', 'DNSCachePanel', 'FtpConfig', 'AuthPanel', 'DataSourceElement', 'JavaConfig', 'LdapExtConfig', 'LdapConfig', 'TCPConfig', 'KeystoreConfig', 'ArgumentsPanel', 'LoginConfig', 'SimpleConfig', 'CounterConfig', 'RandomVariableConfig']],
]) ])
export function getDefaultSamplerMenu() { export function getDefaultSamplerMenu() {
let array = []; let array = [];
array = array.concat(PLUGIN_ELEMENTS.get('menu_assertions')); array = array.concat(PLUGIN_ELEMENTS.get('menu_assertions'));
array = array.concat(PLUGIN_ELEMENTS.get('menu_pre_processors')); array = array.concat(PLUGIN_ELEMENTS.get('menu_pre_processors'));
array = array.concat(PLUGIN_ELEMENTS.get('menu_post_processors')); array = array.concat(PLUGIN_ELEMENTS.get('menu_post_processors'));
array = array.concat(PLUGIN_ELEMENTS.get('menu_config_element')); array = array.concat(PLUGIN_ELEMENTS.get('menu_config_element'));
array = array.concat(PLUGIN_ELEMENTS.get('menu_listener')); array = array.concat(PLUGIN_ELEMENTS.get('menu_listener'));
return array; return array;
} }
export function init() { export function init() {
let allArray = []; let allArray = [];
allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_generative_controller')); allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_generative_controller'));
allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_logic_controller')); allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_logic_controller'));
allArray = allArray.concat(['scenario', 'ConstantTimer', 'JSR223Processor']); allArray = allArray.concat(['scenario', 'ConstantTimer', 'JSR223Processor']);
return allArray; return allArray;
} }
export function getAll() { export function getAll() {
let allArray = []; let allArray = [];
allArray = allArray.concat(getDefaultSamplerMenu()); allArray = allArray.concat(getDefaultSamplerMenu());
allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_logic_controller')); allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_logic_controller'));
allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_non_test_elements')); allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_non_test_elements'));
allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_generative_controller')); allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_generative_controller'));
allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_threads')); allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_threads'));
return allArray; return allArray;
} }

View File

@ -3,7 +3,7 @@
<div class="header" @click="active(data)"> <div class="header" @click="active(data)">
<slot name="beforeHeaderLeft"> <slot name="beforeHeaderLeft">
<div v-if="data.index" class="el-step__icon is-text enable-switch" :style="{'color': color, 'background-color': backgroundColor}"> <div v-if="data.index" class="el-step__icon is-text enable-switch" :style="{'color': color, 'background-color': backgroundColor}">
<div class="el-step__icon-inner">{{ data.index }}</div> <div class="el-step__icon-inner" :key="$store.state.forceRerenderIndex">{{ data.index }}</div>
</div> </div>
<slot name="behindHeaderLeft" v-if="!isMax"></slot> <slot name="behindHeaderLeft" v-if="!isMax"></slot>
<el-tag class="ms-left-btn" size="small" :style="{'color': color, 'background-color': backgroundColor}">{{ title }}</el-tag> <el-tag class="ms-left-btn" size="small" :style="{'color': color, 'background-color': backgroundColor}">{{ title }}</el-tag>
@ -18,10 +18,8 @@
<span :class="showVersion?'scenario-unscroll':'scenario-version'" id="moveout" @mouseenter="enter($event)" @mouseleave="leave($event)" v-else> <span :class="showVersion?'scenario-unscroll':'scenario-version'" id="moveout" @mouseenter="enter($event)" @mouseleave="leave($event)" v-else>
<i class="el-icon-edit" style="cursor:pointer;" @click="editName" <i class="el-icon-edit" style="cursor:pointer;" @click="editName"
v-if="data.referenced!='REF' && !data.disabled"/> v-show="data.referenced!='REF' && !data.disabled"/>
<el-tooltip placement="top" :content="data.name">
<span>{{ data.name }}</span> <span>{{ data.name }}</span>
</el-tooltip>
<el-tag size="mini" v-if="data.method && !data.pluginId" style="margin-left: 1rem">{{ getMethod() }}</el-tag> <el-tag size="mini" v-if="data.method && !data.pluginId" style="margin-left: 1rem">{{ getMethod() }}</el-tag>
<slot name="afterTitle"/> <slot name="afterTitle"/>
</span> </span>
@ -38,7 +36,7 @@
<el-button v-if="showVersion" size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="padding: 5px" <el-button v-if="showVersion" size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="padding: 5px"
:disabled="(data.disabled && !data.root) || !showVersion "/> :disabled="(data.disabled && !data.root) || !showVersion "/>
<el-button v-if="showVersion && stepFilter.get('ALlSamplerStep').indexOf(data.type) !==-1" size="mini" icon="el-icon-delete" type="danger" style="padding: 5px" circle @click="remove"/> <el-button v-show="isSingleButton" size="mini" icon="el-icon-delete" type="danger" style="padding: 5px" circle @click="remove"/>
<step-extend-btns style="display: contents" <step-extend-btns style="display: contents"
:data="data" :data="data"
:environmentType="environmentType" :environmentType="environmentType"
@ -47,7 +45,7 @@
@copy="copyRow" @copy="copyRow"
@remove="remove" @remove="remove"
@openScenario="openScenario" @openScenario="openScenario"
v-if="showBtn && (!data.disabled || data.root) && showVersion && stepFilter.get('ALlSamplerStep').indexOf(data.type) ===-1"/> v-show="isMoreButton"/>
</div> </div>
</div> </div>
@ -87,6 +85,10 @@ export default {
}, },
props: { props: {
draggable: Boolean, draggable: Boolean,
innerStep: {
type: Boolean,
default: false,
},
isMax: { isMax: {
type: Boolean, type: Boolean,
default: false, default: false,
@ -145,7 +147,7 @@ export default {
} else { } else {
this.colorStyle = ""; this.colorStyle = "";
} }
} },
}, },
created() { created() {
if (!this.data.name) { if (!this.data.name) {
@ -162,6 +164,20 @@ export default {
} }
} }
}, },
computed: {
isSingleButton() {
if (this.data.type === 'ConstantTimer') {
return (this.innerStep && this.showVersion && this.stepFilter.get('ALlSamplerStep').indexOf(this.data.type) !== -1)
}
return (this.showVersion && this.stepFilter.get('ALlSamplerStep').indexOf(this.data.type) !== -1);
},
isMoreButton() {
if (this.data.type === 'ConstantTimer') {
return (!this.innerStep || this.showBtn && (!this.data.disabled || this.data.root) && this.showVersion && this.stepFilter.get('ALlSamplerStep').indexOf(this.data.type) === -1);
}
return (this.showBtn && (!this.data.disabled || this.data.root) && this.showVersion && this.stepFilter.get('ALlSamplerStep').indexOf(this.data.type) === -1);
},
},
methods: { methods: {
active() { active() {
this.$emit('active'); this.$emit('active');
@ -204,8 +220,6 @@ export default {
$event.currentTarget.className = "scenario-version" $event.currentTarget.className = "scenario-version"
} }
} }
} }
} }

View File

@ -20,7 +20,7 @@
:envMap="envMap" :envMap="envMap"
:title="$t('commons.scenario')"> :title="$t('commons.scenario')">
<template v-slot:afterTitle > <template v-slot:afterTitle>
<span v-if="isShowNum" @click="clickResource(scenario)">{{ " ID: " + scenario.num + "" }}</span> <span v-if="isShowNum" @click="clickResource(scenario)">{{ " ID: " + scenario.num + "" }}</span>
<span v-else> <span v-else>
<el-tooltip class="ms-num" effect="dark" :content="$t('api_test.automation.scenario.num_none')" placement="top"> <el-tooltip class="ms-num" effect="dark" :content="$t('api_test.automation.scenario.num_none')" placement="top">
@ -110,11 +110,13 @@ export default {
} }
this.reload(); this.reload();
}, },
'node.data.isBatchProcess'() {
if (this.node.data && this.node.data.isBatchProcess && this.node.data.referenced === 'REF') {
this.node.expanded = false;
}
}
}, },
created() { created() {
/*if (!this.scenario.projectId) {
this.scenario.projectId = getCurrentProjectID();
}*/
if (this.scenario.num) { if (this.scenario.num) {
this.isShowNum = true; this.isShowNum = true;
this.getWorkspaceId(this.scenario.projectId); this.getWorkspaceId(this.scenario.projectId);
@ -132,7 +134,7 @@ export default {
isShowInput: false, isShowInput: false,
isShowNum: false, isShowNum: false,
stepFilter: new STEP, stepFilter: new STEP,
dataWorkspaceId:'', dataWorkspaceId: '',
} }
}, },
computed: { computed: {
@ -146,7 +148,7 @@ export default {
}, },
methods: { methods: {
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'));
return; return;
} }
@ -202,7 +204,11 @@ export default {
}, },
active() { active() {
if (this.node) { if (this.node) {
this.node.expanded = !this.node.expanded; if (this.node.data && this.node.data.isBatchProcess && this.node.data.referenced === 'REF') {
this.node.expanded = false;
} else {
this.node.expanded = !this.node.expanded;
}
} }
this.reload(); this.reload();
}, },
@ -257,7 +263,7 @@ export default {
clickResource(resource) { clickResource(resource) {
let automationData = this.$router.resolve({ let automationData = this.$router.resolve({
name: 'ApiAutomation', name: 'ApiAutomation',
params: {redirectID: getUUID(), dataType: "scenario", dataSelectRange: 'edit:' + resource.id, projectId: resource.projectId,workspaceId:this.dataWorkspaceId } params: {redirectID: getUUID(), dataType: "scenario", dataSelectRange: 'edit:' + resource.id, projectId: resource.projectId, workspaceId: this.dataWorkspaceId}
}); });
window.open(automationData.href, '_blank'); window.open(automationData.href, '_blank');
}, },

View File

@ -6,6 +6,7 @@
:draggable="draggable" :draggable="draggable"
:show-collapse="false" :show-collapse="false"
:is-max="isMax" :is-max="isMax"
:inner-step="innerStep"
color="#67C23A" color="#67C23A"
background-color="#F2F9EE" background-color="#F2F9EE"
:title="$t('api_test.automation.wait_controller')"> :title="$t('api_test.automation.wait_controller')">
@ -26,6 +27,10 @@ export default {
components: {ApiBaseComponent}, components: {ApiBaseComponent},
props: { props: {
timer: {}, timer: {},
innerStep: {
type: Boolean,
default: false,
},
node: {}, node: {},
isMax: { isMax: {
type: Boolean, type: Boolean,

View File

@ -123,7 +123,7 @@
:draggable="false" :draggable="false"
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @remove="remove" @copyRow="copyRow" @suggestClick="suggestClick"
@refReload="refReload" @openScenario="openScenario" @refReload="refReload" @openScenario="openScenario"
v-if="selectedTreeNode && selectedNode && stepFilter.get('ALlSamplerStep').indexOf(item.type) ===-1"/> v-show="selectedTreeNode && selectedNode && stepFilter.get('ALlSamplerStep').indexOf(item.type) ===-1"/>
</div> </div>
</div> </div>
</div> </div>

View File

@ -53,7 +53,7 @@
color="#B8741A" color="#B8741A"
background-color="#F9F1EA"/> background-color="#F9F1EA"/>
<ms-constant-timer :timer="data" :node="node" v-if="data.type ==='ConstantTimer'" @remove="remove"/> <ms-constant-timer :inner-step="true" :timer="data" :node="node" v-if="data.type ==='ConstantTimer'" @remove="remove"/>
</div> </div>
<div v-if="tabType ==='post'"> <div v-if="tabType ==='post'">
@ -225,7 +225,7 @@ export default {
this.$emit('reload'); this.$emit('reload');
}, },
add() { add() {
this.request.active = false; this.request.active = true;
if (this.tabType === 'pre') { if (this.tabType === 'pre') {
if (this.preOperate === 'script') { if (this.preOperate === 'script') {
this.addPre(); this.addPre();
@ -340,6 +340,7 @@ export default {
this.request.hashTree.splice(index, 1); this.request.hashTree.splice(index, 1);
this.sort(); this.sort();
this.reload(); this.reload();
this.forceRerender();
}, },
copyRow(row) { copyRow(row) {
let obj = JSON.parse(JSON.stringify(row)); let obj = JSON.parse(JSON.stringify(row));
@ -352,6 +353,7 @@ export default {
} }
this.sort(); this.sort();
this.reload(); this.reload();
this.forceRerender();
}, },
allowDrop(draggingNode, dropNode, dropType) { allowDrop(draggingNode, dropNode, dropType) {
// //
@ -364,8 +366,14 @@ export default {
if (dropNode && draggingNode && dropType) { if (dropNode && draggingNode && dropType) {
this.reload(); this.reload();
this.filter(); this.filter();
this.forceRerender();
} }
}, },
forceRerender() {
this.$nextTick(() => {
this.$store.state.forceRerenderIndex = getUUID();
});
},
reload() { reload() {
this.isReloadData = true this.isReloadData = true
this.$nextTick(() => { this.$nextTick(() => {

View File

@ -29,7 +29,6 @@ import formCreate from "@form-create/element-ui"
import mavonEditor from 'mavon-editor' import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css' import 'mavon-editor/dist/css/index.css'
import 'element-ui/lib/theme-chalk/display.css'; import 'element-ui/lib/theme-chalk/display.css';
import 'default-passive-events'
Vue.use(mavonEditor) Vue.use(mavonEditor)
Vue.use(vueMinderEditor) Vue.use(vueMinderEditor)

View File

@ -1316,8 +1316,10 @@ export default {
case_reduction_error_text: "Please restore first" case_reduction_error_text: "Please restore first"
}, },
automation: { automation: {
open_expansion: "One-click expansion", open_expansion: "Batch Folding Steps",
close_expansion: "One-click storage", close_expansion: "Bulk Expand Steps",
bulk_activation_steps: "Bulk activation steps",
batch_disable_steps: "Batch disable steps",
all: "all", all: "all",
constant: "constant", constant: "constant",
counter: "counter", counter: "counter",
@ -1463,6 +1465,7 @@ export default {
scenario_error: "Cannot reference or copy itself", scenario_error: "Cannot reference or copy itself",
integrated: "Integrated", integrated: "Integrated",
independent: "Independent", independent: "Independent",
step_info: "Add a scene step on the right",
}, },
request: { request: {
debug: "Debug", debug: "Debug",

View File

@ -1321,8 +1321,10 @@ export default {
case_reduction_error_text: "请先恢复" case_reduction_error_text: "请先恢复"
}, },
automation: { automation: {
open_expansion: "一键展开", open_expansion: "批量展开步骤",
close_expansion: "一键收起", close_expansion: "批量折叠步骤",
bulk_activation_steps: "批量启用步骤",
batch_disable_steps: "批量禁用步骤",
all: "全部", all: "全部",
constant: "常量", constant: "常量",
counter: "计数器", counter: "计数器",
@ -1467,6 +1469,7 @@ export default {
scenario_error: "不能引用或复制自身!", scenario_error: "不能引用或复制自身!",
integrated: "集合", integrated: "集合",
independent: "独立", independent: "独立",
step_info: "在右侧添加场景步骤",
}, },
request: { request: {
debug: "调试", debug: "调试",

View File

@ -1321,8 +1321,10 @@ export default {
case_reduction_error_text: "請先恢復" case_reduction_error_text: "請先恢復"
}, },
automation: { automation: {
open_expansion: "一鍵展開", open_expansion: "批量展開步驟",
close_expansion: "一鍵收起", close_expansion: "批量折疊步驟",
bulk_activation_steps: "批量啟用步驟",
batch_disable_steps: "批量禁用步驟",
all: "全部", all: "全部",
constant: "常量", constant: "常量",
counter: "計數器", counter: "計數器",
@ -1467,6 +1469,7 @@ export default {
scenario_error: "不能引用或復製自身!", scenario_error: "不能引用或復製自身!",
integrated: "集合", integrated: "集合",
independent: "獨立", independent: "獨立",
step_info: "在右側添加場景步驟",
}, },
request: { request: {
debug: "調試", debug: "調試",

View File

@ -34,7 +34,8 @@ const state = {
apiStatus: new Map(), apiStatus: new Map(),
testCaseMap: new Map(), testCaseMap: new Map(),
curTabId: null, curTabId: null,
testCaseDefaultValue: {} testCaseDefaultValue: {},
forceRerenderIndex: "",
} }
const store = new Vuex.Store({ const store = new Vuex.Store({