fix(接口定义): 修复json文档断言修改root层级的期望值保存失效的缺陷
--bug=1019961 --user=王孝刚 [接口测试] GitHub#19876接口定义,接口用例,json文档结构校验,在预期结果处输入值后,再打开,值不见了。 https://www.tapd.cn/55049933/s/1301119
This commit is contained in:
parent
46fdb49152
commit
41990ea2c4
|
@ -230,13 +230,20 @@ export function stepCompute(array, request) {
|
|||
request.ruleSize = ruleSize;
|
||||
}
|
||||
|
||||
export function mergeDocumentData(originalData, childMap, rootName, rootType) {
|
||||
export function mergeDocumentData(originalData, childMap, rootData) {
|
||||
originalData.forEach((item) => {
|
||||
if (item.id === 'root') {
|
||||
item.name = rootName;
|
||||
item.type = rootType;
|
||||
item.type = rootData.type;
|
||||
item.name = rootData.name;
|
||||
item.typeVerification = rootData.typeVerification;
|
||||
item.arrayVerification = rootData.arrayVerification;
|
||||
item.contentVerification = rootData.contentVerification;
|
||||
item.jsonPath = rootData.jsonPath;
|
||||
item.expectedOutcome = rootData.expectedOutcome;
|
||||
item.include = rootData.include;
|
||||
item.conditions = rootData.conditions;
|
||||
}
|
||||
if (childMap && childMap.has(item.id)) {
|
||||
if (childMap && childMap.size !== 0 && childMap.has(item.id)) {
|
||||
let sourceData = JSON.parse(JSON.stringify(item.children));
|
||||
item.children = JSON.parse(JSON.stringify(childMap.get(item.id)));
|
||||
item.children.forEach((target) => {
|
||||
|
@ -256,19 +263,13 @@ export function mergeRequestDocumentData(request) {
|
|||
if (request && request.hashTree && request.hashTree.length > 0) {
|
||||
let index = request.hashTree.findIndex((item) => item.type === 'Assertions');
|
||||
if (index !== -1) {
|
||||
if (
|
||||
request.hashTree[index].document &&
|
||||
request.hashTree[index].document.originalData &&
|
||||
request.hashTree[index].document.tableData.size &&
|
||||
request.hashTree[index].document.tableData.size !== 0
|
||||
) {
|
||||
if (request.hashTree[index].document && request.hashTree[index].document.originalData) {
|
||||
mergeDocumentData(
|
||||
request.hashTree[index].document.originalData,
|
||||
request.hashTree[index].document.tableData,
|
||||
request.hashTree[index].document.rootName,
|
||||
request.hashTree[index].document.rootType
|
||||
request.hashTree[index].document.rootData
|
||||
);
|
||||
if (request.hashTree[index].document.type === 'json') {
|
||||
if (request.hashTree[index].document.type === 'JSON') {
|
||||
request.hashTree[index].document.data.json = request.hashTree[index].document.originalData;
|
||||
} else {
|
||||
request.hashTree[index].document.data.xml = request.hashTree[index].document.originalData;
|
||||
|
|
|
@ -284,6 +284,9 @@ export default {
|
|||
// hasChildren 表示需要展示一个箭头图标
|
||||
item.hasChildren = item.children && item.children.length > 0;
|
||||
item.idList = [item.id];
|
||||
if (item.id === 'root') {
|
||||
this.$set(this.document, 'rootData', item);
|
||||
}
|
||||
item.children = [];
|
||||
return item;
|
||||
});
|
||||
|
@ -324,8 +327,7 @@ export default {
|
|||
// 渲染子节点
|
||||
resolve(resolveArr);
|
||||
if (tree.id === 'root') {
|
||||
this.$set(this.document, 'rootName', tree.name);
|
||||
this.$set(this.document, 'rootType', tree.type);
|
||||
this.$set(this.document, 'rootData', tree);
|
||||
}
|
||||
this.mapData.set(tree.id, resolveArr);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue