fix(接口测试): 【【接口测试】github#27933,【接口自动化】当场景有很多自定义请求时,点击调试后,点击推荐jsonpath提取,会出现"请先执行调试获取响应结果"的提示,以及出现了jsonpath提取内容与响应内容不对应的问题】
--bug=1033563 --user=白奇 【接口测试】github#27933,【接口自动化】当场景有很多自定义请求时,点击调试后,点击推荐jsonpath提取,会出现"请先执行调试获取响应结果"的提示,以及出现了jsonpath提取内容与响应内容不对应的问题 https://www.tapd.cn/55049933/s/1443650
This commit is contained in:
parent
dc7e258719
commit
80d964fcd3
|
@ -251,7 +251,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-content white-space" >
|
||||
<div class="card-content white-space">
|
||||
<!-- 场景步骤-->
|
||||
<div v-loading="loading">
|
||||
<el-row>
|
||||
|
@ -1515,14 +1515,17 @@ export default {
|
|||
this.showAll();
|
||||
this.buttonData = buttons(this);
|
||||
this.initPlugins();
|
||||
if (e && e.target.className && e.target.className.split(" ")[1] === "white--space") {
|
||||
if (e && e.target.className && e.target.className.split(' ')[1] === 'white--space') {
|
||||
this.selectedTreeNode = undefined;
|
||||
this.selectedNode = undefined;
|
||||
}
|
||||
},
|
||||
fabClick() {
|
||||
if (this.operatingElements && this.operatingElements.length < 1) {
|
||||
if ((this.selectedTreeNode && this.selectedTreeNode.referenced === 'REF') || (this.selectedNode.disabled && this.selectedTreeNode.disabled)) {
|
||||
if (
|
||||
(this.selectedTreeNode && this.selectedTreeNode.referenced === 'REF') ||
|
||||
(this.selectedNode.disabled && this.selectedTreeNode.disabled)
|
||||
) {
|
||||
this.$warning(this.$t('api_test.scenario.scenario_warning'));
|
||||
} else {
|
||||
this.$warning(this.$t('api_test.scenario.scenario_step_warning'));
|
||||
|
@ -2016,6 +2019,7 @@ export default {
|
|||
}
|
||||
}
|
||||
if (this.scenarioDefinition !== null) {
|
||||
this.stepCount = 0;
|
||||
this.dataProcessing(this.scenarioDefinition);
|
||||
}
|
||||
// 保存成功后刷新历史版本
|
||||
|
|
|
@ -256,60 +256,15 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
this.request.protocol = this.request.protocol === 'ESB' ? 'TCP' : this.request.protocol;
|
||||
// 历史数据兼容
|
||||
if (!this.request.requestResult) {
|
||||
this.request.requestResult = [{ responseResult: {} }];
|
||||
} else if (
|
||||
this.request.requestResult &&
|
||||
Object.prototype.toString.call(this.request.requestResult) !== '[object Array]'
|
||||
) {
|
||||
let obj = JSON.parse(JSON.stringify(this.request.requestResult));
|
||||
this.request.requestResult = [obj];
|
||||
}
|
||||
// 跨项目关联,如果没有ID,则赋值本项目ID
|
||||
if (!this.request.projectId) {
|
||||
this.request.projectId = getCurrentProjectID();
|
||||
}
|
||||
this.request.customizeReq = this.isCustomizeReq;
|
||||
if (this.request.customizeReq) {
|
||||
if (this.node.parent && this.node.parent.data && this.node.parent.data.length > 1) {
|
||||
this.request.projectId = getCurrentProjectID();
|
||||
} else {
|
||||
this.request.projectId =
|
||||
this.node.parent.data instanceof Array ? this.node.parent.data[0].projectId : this.node.parent.data.projectId;
|
||||
}
|
||||
}
|
||||
if (this.currentScenario) {
|
||||
this.request.currentScenarioId = this.currentScenario.id;
|
||||
}
|
||||
// 传递场景ID
|
||||
if (this.request.hashTree) {
|
||||
this.setOwnEnvironment(this.request.hashTree);
|
||||
}
|
||||
if (this.request.id && this.request.referenced === 'REF') {
|
||||
this.request.disabled = true;
|
||||
this.request.root = this.node.parent.parent ? false : true;
|
||||
this.request.showExtend =
|
||||
this.node.parent && this.node.parent.data && this.node.parent.data.disabled ? false : true;
|
||||
}
|
||||
this.isShowNum = this.request.num ? true : false;
|
||||
if (this.request.protocol === 'HTTP') {
|
||||
// 历史数据 auth 处理
|
||||
if (this.request.hashTree) {
|
||||
for (let index in this.request.hashTree) {
|
||||
if (this.request.hashTree[index].type == 'AuthManager') {
|
||||
this.request.authManager = this.request.hashTree[index];
|
||||
this.request.hashTree.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.request.requestResult && this.request.requestResult.length > 0) {
|
||||
this.response = this.request.requestResult[0];
|
||||
}
|
||||
this.init();
|
||||
},
|
||||
watch: {
|
||||
request: {
|
||||
handler() {
|
||||
this.init();
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
message() {
|
||||
this.forStatus();
|
||||
this.reload();
|
||||
|
@ -374,6 +329,62 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.request.protocol = this.request.protocol === 'ESB' ? 'TCP' : this.request.protocol;
|
||||
// 历史数据兼容
|
||||
if (!this.request.requestResult) {
|
||||
this.request.requestResult = [{ responseResult: {} }];
|
||||
} else if (
|
||||
this.request.requestResult &&
|
||||
Object.prototype.toString.call(this.request.requestResult) !== '[object Array]'
|
||||
) {
|
||||
let obj = JSON.parse(JSON.stringify(this.request.requestResult));
|
||||
this.request.requestResult = [obj];
|
||||
}
|
||||
// 跨项目关联,如果没有ID,则赋值本项目ID
|
||||
if (!this.request.projectId) {
|
||||
this.request.projectId = getCurrentProjectID();
|
||||
}
|
||||
this.request.customizeReq = this.isCustomizeReq;
|
||||
if (this.request.customizeReq) {
|
||||
if (this.node.parent && this.node.parent.data && this.node.parent.data.length > 1) {
|
||||
this.request.projectId = getCurrentProjectID();
|
||||
} else {
|
||||
this.request.projectId =
|
||||
this.node.parent.data instanceof Array
|
||||
? this.node.parent.data[0].projectId
|
||||
: this.node.parent.data.projectId;
|
||||
}
|
||||
}
|
||||
if (this.currentScenario) {
|
||||
this.request.currentScenarioId = this.currentScenario.id;
|
||||
}
|
||||
// 传递场景ID
|
||||
if (this.request.hashTree) {
|
||||
this.setOwnEnvironment(this.request.hashTree);
|
||||
}
|
||||
if (this.request.id && this.request.referenced === 'REF') {
|
||||
this.request.disabled = true;
|
||||
this.request.root = this.node.parent.parent ? false : true;
|
||||
this.request.showExtend =
|
||||
this.node.parent && this.node.parent.data && this.node.parent.data.disabled ? false : true;
|
||||
}
|
||||
this.isShowNum = this.request.num ? true : false;
|
||||
if (this.request.protocol === 'HTTP') {
|
||||
// 历史数据 auth 处理
|
||||
if (this.request.hashTree) {
|
||||
for (let index in this.request.hashTree) {
|
||||
if (this.request.hashTree[index].type == 'AuthManager') {
|
||||
this.request.authManager = this.request.hashTree[index];
|
||||
this.request.hashTree.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.request.requestResult && this.request.requestResult.length > 0) {
|
||||
this.response = this.request.requestResult[0];
|
||||
}
|
||||
},
|
||||
setOwnEnvironment(scenarioDefinition) {
|
||||
for (let i in scenarioDefinition) {
|
||||
let typeArray = ['JDBCPostProcessor', 'JDBCSampler', 'JDBCPreProcessor'];
|
||||
|
|
Loading…
Reference in New Issue