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",
"axios": "^0.21.3",
"core-js": "^3.4.3",
"default-passive-events": "^2.0.0",
"diffable-html": "^4.0.0",
"echarts": "^5.0.2",
"el-table-infinite-scroll": "^1.0.10",

View File

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

View File

@ -1,117 +1,117 @@
export function STEP() {
let map = new Map([
['ALL', init()],
['scenario', init()],
['HTTPSamplerProxy', getDefaultSamplerMenu()],
['DubboSampler', getDefaultSamplerMenu()],
['JDBCSampler', getDefaultSamplerMenu()],
['TCPSampler', getDefaultSamplerMenu()],
['OT_IMPORT', getDefaultSamplerMenu()],
['AbstractSampler', getDefaultSamplerMenu()],
['IfController', getAll()],
['TransactionController', getAll()],
['LoopController', getAll()],
['ConstantTimer', []],
['JSR223Processor', getDefaultSamplerMenu()],
['JSR223PreProcessor', []],
['JSR223PostProcessor', []],
['JDBCPreProcessor', []],
['JDBCPostProcessor', []],
['Assertions', []],
['Extract', []],
['JmeterElement', []],
['CustomizeReq', getDefaultSamplerMenu()],
['MaxSamplerProxy', getDefaultSamplerMenu()],
['GenericController', getAll()],
['AllSamplerProxy', ['HTTPSamplerProxy', 'DubboSampler', 'JDBCSampler', 'TCPSampler', 'Sampler', 'AbstractSampler', 'JSR223Processor', 'API']],
['DEFINITION', ['HTTPSamplerProxy', 'DubboSampler', 'JDBCSampler', 'TCPSampler']],
['ALlSamplerStep', ['JSR223Processor', 'JSR223PreProcessor', 'JSR223PostProcessor', 'JDBCPreProcessor', 'JDBCPostProcessor', 'Assertions', 'Extract','ConstantTimer']],
['AllCanExecType', ['HTTPSamplerProxy', 'DubboSampler', 'JDBCSampler', 'TCPSampler', 'JSR223Processor', 'AbstractSampler']]]);
return map
let map = new Map([
['ALL', init()],
['scenario', init()],
['HTTPSamplerProxy', getDefaultSamplerMenu()],
['DubboSampler', getDefaultSamplerMenu()],
['JDBCSampler', getDefaultSamplerMenu()],
['TCPSampler', getDefaultSamplerMenu()],
['OT_IMPORT', getDefaultSamplerMenu()],
['AbstractSampler', getDefaultSamplerMenu()],
['IfController', getAll()],
['TransactionController', getAll()],
['LoopController', getAll()],
['ConstantTimer', []],
['JSR223Processor', getDefaultSamplerMenu()],
['JSR223PreProcessor', []],
['JSR223PostProcessor', []],
['JDBCPreProcessor', []],
['JDBCPostProcessor', []],
['Assertions', []],
['Extract', []],
['JmeterElement', []],
['CustomizeReq', getDefaultSamplerMenu()],
['MaxSamplerProxy', getDefaultSamplerMenu()],
['GenericController', getAll()],
['AllSamplerProxy', ['HTTPSamplerProxy', 'DubboSampler', 'JDBCSampler', 'TCPSampler', 'Sampler', 'AbstractSampler', 'JSR223Processor', 'API']],
['DEFINITION', ['HTTPSamplerProxy', 'DubboSampler', 'JDBCSampler', 'TCPSampler']],
['ALlSamplerStep', ['JSR223PreProcessor', 'JSR223PostProcessor', 'JDBCPreProcessor', 'JDBCPostProcessor', 'Assertions', 'Extract', 'ConstantTimer']],
['AllCanExecType', ['HTTPSamplerProxy', 'DubboSampler', 'JDBCSampler', 'TCPSampler', 'JSR223Processor', 'AbstractSampler']]]);
return map
}
export const ELEMENT_TYPE = {
scenario: 'scenario',
HTTPSamplerProxy: 'HTTPSamplerProxy',
OT_IMPORT: 'OT_IMPORT',
IfController: 'IfController',
TransactionController: 'TransactionController',
ConstantTimer: 'ConstantTimer',
JSR223Processor: 'JSR223Processor',
JSR223PreProcessor: 'JSR223PreProcessor',
JSR223PostProcessor: 'JSR223PostProcessor',
JDBCPostProcessor: 'JDBCPostProcessor',
JDBCPreProcessor: 'JDBCPreProcessor',
Assertions: 'Assertions',
Extract: 'Extract',
CustomizeReq: 'CustomizeReq',
LoopController: 'LoopController',
Plugin: 'Plugin'
scenario: 'scenario',
HTTPSamplerProxy: 'HTTPSamplerProxy',
OT_IMPORT: 'OT_IMPORT',
IfController: 'IfController',
TransactionController: 'TransactionController',
ConstantTimer: 'ConstantTimer',
JSR223Processor: 'JSR223Processor',
JSR223PreProcessor: 'JSR223PreProcessor',
JSR223PostProcessor: 'JSR223PostProcessor',
JDBCPostProcessor: 'JDBCPostProcessor',
JDBCPreProcessor: 'JDBCPreProcessor',
Assertions: 'Assertions',
Extract: 'Extract',
CustomizeReq: 'CustomizeReq',
LoopController: 'LoopController',
Plugin: 'Plugin'
}
export const TYPE_TO_C = new Map([
['scenario', 'io.metersphere.api.dto.definition.request.MsScenario'],
['HTTPSamplerProxy', 'io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy'],
['DubboSampler', 'io.metersphere.api.dto.definition.request.sampler.MsDubboSampler'],
['JDBCSampler', 'io.metersphere.api.dto.definition.request.sampler.MsJDBCSampler'],
['TCPSampler', 'io.metersphere.api.dto.definition.request.sampler.MsTCPSampler'],
['IfController', 'io.metersphere.api.dto.definition.request.controller.MsIfController'],
['TransactionController', 'io.metersphere.api.dto.definition.request.controller.MsTransactionController'],
['LoopController', 'io.metersphere.api.dto.definition.request.controller.MsLoopController'],
['ConstantTimer', 'io.metersphere.api.dto.definition.request.timer.MsConstantTimer'],
['JSR223Processor', 'io.metersphere.api.dto.definition.request.processors.MsJSR223Processor'],
['JSR223PreProcessor', 'io.metersphere.api.dto.definition.request.processors.pre.MsJSR223PreProcessor'],
['JSR223PostProcessor', 'io.metersphere.api.dto.definition.request.processors.post.MsJSR223PostProcessor'],
['JDBCPreProcessor', 'io.metersphere.api.dto.definition.request.processors.pre.MsJDBCPreProcessor'],
['JDBCPostProcessor', 'io.metersphere.api.dto.definition.request.processors.post.MsJDBCPostProcessor'],
['Assertions', 'io.metersphere.api.dto.definition.request.assertions.MsAssertions'],
['Extract', 'io.metersphere.api.dto.definition.request.extract.MsExtract'],
['JmeterElement', 'io.metersphere.api.dto.definition.request.unknown.MsJmeterElement'],
['TestPlan', 'io.metersphere.api.dto.definition.request.MsTestPlan'],
['ThreadGroup', 'io.metersphere.api.dto.definition.request.MsThreadGroup'],
['DNSCacheManager', 'io.metersphere.api.dto.definition.request.dns.MsDNSCacheManager'],
['DebugSampler', 'io.metersphere.api.dto.definition.request.sampler.MsDebugSampler'],
['AuthManager', 'io.metersphere.api.dto.definition.request.auth.MsAuthManager']
['scenario', 'io.metersphere.api.dto.definition.request.MsScenario'],
['HTTPSamplerProxy', 'io.metersphere.api.dto.definition.request.sampler.MsHTTPSamplerProxy'],
['DubboSampler', 'io.metersphere.api.dto.definition.request.sampler.MsDubboSampler'],
['JDBCSampler', 'io.metersphere.api.dto.definition.request.sampler.MsJDBCSampler'],
['TCPSampler', 'io.metersphere.api.dto.definition.request.sampler.MsTCPSampler'],
['IfController', 'io.metersphere.api.dto.definition.request.controller.MsIfController'],
['TransactionController', 'io.metersphere.api.dto.definition.request.controller.MsTransactionController'],
['LoopController', 'io.metersphere.api.dto.definition.request.controller.MsLoopController'],
['ConstantTimer', 'io.metersphere.api.dto.definition.request.timer.MsConstantTimer'],
['JSR223Processor', 'io.metersphere.api.dto.definition.request.processors.MsJSR223Processor'],
['JSR223PreProcessor', 'io.metersphere.api.dto.definition.request.processors.pre.MsJSR223PreProcessor'],
['JSR223PostProcessor', 'io.metersphere.api.dto.definition.request.processors.post.MsJSR223PostProcessor'],
['JDBCPreProcessor', 'io.metersphere.api.dto.definition.request.processors.pre.MsJDBCPreProcessor'],
['JDBCPostProcessor', 'io.metersphere.api.dto.definition.request.processors.post.MsJDBCPostProcessor'],
['Assertions', 'io.metersphere.api.dto.definition.request.assertions.MsAssertions'],
['Extract', 'io.metersphere.api.dto.definition.request.extract.MsExtract'],
['JmeterElement', 'io.metersphere.api.dto.definition.request.unknown.MsJmeterElement'],
['TestPlan', 'io.metersphere.api.dto.definition.request.MsTestPlan'],
['ThreadGroup', 'io.metersphere.api.dto.definition.request.MsThreadGroup'],
['DNSCacheManager', 'io.metersphere.api.dto.definition.request.dns.MsDNSCacheManager'],
['DebugSampler', 'io.metersphere.api.dto.definition.request.sampler.MsDebugSampler'],
['AuthManager', 'io.metersphere.api.dto.definition.request.auth.MsAuthManager']
])
export const PLUGIN_ELEMENTS = new Map([
['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_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_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_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_threads', ['SetupThreadGroup', 'PostThreadGroup', 'ThreadGroup']],
['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_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_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_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_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_threads', ['SetupThreadGroup', 'PostThreadGroup', 'ThreadGroup']],
['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']],
])
export function getDefaultSamplerMenu() {
let array = [];
array = array.concat(PLUGIN_ELEMENTS.get('menu_assertions'));
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_config_element'));
array = array.concat(PLUGIN_ELEMENTS.get('menu_listener'));
return array;
let array = [];
array = array.concat(PLUGIN_ELEMENTS.get('menu_assertions'));
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_config_element'));
array = array.concat(PLUGIN_ELEMENTS.get('menu_listener'));
return array;
}
export function init() {
let allArray = [];
allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_generative_controller'));
allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_logic_controller'));
allArray = allArray.concat(['scenario', 'ConstantTimer', 'JSR223Processor']);
return allArray;
let allArray = [];
allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_generative_controller'));
allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_logic_controller'));
allArray = allArray.concat(['scenario', 'ConstantTimer', 'JSR223Processor']);
return allArray;
}
export function getAll() {
let allArray = [];
allArray = allArray.concat(getDefaultSamplerMenu());
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_generative_controller'));
allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_threads'));
return allArray;
let allArray = [];
allArray = allArray.concat(getDefaultSamplerMenu());
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_generative_controller'));
allArray = allArray.concat(PLUGIN_ELEMENTS.get('menu_threads'));
return allArray;
}

View File

@ -3,7 +3,7 @@
<div class="header" @click="active(data)">
<slot name="beforeHeaderLeft">
<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>
<slot name="behindHeaderLeft" v-if="!isMax"></slot>
<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>
<i class="el-icon-edit" style="cursor:pointer;" @click="editName"
v-if="data.referenced!='REF' && !data.disabled"/>
<el-tooltip placement="top" :content="data.name">
v-show="data.referenced!='REF' && !data.disabled"/>
<span>{{ data.name }}</span>
</el-tooltip>
<el-tag size="mini" v-if="data.method && !data.pluginId" style="margin-left: 1rem">{{ getMethod() }}</el-tag>
<slot name="afterTitle"/>
</span>
@ -38,7 +36,7 @@
<el-button v-if="showVersion" size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="padding: 5px"
: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"
:data="data"
:environmentType="environmentType"
@ -47,7 +45,7 @@
@copy="copyRow"
@remove="remove"
@openScenario="openScenario"
v-if="showBtn && (!data.disabled || data.root) && showVersion && stepFilter.get('ALlSamplerStep').indexOf(data.type) ===-1"/>
v-show="isMoreButton"/>
</div>
</div>
@ -87,6 +85,10 @@ export default {
},
props: {
draggable: Boolean,
innerStep: {
type: Boolean,
default: false,
},
isMax: {
type: Boolean,
default: false,
@ -145,7 +147,7 @@ export default {
} else {
this.colorStyle = "";
}
}
},
},
created() {
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: {
active() {
this.$emit('active');
@ -204,8 +220,6 @@ export default {
$event.currentTarget.className = "scenario-version"
}
}
}
}

View File

@ -20,7 +20,7 @@
:envMap="envMap"
: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-else>
<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();
},
'node.data.isBatchProcess'() {
if (this.node.data && this.node.data.isBatchProcess && this.node.data.referenced === 'REF') {
this.node.expanded = false;
}
}
},
created() {
/*if (!this.scenario.projectId) {
this.scenario.projectId = getCurrentProjectID();
}*/
if (this.scenario.num) {
this.isShowNum = true;
this.getWorkspaceId(this.scenario.projectId);
@ -132,7 +134,7 @@ export default {
isShowInput: false,
isShowNum: false,
stepFilter: new STEP,
dataWorkspaceId:'',
dataWorkspaceId: '',
}
},
computed: {
@ -146,7 +148,7 @@ export default {
},
methods: {
run() {
if(!this.scenario.enable){
if (!this.scenario.enable) {
this.$warning(this.$t('api_test.automation.debug_message'));
return;
}
@ -202,7 +204,11 @@ export default {
},
active() {
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();
},
@ -257,7 +263,7 @@ export default {
clickResource(resource) {
let automationData = this.$router.resolve({
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');
},

View File

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

View File

@ -123,7 +123,7 @@
:draggable="false"
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick"
@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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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