feat(接口测试): 场景设置tab页面

This commit is contained in:
WangXu10 2024-03-21 17:13:55 +08:00 committed by 刘瑞斌
parent 97ef98d5b4
commit 2799bb29ed
3 changed files with 112 additions and 4 deletions

View File

@ -1,13 +1,90 @@
<template>
<setting v-model:params="otherConfig" />
<a-form :model="form" layout="vertical">
<div style="display: flex">
<div style="font-weight: bold">{{ t('apiScenario.setting.cookie.config') }}</div>
<a-tooltip :content="t('apiScenario.setting.cookie.config.tip')">
<div>
<MsIcon
class="ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
type="icon-icon-maybe_outlined"
/>
</div>
</a-tooltip>
</div>
<div class="mb-[16px] mt-[10px] flex items-center gap-[8px]">
<a-switch v-model:model-value="form.envCookie" type="line" size="small" />
{{ t('apiScenario.setting.environment.cookie') }}
</div>
<div class="mb-[16px] flex items-center gap-[8px]">
<a-switch v-model:model-value="form.shareCookie" type="line" size="small" />
{{ t('apiScenario.setting.share.cookie') }}
<a-tooltip :content="t('apiScenario.setting.share.cookie.tip')" position="right">
<div>
<MsIcon
class="ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
type="icon-icon-maybe_outlined"
/>
</div>
</a-tooltip>
</div>
<div style="font-weight: bold">
{{ t('apiScenario.setting.run.config') }}
</div>
<div class="mb-[16px] mt-[10px] flex items-center gap-[8px]">
<a-switch v-model:model-value="form.waitTime" type="line" size="small" />
{{ t('apiScenario.setting.step.waitTime') }}
<a-tooltip :content="t('apiScenario.setting.waitTime.tip')">
<div>
<MsIcon
class="ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
type="icon-icon-maybe_outlined"
/>
</div>
</a-tooltip>
</div>
<a-form-item class="flex-1">
<template #label>
<div class="flex items-center">
{{ t('apiScenario.setting.waitTime') }}
<div class="text-[var(--color-text-brand)]">(ms)</div>
</div>
</template>
<a-input-number v-model:model-value="form.connectTimeout" mode="button" :step="100" :min="0" class="w-[160px]" />
</a-form-item>
<a-form-item class="flex-1">
<template #label>
<div class="flex items-center">
{{ t('apiScenario.setting.step.rule') }}
</div>
</template>
<a-radio-group v-model:model-value="form.rule">
<a-radio value="ignore">{{ t('apiScenario.setting.step.rule.ignore') }}</a-radio>
<a-radio value="stop">{{ t('apiScenario.setting.step.rule.stop') }}</a-radio>
</a-radio-group>
</a-form-item>
</a-form>
</template>
<script setup lang="ts">
import setting from '@/views/api-test/components/requestComposition/setting.vue';
import { useI18n } from '@/hooks/useI18n';
import { ExecuteOtherConfig } from '@/models/apiTest/common';
const { t } = useI18n();
// const emit = defineEmits(['update:formModeValue']); // ?
const otherConfig = ref({} as ExecuteOtherConfig);
// const props = defineProps<{
//
// }>();
const initForm = {
envCookie: false,
shareCookie: false,
waitTime: false,
connectTimeout: 1000,
rule: 'ignore',
};
const form = ref({ ...initForm });
</script>
<style lang="less" scoped></style>

View File

@ -80,4 +80,20 @@ export default {
'apiScenario.scriptOperationName': 'Script operation name',
'apiScenario.scriptOperationNamePlaceholder': 'Please enter the script operation name',
'apiScenario.setting.cookie.config': 'Cookie configuration',
'apiScenario.setting.environment.cookie': 'Environment Cookie',
'apiScenario.setting.share.cookie': 'Shared Cookie',
'apiScenario.setting.run.config': 'Run configuration',
'apiScenario.setting.step.waitTime': 'Step wait time',
'apiScenario.setting.waitTime': 'Wait time',
'apiScenario.setting.step.rule': 'Step execution failure rule',
'apiScenario.setting.step.rule.ignore': 'Ignore error and continue execution',
'apiScenario.setting.step.rule.stop': 'Stop/end execution',
'apiScenario.setting.cookie.config.tip':
'When there are both global and scene variable cookies, shared cookies will overwrite both global and scene variable cookies',
'apiScenario.setting.share.cookie.tip':
'As long as the system extracts the returned cookie information from the result of a certain step, the subsequent steps will use this cookie. If a cookie variable is added to the request, it will also be overwritten',
'apiScenario.setting.waitTime.tip':
'When running a scenario, each step of the scenario will wait for a certain time after execution before triggering the next step to start execution',
};

View File

@ -166,4 +166,19 @@ export default {
'apiScenario.scriptOperationName': '脚本操作名称',
'apiScenario.scriptOperationNamePlaceholder': '请输入脚本操作名称',
'apiScenario.setting.cookie.config': 'Cookie 配置',
'apiScenario.setting.environment.cookie': '环境 Cookie',
'apiScenario.setting.share.cookie': '共享 Cookie',
'apiScenario.setting.run.config': '运行配置',
'apiScenario.setting.step.waitTime': '步骤等待时间',
'apiScenario.setting.waitTime': '等待时间',
'apiScenario.setting.step.rule': '步骤执行失败规则',
'apiScenario.setting.step.rule.ignore': '忽略错误,继续执行',
'apiScenario.setting.step.rule.stop': '停止/结束执行',
'apiScenario.setting.cookie.config.tip':
'同时存在全局变量cookie与场景变量cookie时共享cookie会覆盖全局cookie与场景变量cookie',
'apiScenario.setting.share.cookie.tip':
'系统只要从某个步骤的结果内提取到返回的cookie信息则后续步骤都会使用此 cookie 如果请求添加了Cookie 变量也会被覆盖',
'apiScenario.setting.waitTime.tip': '运行场景时,场景的每一个步骤执行后都会等待相应的时间再触发下一个步骤开始执行',
};