From e2476b720994384eaed75a788be8f7d0908f922b Mon Sep 17 00:00:00 2001 From: baiqi Date: Tue, 10 Oct 2023 10:50:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E3=80=90=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95=E3=80=91github#26?= =?UTF-8?q?757?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1030567 --user=白奇 【接口测试】github#26757,【特定场景脚本必现】浏览器访问接口自动化-编辑接口场景页面,浏览器报错,safari浏览器无法显示场景列表,谷歌浏览器样式存在穿透同时导致上下滚动页面到某处后页面自动上下胡乱滚动 https://www.tapd.cn/55049933/s/1424019 --- .../definition/components/body/ApiBody.vue | 16 +- .../components/response/ResponseResult.vue | 54 +++-- .../assertion/ApiJsonpathSuggest.vue | 2 +- .../samples/compnent/ResponseResult.vue | 218 +++++++++++------- 4 files changed, 171 insertions(+), 119 deletions(-) diff --git a/api-test/frontend/src/business/definition/components/body/ApiBody.vue b/api-test/frontend/src/business/definition/components/body/ApiBody.vue index 804c059691..967b765227 100644 --- a/api-test/frontend/src/business/definition/components/body/ApiBody.vue +++ b/api-test/frontend/src/business/definition/components/body/ApiBody.vue @@ -107,7 +107,7 @@ import BatchAddParameter from '../basis/BatchAddParameter'; import Convert from '@/business/commons/json-schema/convert/convert'; import { getApiParamsConfigFields } from 'metersphere-frontend/src/utils/custom_field'; import ApiParamsConfig from '@/business/definition/components/request/components/ApiParamsConfig'; -import { parse } from 'lossless-json' +import { parse } from 'lossless-json'; import CustomNum from '../../../commons/json-schema/convert/customNum'; export default { @@ -177,18 +177,8 @@ export default { // 展开动画大概是 300ms 左右,使视觉效果更流畅 if (this.body.format === 'JSON-SCHEMA') { this.$refs.jsonCodeEdit?.$el.querySelector('.ace_text-input')?.focus(); - this.$refs.jsonCodeEdit?.$parent?.$parent?.$parent?.$parent?.$parent.$el.scrollIntoView({ - behavior: 'smooth', - block: 'start', - inline: 'center', - }); } else if (this.codeEditActive) { this.$refs.codeEdit?.$el.querySelector('.ace_text-input')?.focus(); - this.$refs.codeEdit?.$parent?.$parent?.$parent?.$parent?.$parent?.$el.scrollIntoView({ - behavior: 'smooth', - block: 'start', - inline: 'center', - }); } }, 300); }, @@ -287,8 +277,8 @@ export default { if (this.body.format === 'JSON-SCHEMA') { if (this.body.raw) { try { - const jsonObj = parse(this.body.raw) - this.body.jsonSchema = MsConvert.format(jsonObj); + const jsonObj = parse(this.body.raw); + this.body.jsonSchema = MsConvert.format(jsonObj); } catch (e) { this.body.format = 'JSON'; this.$message.error(this.$t('api_definition.body.json_format_error')); diff --git a/api-test/frontend/src/business/definition/components/response/ResponseResult.vue b/api-test/frontend/src/business/definition/components/response/ResponseResult.vue index 1dda201546..c37b6571bc 100644 --- a/api-test/frontend/src/business/definition/components/response/ResponseResult.vue +++ b/api-test/frontend/src/business/definition/components/response/ResponseResult.vue @@ -2,8 +2,9 @@
- + + ref="codeEdit" /> - + - @@ -26,7 +26,7 @@ :read-only="true" :data.sync="responseResult.headers" ref="codeEdit" - v-if="activeName === 'headers'"/> + v-if="activeName === 'headers'" /> @@ -36,7 +36,7 @@ :data.sync="responseResult.console" ref="codeEdit" v-if="activeName === 'console'" - height="calc(100vh - 300px)"/> + height="calc(100vh - 300px)" /> @@ -45,11 +45,11 @@ :read-only="true" :data.sync="responseResult.console" ref="codeEdit" - v-if="activeName === 'console'"/> + v-if="activeName === 'console'" /> - + @@ -58,7 +58,7 @@ :read-only="true" :data.sync="responseResult.vars" v-if="activeName === 'label'" - ref="codeEdit"/> + ref="codeEdit" /> @@ -67,7 +67,7 @@ :read-only="true" :data.sync="reqMessages" v-if="activeName === 'request_body'" - ref="codeEdit"/> + ref="codeEdit" /> @@ -76,8 +76,8 @@ v-if="currentProtocol === 'SQL'" :commands="sqlModes" :default-command="mode" - @command="sqlModeChange"/> - + @command="sqlModeChange" /> + @@ -88,9 +88,9 @@ import MsAssertionResults from './AssertionResults'; import MsCodeEdit from '../MsCodeEdit'; import MsDropdown from '../../../../business/commons/MsDropdown'; -import {BODY_FORMAT} from '../../model/ApiTestModel'; +import { BODY_FORMAT } from '../../model/ApiTestModel'; import MsSqlResultTable from './SqlResultTable'; -import {downloadByURL} from "fit2cloud-ui/src/tools/utils"; +import { downloadByURL } from 'fit2cloud-ui/src/tools/utils'; export default { name: 'MsResponseResult', @@ -122,7 +122,16 @@ export default { mode: BODY_FORMAT.TEXT, isMsCodeEditShow: true, reqMessages: '', - contentType: ['image/png', 'image/jpeg', 'image/gif', 'image/bmp', 'image/webp', 'image/svg+xml', 'image/apng', 'image/avif'], + contentType: [ + 'image/png', + 'image/jpeg', + 'image/gif', + 'image/bmp', + 'image/webp', + 'image/svg+xml', + 'image/apng', + 'image/avif', + ], srcUrl: '', }; }, @@ -137,11 +146,6 @@ export default { setTimeout(() => { // 展开动画大概是 300ms 左右,使视觉效果更流畅 this.$refs.codeEdit?.$el.querySelector('.ace_text-input')?.focus(); - this.$refs.codeEdit?.$parent?.$parent?.$parent?.$parent?.$parent?.$el.scrollIntoView({ - behavior: 'smooth', - block: 'center', - inline: 'center', - }); }, 300); }, immediate: true, @@ -156,7 +160,7 @@ export default { }, showPicture() { if (this.responseResult.contentType && this.contentType.includes(this.responseResult.contentType)) { - this.modes.push('picture') + this.modes.push('picture'); this.srcUrl = 'data:' + this.responseResult.contentType + ';base64,' + this.responseResult.imageUrl; } }, @@ -239,7 +243,11 @@ export default { return this.response && this.response.responseResult ? this.response.responseResult : {}; }, isPicture() { - return this.responseResult.contentType && this.contentType.includes(this.responseResult.contentType) && this.mode === 'picture'; + return ( + this.responseResult.contentType && + this.contentType.includes(this.responseResult.contentType) && + this.mode === 'picture' + ); }, }, }; 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 9c89b54a0a..f0c6258ac2 100644 --- a/framework/sdk-parent/frontend/src/components/environment/assertion/ApiJsonpathSuggest.vue +++ b/framework/sdk-parent/frontend/src/components/environment/assertion/ApiJsonpathSuggest.vue @@ -83,7 +83,7 @@ export default { this.data = {}; try { let stringedJSON = objStr.replace( - /(?<=[:\[,])\s*(-?\d+(\.\d+)?)(?=\s*([,\]}]))/g, + /(?:[:\[,])\s*(-?\d+(\.\d+)?)(?=\s*([,\]}]))/g, '"$1"' ); let param; diff --git a/performance-test/frontend/src/business/report/components/samples/compnent/ResponseResult.vue b/performance-test/frontend/src/business/report/components/samples/compnent/ResponseResult.vue index 3bb4d12d4e..47507aa36d 100644 --- a/performance-test/frontend/src/business/report/components/samples/compnent/ResponseResult.vue +++ b/performance-test/frontend/src/business/report/components/samples/compnent/ResponseResult.vue @@ -1,67 +1,114 @@