fix(接口测试): (紧急)修复加了断言无法调试

This commit is contained in:
xinxin.wu 2024-04-03 10:45:19 +08:00 committed by Craftsman
parent 2b796a9b27
commit cffa60193c
2 changed files with 97 additions and 33 deletions

View File

@ -1218,7 +1218,7 @@
const { assertionConfig } = requestVModel.value.children[0];
const assertionList = assertionConfig.assertions.map((assertItem: any) => {
const bodyAssertionDataByTypeList = filterKeyValParams(
assertItem.bodyAssertionDataByType.assertions,
assertItem?.bodyAssertionDataByType?.assertions || [],
defaultAssertParamsItem,
isExecute
).validParams;
@ -1229,19 +1229,28 @@
assertions: bodyAssertionDataByTypeList,
},
regexAssertion: {
...assertItem.regexAssertion,
assertions: filterKeyValParams(assertItem.regexAssertion.assertions, defaultAssertXpathParamsItem, isExecute)
.validParams,
...assertItem?.regexAssertion,
assertions: filterKeyValParams(
assertItem?.regexAssertion?.assertions || [],
defaultAssertXpathParamsItem,
isExecute
).validParams,
},
xpathAssertion: {
...assertItem.xpathAssertion,
assertions: filterKeyValParams(assertItem.xpathAssertion.assertions, defaultAssertXpathParamsItem, isExecute)
.validParams,
assertions: filterKeyValParams(
assertItem?.xpathAssertion?.assertions || [],
defaultAssertXpathParamsItem,
isExecute
).validParams,
},
jsonPathAssertion: {
...assertItem.jsonPathAssertion,
assertions: filterKeyValParams(assertItem.jsonPathAssertion.assertions, defaultAssertParamsItem, isExecute)
.validParams,
assertions: filterKeyValParams(
assertItem?.jsonPathAssertion?.assertions || [],
defaultAssertParamsItem,
isExecute
).validParams,
},
};
});

View File

@ -46,8 +46,19 @@
{{ t('report.detail.api.totalTime') }}
</div>
<div>
<span class="ml-4 text-[18px] font-medium">{{ getTotalTime.split('-')[0] || '-' }}</span>
<span class="ml-1 text-[var(--color-text-4)]">{{ getTotalTime.split('-')[1] || 'ms' }}</span>
<a-popover position="bottom" content-class="response-popover-content">
<span class="ml-4 text-[18px] font-medium">{{ getTotalTime.split('-')[0] || '-' }}</span>
<span class="ml-1 text-[var(--color-text-4)]">{{ getTotalTime.split('-')[1] || 'ms' }}</span>
<template #content>
<div class="min-w-[140px] max-w-[400px] p-4 text-[14px]">
<div class="text-[var(--color-text-4)]">{{ t('report.detail.api.totalTime') }}</div>
<div class="mt-2 text-[var(--color-text-1)]">
<span class="text-[18px] font-medium">{{ getTotalTime.split('-')[0] || '-' }}</span
>{{ getTotalTime.split('-')[1] || 'ms' }}</div
>
</div>
</template>
</a-popover>
</div>
</div>
<div class="timer-card mr-2">
@ -56,12 +67,28 @@
{{ t('report.detail.api.requestTotalTime') }}
</div>
<div>
<span class="ml-4 text-[18px] font-medium">{{
detail.requestDuration !== null ? formatDuration(detail.requestDuration).split('-')[0] : '-'
}}</span>
<span class="ml-1 text-[var(--color-text-4)]">{{
detail.requestDuration !== null ? formatDuration(detail.requestDuration).split('-')[1] : 'ms'
}}</span>
<a-popover position="bottom" content-class="response-popover-content">
<span class="ml-4 text-[18px] font-medium">{{
detail.requestDuration !== null ? formatDuration(detail.requestDuration).split('-')[0] : '-'
}}</span>
<span class="ml-1 text-[var(--color-text-4)]">{{
detail.requestDuration !== null ? formatDuration(detail.requestDuration).split('-')[1] : 'ms'
}}</span>
<template #content>
<div class="min-w-[140px] max-w-[400px] p-4 text-[14px]">
<div class="text-[var(--color-text-4)]">{{ t('report.detail.api.requestTotalTime') }}</div>
<div class="mt-2 text-[var(--color-text-1)]">
<span class="text-[18px] font-medium">{{
detail.requestDuration !== null ? formatDuration(detail.requestDuration).split('-')[0] : '-'
}}</span
>{{
detail.requestDuration !== null ? formatDuration(detail.requestDuration).split('-')[1] : 'ms'
}}</div
>
</div>
</template>
</a-popover>
</div>
</div>
<div class="timer-card min-w-[200px]">
@ -69,23 +96,50 @@
<MsIcon type="icon-icon_yes_outlined" class="mr-[4px] text-[var(--color-text-4)]" size="16" />
{{ t('report.detail.api.assertPass') }}
</div>
<div class="flex items-center">
<span class="text-[18px] font-medium text-[var(--color-text-1)]"
>{{ getIndicators(detail.assertionPassRate) }} <span>%</span></span
>
<a-divider direction="vertical" :margin="0" class="!mx-2 h-[16px]"></a-divider>
<span class="text-[var(--color-text-1)]">{{
getIndicators(detail.assertionSuccessCount) === '-'
? '-'
: addCommasToNumber(detail.assertionSuccessCount || 0)
}}</span>
<span class="text-[var(--color-text-4)]"
><span class="mx-1">/</span>
{{
getIndicators(detail.assertionCount) === '-' ? '-' : addCommasToNumber(detail.assertionCount) || 0
}}</span
>
</div>
<a-popover position="bottom" content-class="response-popover-content">
<div class="flex items-center">
<span class="text-[18px] font-medium text-[var(--color-text-1)]"
>{{ getIndicators(detail.assertionPassRate) }} <span>%</span></span
>
<a-divider direction="vertical" :margin="0" class="!mx-2 h-[16px]"></a-divider>
<span class="text-[var(--color-text-1)]">{{
getIndicators(detail.assertionSuccessCount) === '-'
? '-'
: addCommasToNumber(detail.assertionSuccessCount || 0)
}}</span>
<span class="text-[var(--color-text-4)]"
><span class="mx-1">/</span>
{{
getIndicators(detail.assertionCount) === '-' ? '-' : addCommasToNumber(detail.assertionCount) || 0
}}</span
>
</div>
<template #content>
<div class="min-w-[190px] max-w-[400px] p-4 text-[14px]">
<div class="text-[var(--color-text-4)]">{{ t('report.detail.api.assertPass') }}</div>
<div class="mt-2 flex items-center justify-between">
<div class="text-[18px] font-medium text-[var(--color-text-1)]"
>{{ getIndicators(detail.assertionPassRate) }} <span>%</span></div
>
<div>
<span class="text-[var(--color-text-1)]">{{
getIndicators(detail.assertionSuccessCount) === '-'
? '-'
: addCommasToNumber(detail.assertionSuccessCount || 0)
}}</span>
<span class="text-[var(--color-text-4)]"
><span class="mx-1">/</span>
{{
getIndicators(detail.assertionCount) === '-'
? '-'
: addCommasToNumber(detail.assertionCount) || 0
}}</span
>
</div>
</div>
</div>
</template>
</a-popover>
</div>
</div>
</div>
@ -130,6 +184,7 @@
import dayjs from 'dayjs';
import MsChart from '@/components/pure/chart/index.vue';
import MsColorLine from '@/components/pure/ms-color-line/index.vue';
import ReportDetailHeader from './reportDetailHeader.vue';
import reportInfoHeader from './step/reportInfoHeaders.vue';
import StepProgress from './stepProgress.vue';