From 306c46d22d00992670bdf4a1eb581132bcf6d2b5 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Fri, 5 May 2023 14:05:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=BA=E6=99=AF=E6=89=A7=E8=A1=8C=E5=8D=95?= =?UTF-8?q?=E6=AD=A5=E9=AA=A4=E6=97=B6=E6=8F=90=E7=A4=BAcsv=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1025964 --user=王孝刚 【接口测试】新建场景-添加csv场景变量-单步骤调试失败引用csv文件失败 https://www.tapd.cn/55049933/s/1368703 --- .../automation/scenario/component/ApiComponent.vue | 14 ++++---------- .../scenario/component/ApiScenarioComponent.vue | 2 +- .../components/assertion/ApiJsonpathSuggest.vue | 2 +- .../environment/assertion/ApiJsonpathSuggest.vue | 2 +- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/api-test/frontend/src/business/automation/scenario/component/ApiComponent.vue b/api-test/frontend/src/business/automation/scenario/component/ApiComponent.vue index a43d5f6373..315c9cc70e 100644 --- a/api-test/frontend/src/business/automation/scenario/component/ApiComponent.vue +++ b/api-test/frontend/src/business/automation/scenario/component/ApiComponent.vue @@ -172,14 +172,6 @@ - @@ -237,7 +229,6 @@ export default { MsDubboBasisParameters: () => import('../../../definition/components/request/dubbo/BasisParameters'), MsApiRequestForm: () => import('../../../definition/components/request/http/ApiHttpRequestForm'), MsRequestResultTail: () => import('../../../definition/components/response/RequestResultTail'), - MsRun: () => import('../../../definition/components/Run'), }, data() { return { @@ -480,7 +471,7 @@ export default { // 场景变量 let variables = []; if (this.currentScenario && this.currentScenario.variables) { - variables = JSON.parse(JSON.stringify(this.currentScenario.variables)); + variables = this.currentScenario.variables; } let debugData = { id: this.currentScenario.id, @@ -518,6 +509,9 @@ export default { this.request.result = undefined; /*触发执行操作*/ this.reportId = getUUID(); + debugData.hashTree = [this.request]; + debugData.stepScenario = true; + this.$emit('runScenario', debugData); } }); }, diff --git a/api-test/frontend/src/business/automation/scenario/component/ApiScenarioComponent.vue b/api-test/frontend/src/business/automation/scenario/component/ApiScenarioComponent.vue index 3692692678..feb7dba16b 100644 --- a/api-test/frontend/src/business/automation/scenario/component/ApiScenarioComponent.vue +++ b/api-test/frontend/src/business/automation/scenario/component/ApiScenarioComponent.vue @@ -193,7 +193,7 @@ export default { } this.scenario.run = true; let runScenario = JSON.parse(JSON.stringify(this.scenario)); - let variables = JSON.parse(JSON.stringify(this.currentScenario.variables)); + let variables = this.currentScenario.variables; // 合并自身依赖场景变量 if (runScenario && runScenario.variableEnable && runScenario.variables) { diff --git a/api-test/frontend/src/business/definition/components/assertion/ApiJsonpathSuggest.vue b/api-test/frontend/src/business/definition/components/assertion/ApiJsonpathSuggest.vue index 3539291c59..8a42ef9244 100644 --- a/api-test/frontend/src/business/definition/components/assertion/ApiJsonpathSuggest.vue +++ b/api-test/frontend/src/business/definition/components/assertion/ApiJsonpathSuggest.vue @@ -73,7 +73,7 @@ export default { open(objStr) { this.data = {}; try { - let stringedJSON = objStr.replace(/:\s*(?!.*\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}\+\d{2}:\d{2})\s([-+Ee0-9.]+)/g, ': "$1"'); + let stringedJSON = objStr.replace(/(?<=[:\[,])\s*(-?\d+(\.\d+)?)(?=\s*([,\]}]))/g, '"$1"'); let param; let JSONBig = require('json-bigint')({ storeAsString: true }); // 解决精度丢失问题 diff --git a/framework/sdk-parent/frontend/src/components/environment/assertion/ApiJsonpathSuggest.vue b/framework/sdk-parent/frontend/src/components/environment/assertion/ApiJsonpathSuggest.vue index baa3cec1b3..ba79e1407c 100644 --- a/framework/sdk-parent/frontend/src/components/environment/assertion/ApiJsonpathSuggest.vue +++ b/framework/sdk-parent/frontend/src/components/environment/assertion/ApiJsonpathSuggest.vue @@ -69,7 +69,7 @@ export default { open(objStr) { this.data = {}; try { - let stringedJSON = objStr.replace(/:\s*(?!.*\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}\+\d{2}:\d{2})\s([-+Ee0-9.]+)/g, ': "$1"'); + let stringedJSON = objStr.replace(/(?<=[:\[,])\s*(-?\d+(\.\d+)?)(?=\s*([,\]}]))/g, '"$1"'); let param; let JSONBig = require('json-bigint')({"storeAsString": true}); // 解决精度丢失问题