From a1661c7c653d4ffe9a000ac67722565c45958f4f Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Mon, 9 May 2022 11:11:03 +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=E5=8E=86=E5=8F=B2=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=96=AD=E8=A8=80=E5=AD=90=E6=AD=A5=E9=AA=A4=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E7=8A=B6=E6=80=81=E4=B8=8B-=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E4=BB=8D=E6=89=A7=E8=A1=8C=E6=96=AD=E8=A8=80=E7=9A=84=E7=BC=BA?= =?UTF-8?q?=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1013042 --user=王孝刚 【接口测试】github#12904,老用例默认关闭状态,调试的时候断言也不生效了(关闭状态下-调试仍执行断言) https://www.tapd.cn/55049933/s/1154505 --- .../api/definition/api-definition.js | 25 ++++++++++++++----- .../api/definition/model/ApiTestModel.js | 5 ++-- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/frontend/src/business/components/api/definition/api-definition.js b/frontend/src/business/components/api/definition/api-definition.js index 5e6d5fa06d..638cc12edf 100644 --- a/frontend/src/business/components/api/definition/api-definition.js +++ b/frontend/src/business/components/api/definition/api-definition.js @@ -47,29 +47,41 @@ export function getProtocolFilter(protocolType) { export function parse(item) { if (item.jsonPath) { item.jsonPath.forEach(node => { - node.enable = item.enable; + if (node.enable === undefined) { + node.enable = item.enable; + } }) } if (item.jsr223) { item.jsr223.forEach(node => { - node.enable = item.enable; + if (node.enable === undefined) { + node.enable = item.enable; + } }) } if (item.regex) { item.regex.forEach(node => { - node.enable = item.enable; + if (node.enable === undefined) { + node.enable = item.enable; + } }); } if (item.xpath2) { item.xpath2.forEach(node => { - node.enable = item.enable; + if (node.enable === undefined) { + node.enable = item.enable; + } }) } if (item.duration && item.duration.value > 0) { - item.duration.enable = item.enable; + if (item.duration.enable === undefined) { + item.duration.enable = item.enable; + } } if (item.document && item.document.data && (item.document.data.json.length > 0 || item.document.data.xml.length > 0)) { - item.document.enable = item.enable; + if (item.document.enable === undefined) { + item.document.enable = item.enable; + } } } @@ -85,6 +97,7 @@ export function hisDataProcessing(array, request) { let item = array[index]; if (item.type === "Assertions" && isOne) { assertions = JSON.parse(JSON.stringify(item)); + parse(assertions); isOne = false; assertionsIndex.push(item); } else if (item.type === "Assertions") { diff --git a/frontend/src/business/components/api/definition/model/ApiTestModel.js b/frontend/src/business/components/api/definition/model/ApiTestModel.js index de7242a46a..35dcf98bac 100644 --- a/frontend/src/business/components/api/definition/model/ApiTestModel.js +++ b/frontend/src/business/components/api/definition/model/ApiTestModel.js @@ -805,6 +805,7 @@ export class AssertionDocument extends BaseConfig { this.include = false; this.typeVerification = false; this.type = "object"; + this.enable = true; this.arrayVerification = false; this.contentVerifications = "none"; this.expectedOutcome = ""; @@ -851,7 +852,7 @@ export class Text extends AssertionType { this.subject = undefined; this.condition = undefined; this.value = undefined; - + this.enable = true; this.set(options); } } @@ -919,7 +920,7 @@ export class JSONPath extends AssertionType { this.expression = undefined; this.expect = undefined; this.description = undefined; - + this.enable = true; this.set(options); }