fix(接口测试): 修复复制的场景无法添加断言的缺陷

--bug=1013423 --user=王孝刚
【接口测试】场景中A存在引用/复制场景B-在场景中A中添加场景断言后-在引用/复制场景B中添加场景断言-添加失败
https://www.tapd.cn/55049933/s/1164041
This commit is contained in:
wxg0103 2022-05-25 17:25:30 +08:00 committed by f2c-ci-robot[bot]
parent 5040e2aa5e
commit 0ac2c9c595
1 changed files with 38 additions and 21 deletions

View File

@ -229,6 +229,7 @@
@setDomain="setDomain" @setDomain="setDomain"
@openScenario="openScenario" @openScenario="openScenario"
@editScenarioAdvance="editScenarioAdvance" @editScenarioAdvance="editScenarioAdvance"
ref="componentConfig"
v-if="stepFilter.get('ALlSamplerStep').indexOf(data.type) ===-1 v-if="stepFilter.get('ALlSamplerStep').indexOf(data.type) ===-1
|| (!node.parent || !node.parent.data || stepFilter.get('AllSamplerProxy').indexOf(node.parent.data.type) === -1)" || (!node.parent || !node.parent.data || stepFilter.get('AllSamplerProxy').indexOf(node.parent.data.type) === -1)"
/> />
@ -1143,35 +1144,51 @@ export default {
} }
} }
}, },
addComponent(type, plugin) { scenarioAssertion(type, plugin, isAssertions, data) {
let isAssertions = false; let isChildren = true;
if (type === 'Assertions') { if (!data) {
this.scenarioDefinition.forEach(item => { data = this.scenarioDefinition;
isChildren = false;
}
data.forEach(item => {
if (item.type === type) { if (item.type === type) {
item.active = true; item.active = true;
item.scenarioAss = true; item.scenarioAss = true;
isAssertions = true; isAssertions = true;
}
if (!isChildren) {
this.reloadTree = getUUID(); this.reloadTree = getUUID();
} }
}) })
if (!isAssertions) { if (!isAssertions) {
setComponent(type, this, plugin); setComponent(type, this, plugin);
for (let i in this.scenarioDefinition) { for (let i in data) {
if (this.scenarioDefinition[i].type === "Assertions") { if (data[i].type === "Assertions") {
this.scenarioDefinition[i].active = true; data[i].active = true;
this.scenarioDefinition[i].scenarioAss = true; data[i].scenarioAss = true;
let assertions = this.scenarioDefinition[i]; let assertions = data[i];
this.scenarioDefinition.splice(i, 1); data.splice(i, 1);
this.scenarioDefinition.unshift(assertions); data.unshift(assertions);
this.sort(); this.sort();
} }
} }
} }
},
addComponent(type, plugin) {
let isAssertions = false;
if (type === 'Assertions') {
if (this.selectedTreeNode !== undefined && this.selectedTreeNode.type === 'scenario' && this.selectedTreeNode.referenced === 'Copy') {
this.selectedTreeNode.active = true;
this.scenarioAssertion(type, plugin, isAssertions, this.selectedTreeNode.hashTree);
this.selectedNode.expanded = true;
this.cancelBatchProcessing();
} else {
this.scenarioAssertion(type, plugin, isAssertions);
}
} else { } else {
setComponent(type, this, plugin); setComponent(type, this, plugin);
} }
}, },
nodeClick(data, node) { nodeClick(data, node) {
if ((data.referenced != 'REF' && data.referenced != 'Deleted' && !data.disabled && this.stepFilter) || data.refType === 'CASE') { if ((data.referenced != 'REF' && data.referenced != 'Deleted' && !data.disabled && this.stepFilter) || data.refType === 'CASE') {
this.operatingElements = this.stepFilter.get(data.type); this.operatingElements = this.stepFilter.get(data.type);