fix(接口测试): 接口自动化国际化

--bug=1008956 --user=王孝刚 【国际化】-API Automation-未翻译汇总
https://www.tapd.cn/55049933/s/1082453
This commit is contained in:
wxg0103 2021-12-17 16:28:50 +08:00 committed by 刘瑞斌
parent 201c1b2b74
commit cf9a65cc08
15 changed files with 144 additions and 51 deletions

View File

@ -5,7 +5,7 @@
<span>{{ !scope.row.name || scope.row.name === 'null' ? "" : scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column prop="content" label="内容" width="300" show-overflow-tooltip/>
<el-table-column prop="content" :label="$t('api_report.assertions_content')" width="300" show-overflow-tooltip/>
<el-table-column prop="message" :label="$t('api_report.assertions_error_message')"/>
<el-table-column prop="pass" :label="$t('api_report.assertions_is_success')" width="180">
<template v-slot:default="{row}">

View File

@ -2,7 +2,7 @@
<el-dialog :close-on-click-modal="false" :title="$t('api_test.automation.add_scenario')" :visible.sync="visible"
width="45%"
:destroy-on-close="true">
<el-form :model="scenarioForm" label-position="right" label-width="80px" size="small" :rules="rule"
<el-form :model="scenarioForm" label-position="right" label-width="100px" size="small" :rules="rule"
ref="scenarioForm">
<el-form-item :label="$t('commons.name')" prop="name">
<el-input v-model="scenarioForm.name" autocomplete="off" :placeholder="$t('commons.name')"/>
@ -47,7 +47,7 @@
<ms-dialog-footer
@cancel="visible = false"
:isShow="true"
title="编辑详情"
:title="$t('commons.edit_info')"
@saveAsEdit="saveScenario(true)"
@confirm="saveScenario">
</ms-dialog-footer>

View File

@ -13,11 +13,11 @@
:show-btn="showBtn"
color="#606266"
background-color="#F4F4F5"
title='场景'>
:title="$t('commons.scenario')">
<template v-slot:afterTitle v-if="isSameSpace">
<span v-if="isShowNum" @click = "clickResource(scenario)">{{" ID: "+scenario.num+""}}</span>
<span v-else >
<span v-if="isShowNum" @click="clickResource(scenario)">{{ " ID: " + scenario.num + "" }}</span>
<span v-else>
<el-tooltip class="ms-num" effect="dark" :content="$t('api_test.automation.scenario.num_none')" placement="top">
<i class="el-icon-warning"/>
</el-tooltip>
@ -40,8 +40,10 @@
</span>
</template>
<template v-slot:scenarioEnable>
<el-tooltip content="启用场景环境:当前步骤使用场景原始环境配置运行" placement="top">
<el-checkbox v-model="scenario.environmentEnable" @change="checkEnv" :disabled="scenario.disabled">启用场景环境</el-checkbox>
<el-tooltip :content="$t('commons.enable_scene_info')" placement="top">
<el-checkbox v-model="scenario.environmentEnable" @change="checkEnv" :disabled="scenario.disabled">
{{ $t('commons.enable_scene') }}
</el-checkbox>
</el-tooltip>
</template>
<template v-slot:button>
@ -185,7 +187,7 @@ export default {
this.$get("/api/automation/checkScenarioEnv/" + this.scenario.id, res => {
if (this.scenario.environmentEnable && !res.data) {
this.scenario.environmentEnable = false;
this.$warning("当前场景没有环境,需要先设置自身环境");
this.$warning(this.$t('commons.scenario_warning'));
return;
}
this.setDomain(val);

View File

@ -19,7 +19,7 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="编码">
<el-form-item :label="$t('commons.encode')">
<el-select v-model="data.urlEncode" size="small" clearable style="width: 50%;">
<el-option
v-for="item in options"
@ -48,10 +48,10 @@ export default {
data: {},
options: [{
value: true,
label: '是'
label: this.$t('commons.yes')
}, {
value: false,
label: '否'
label: this.$t('commons.no')
}],
}
},

View File

@ -13,12 +13,12 @@
<el-option :label="$t('commons.adv_search.operators.not_equals')" value="NOT_EQUALS"/>
<el-option :label="$t('commons.adv_search.operators.gt')" value="GT"/>
<el-option :label="$t('commons.adv_search.operators.lt')" value="LT"/>
<el-option label="正则匹配" value="REGEX"/>
<el-option :label="$t('api_test.request.assertions.regular_match')" value="REGEX"/>
</el-select>
<el-input :disabled="isReadOnly" v-model="jsonPath.expect" size="small" show-word-limit
:placeholder="$t('api_test.request.assertions.expect')" style="width: 50%"/>
<el-tooltip placement="top" v-if="jsonPath.option === 'REGEX'">
<div slot="content">特殊字符"$ ( ) * + . [ ] \ ^ { } |"需转义为"\ "+"特殊字符","\$"</div>
<div slot="content">{{ $t('api_test.request.assertions.regex_info') }}</div>
<i class="el-icon-question" style="cursor: pointer"/>
</el-tooltip>
</el-col>

View File

@ -6,7 +6,7 @@
{{ $t('commons.import') }}
</span>
<span v-if="apiId!=='none'">
<el-checkbox v-model="checked" @change="checkedAPI">跟随API定义</el-checkbox>
<el-checkbox v-model="checked" @change="checkedAPI">{{ $t('commons.follow_api') }}</el-checkbox>
</span>
</div>
<el-table
@ -27,13 +27,15 @@
</template>
</el-table-column>
<el-table-column prop="include" width="78" label="必含" :render-header="renderHeader">
<el-table-column prop="include" width="78" :label="$t('api_test.request.assertions.must_contain')"
:render-header="renderHeader">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.include" @change="handleCheckOneChange" :disabled="checked"/>
</template>
</el-table-column>
<el-table-column prop="typeVerification" width="100" label="类型校验" :render-header="renderHeaderType">
<el-table-column prop="typeVerification" width="100" :label="$t('api_test.request.assertions.type_verification')"
:render-header="renderHeaderType">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.typeVerification" @change="handleCheckOneChange" :disabled="checked"/>
</template>
@ -47,34 +49,43 @@
</template>
</el-table-column>
<el-table-column prop="contentVerification" label="内容校验" width="200">
<el-table-column prop="contentVerification" :label="$t('api_test.request.assertions.content_verification')"
width="200">
<template slot-scope="scope">
<el-select v-model="scope.row.contentVerification" :placeholder="$t('commons.please_select')" size="mini" :disabled="checked">
<el-select v-model="scope.row.contentVerification" :placeholder="$t('commons.please_select')" size="mini"
:disabled="checked">
<el-option v-for="item in verificationOptions " :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="expectedOutcome" label="预期结果" min-width="200">
<el-table-column prop="expectedOutcome" :label="$t('api_test.request.assertions.expected_results')"
min-width="200">
<template slot-scope="scope">
<el-input v-if="scope.row.status && scope.column.fixed" v-model="scope.row.expectedOutcome" size="mini"/>
<span v-else>{{ scope.row.expectedOutcome }}</span>
</template>
</el-table-column>
<el-table-column prop="arrayVerification" width="140" label="校验数组内元素" :render-header="renderHeaderArray">
<el-table-column prop="arrayVerification" width="140" :label="$t('api_test.request.assertions.check')"
:render-header="renderHeaderArray">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.arrayVerification" @change="handleCheckOneChange" v-if="scope.row.type==='array'" :disabled="checked"/>
<el-checkbox v-model="scope.row.arrayVerification" @change="handleCheckOneChange"
v-if="scope.row.type==='array'" :disabled="checked"/>
</template>
</el-table-column>
<el-table-column :label="$t('commons.operating')" width="130" fixed="right">
<template v-slot:default="scope">
<span>
<el-tooltip effect="dark" content="添加校验" placement="top-start">
<el-button icon="el-icon-document-checked" circle type="primary" size="mini" @click="addVerification(scope.row)" :disabled="scope.row.type ==='object' ||scope.row.type ==='array' || checked || scope.row.id==='root'"/>
<el-tooltip effect="dark" :content="$t('api_test.request.assertions.add_check')" placement="top-start">
<el-button icon="el-icon-document-checked" circle type="primary" size="mini"
@click="addVerification(scope.row)"
:disabled="scope.row.type ==='object' ||scope.row.type ==='array' || checked || scope.row.id==='root'"/>
</el-tooltip>
<el-tooltip effect="dark" content="添加子字段" placement="top-start">
<el-button icon="el-icon-plus" circle type="primary" size="mini" style="margin-left: 10px" @click="addRow(scope.row)" :disabled="(scope.row.type !=='object' && scope.row.type !=='array') || checked"/>
<el-tooltip effect="dark" :content="$t('api_test.request.assertions.add_subfield')" placement="top-start">
<el-button icon="el-icon-plus" circle type="primary" size="mini" style="margin-left: 10px"
@click="addRow(scope.row)"
:disabled="(scope.row.type !=='object' && scope.row.type !=='array') || checked"/>
</el-tooltip>
<el-tooltip effect="dark" :content="$t('commons.remove')" placement="top-start">
<el-button icon="el-icon-delete" type="primary" circle size="mini" style="margin-left: 10px" @click="remove(scope.row)" :disabled="checked || scope.row.id==='root'"/>
@ -105,15 +116,15 @@ export default {
return {
loading: false,
verificationOptions: [
{value: 'none', label: '不校验[]'},
{value: 'value_eq', label: '值-等于[value=]'},
{value: 'value_not_eq', label: '值-不等于[value!=]'},
{value: 'value_in', label: '值-包含[include=]'},
{value: 'length_eq', label: '长度-等于[length=]'},
{value: 'length_not_eq', label: '长度-不等于[length!=]'},
{value: 'length_gt', label: '长度-大于[length>]'},
{value: 'length_lt', label: '长度-小于[length<]'},
{value: 'regular', label: '正则匹配'}
{value: 'none', label: this.$t('api_test.request.assertions.none')},
{value: 'value_eq', label: this.$t('api_test.request.assertions.value_eq')},
{value: 'value_not_eq', label: this.$t('api_test.request.assertions.value_not_eq')},
{value: 'value_in', label: this.$t('api_test.request.assertions.value_in')},
{value: 'length_eq', label: this.$t('api_test.request.assertions.length_eq')},
{value: 'length_not_eq', label: this.$t('api_test.request.assertions.length_not_eq')},
{value: 'length_gt', label: this.$t('api_test.request.assertions.length_gt')},
{value: 'length_lt', label: this.$t('api_test.request.assertions.length_lt')},
{value: 'regular', label: this.$t('api_test.request.assertions.regular_match')}
],
typeSelectOptions: [
{value: 'object', label: 'object'},
@ -124,8 +135,8 @@ export default {
],
requiredSelectOptions: [
{value: true, label: '必填'},
{value: false, label: '非必填'},
{value: true, label: this.$t('commons.selector.required')},
{value: false, label: this.$t('commons.selector.not_required')},
],
checked: false,
tableData: Array,

View File

@ -5,8 +5,7 @@
{{ $t('api_test.definition.request.body_json') }}
</el-radio>
<el-radio :disabled="isReadOnly" label="fromApi" @change="modeChange">
<!-- {{ 跟随API定义 }}-->
跟随API定义
{{ $t('commons.follow_api') }}
</el-radio>
<el-radio :disabled="isReadOnly" :label="type.XML" @change="modeChange">
{{ $t('api_test.definition.request.body_xml') }}

View File

@ -20,7 +20,7 @@
<el-col :span="2"/>
</el-row>
</el-tab-pane>
<el-tab-pane label="响应延迟时间" name="delayed" class="pane">
<el-tab-pane :label="$t('commons.response_time_delay')" name="delayed" class="pane">
<el-row>
<el-input-number v-model="response.delayed" :min="0">
<template slot="append">ms</template>

View File

@ -1,7 +1,7 @@
<template>
<el-table :data="assertions" :row-style="getRowStyle" :header-cell-style="getRowStyle">
<el-table-column prop="name" :label="$t('api_report.assertions_name')" width="200" show-overflow-tooltip/>
<el-table-column prop="content" label="内容" width="300" show-overflow-tooltip/>
<el-table-column prop="content" :label="$t('api_report.assertions_content')" width="300" show-overflow-tooltip/>
<el-table-column prop="message" :label="$t('api_report.assertions_error_message')"/>
<el-table-column prop="pass" :label="$t('api_report.assertions_is_success')" width="100">
<template v-slot:default="{row}">

View File

@ -1,6 +1,6 @@
<template>
<el-dialog
title="导入"
:title="$t('commons.import')"
:visible.sync="importVisible"
width="50%"
append-to-body
@ -90,7 +90,7 @@
saveConfirm() {
if (this.activeName === 'JSON') {
if (!this.checkIsJson(this.json)) {
this.$error("导入的数据非JSON格式");
this.$error(this.$t('schema.json_warning'));
return;
}
let jsonData = MsConvert.format(json5.parse(this.json));
@ -98,7 +98,7 @@
this.$emit('jsonData', jsonData);
} else {
if (!this.checkIsJsonSchema(this.jsonSchema)) {
this.$error("导入的数据非JSON-SCHEMA 格式");
this.$error(this.$t('schema.json_schema_warning'));
return;
}
let obj = json5.parse(this.jsonSchema);

View File

@ -49,7 +49,7 @@
<!-- 高级设置-->
<el-dialog append-to-body :close-on-click-modal="true" :title="$t('schema.adv_setting')" :visible.sync="modalVisible" :destroy-on-close="true"
@close="handleClose">
<p class="tip">基础设置 </p>
<p class="tip">{{ $t("schema.base_setting") }} </p>
<el-form label-position="left" label-width="100px" v-model="advancedValue" class="ms-advanced-search-form">
<div :span="8" v-for="(item,key) in advancedValue" :key="key">

View File

@ -33,7 +33,7 @@
:size="size.toString()"
custom-class="ms-drawer-task">
<el-card style="float: left;width: 850px" v-if="size > 550 ">
<div class="ms-task-opt-btn" @click="packUp">{{ this.$t('') }}</div>
<div class="ms-task-opt-btn" @click="packUp">{{ $t('commons.task_close') }}</div>
<!-- 接口用例结果 -->
<ms-request-result-tail :response="response" ref="debugResult" v-if="reportType === 'API'"/>

View File

@ -99,6 +99,9 @@ export default {
test_resource_pool: 'Resource Pool',
system_setting: 'Settings',
api: 'API',
encode: 'Encode',
follow_api: 'Follow API definition',
response_time_delay: 'Response delay time',
my_workstation: 'MyWorkstation',
performance: 'Performance',
enable_settings: 'Enable Settings',
@ -179,7 +182,7 @@ export default {
batch_add: "Batch add",
check_project_tip: "Create or select the project first",
auth_redirect_tip: 'Jump to the authentication source page for authentication',
tag_tip: "Enter Enter to Add Label",
tag_tip: "Enter to Add Label",
node_name_tip: "The name cannot contain'\\'",
more_operator: "More operator",
mock: "Mock settings",
@ -203,6 +206,9 @@ export default {
execute_history: "Execute history",
debug_history: "Debug history",
testing: "Testing",
enable_scene: "Enable scene environment",
enable_scene_info: "Enable scene environment: the current step uses the original environment configuration of the scene to run",
edit_info: "Edit details",
environment: "Environment",
run_success: "Run Success",
run_completed: "Run Completed",
@ -1012,6 +1018,7 @@ export default {
copy: "Copy Test",
please_select_case: "Please select case",
fail_to_stop: "Fail to stop",
batch_add_parameter: "Format: parameter name: parameter value <br/> likeAccept-Encoding:utf-8",
jar_config: {
title: "Upload jar package",
jar_file: "Jar package",
@ -1454,6 +1461,23 @@ export default {
json_path_clear: "Clear JSONPath Assertion",
debug_first: "First, debug to get the response",
suggest_tip: "Click the note to add the JSONPath assertion",
regex_info: 'Special characters "$ () * +. [] \\ ^ {} |" need to be escaped as "\\ "+"special characters", such as "\\$"',
regular_match: 'Regular match',
none: 'Do not verify []',
value_eq: 'Value-equal to [value=]',
value_not_eq: 'Value-not equal to [value!=]',
value_in: 'Value-include [include=]',
length_eq: 'Length-equal to [length=]',
length_not_eq: 'Length-not equal to [length!=]',
length_gt: 'Length-greater than [length>]',
length_lt: 'Length-less than [length<]',
must_contain: 'Must contain',
type_verification: 'Type verification',
content_verification: 'Content verification',
expected_results: 'Expected results',
check: 'Check the elements in the array',
add_check: 'Add check',
add_subfield: 'Add subfield'
},
extract: {
label: "Extract from response",
@ -1728,6 +1752,7 @@ export default {
assertions: "Assertions",
assertions_pass: "Passed Assertions",
assertions_name: "Assertion Name",
assertions_content: "Content",
assertions_error_message: "Error Message",
assertions_is_success: "Fail/Success",
result: "Result",
@ -1850,7 +1875,7 @@ export default {
please_select_relate_test: "Please select the test to associate",
relate_test_not_find: 'The associated test does not exist, please check the test case',
other_relate_test_not_find: 'Associated test name, please go to the third party platform to execute',
batch_handle: 'Batch processing (select {0} item)',
batch_handle: 'Batch processing (select {0} items)',
batch_update: 'Update the attributes of {0} cases',
select_catalog: 'Please select use case catalog',
updated_attr_value: 'The updated attribute value',
@ -2364,7 +2389,9 @@ export default {
format: "Format",
nothing: "Nothing",
preview: "Preview",
add_custom: "Add Custom Prop"
add_custom: "Add Custom Prop",
json_warning: 'The imported data is not in JSON format',
json_schema_warning: 'The imported data is not in JSON-SCHEMA format',
},
loop: {
loops_title: "loops",

View File

@ -57,6 +57,7 @@ export default {
confirm: '确定',
cancel: '取消',
scenario: '场景',
scenario_warning: '当前场景没有环境,需要先设置自身环境',
confirm_info: '未保存,是否确认关闭?',
track: '用例',
actuator: '执行器',
@ -99,6 +100,9 @@ export default {
test_resource_pool: '测试资源池',
system_setting: '系统设置',
api: '接口测试',
follow_api: '跟随API定义',
encode: '编码',
response_time_delay: '响应延迟时间',
performance: '性能测试',
enable_settings: '启用设置',
view_settings: '显示设置',
@ -203,6 +207,9 @@ export default {
execute_history: "执行历史",
debug_history: "调试历史",
testing: "测试中",
edit_info: "编辑详情",
enable_scene: "启用场景环境",
enable_scene_info: "启用场景环境:当前步骤使用场景原始环境配置运行",
environment: "运行环境",
run_success: "执行成功",
run_completed: "执行完成",
@ -1460,6 +1467,23 @@ export default {
set_failure_status: "设置失败状态",
set_failure_msg: "设置失败消息",
suggest_tip: "点击便签添加JSONPath断言",
regex_info: '特殊字符"$ ( ) * + . [ ] \\ ^ { } |"需转义为"\\ "+"特殊字符",如"\\$"',
regular_match: '正则匹配',
none: '不校验[]',
value_eq: '值-等于[value=]',
value_not_eq: '值-不等于[value!=]',
value_in: '值-包含[include=]',
length_eq: '长度-等于[length=]',
length_not_eq: '长度-不等于[length!=]',
length_gt: '长度-大于[length>]',
length_lt: '长度-小于[length<]',
must_contain: '必含',
type_verification: '类型校验',
content_verification: '内容校验',
expected_results: '预期结果',
check: '校验组内元素',
add_check: '添加校验',
add_subfield: '添加子字段'
},
extract: {
label: "提取",
@ -1736,6 +1760,7 @@ export default {
assertions_pass: "成功断言",
assertions_name: "断言名称",
assertions_error_message: "错误信息",
assertions_content: "内容",
assertions_is_success: "是否成功",
result: "结果",
success: "成功",
@ -2369,7 +2394,9 @@ export default {
format: "格式化",
nothing: "无",
preview: "预览",
add_custom: "添加自定义属性"
add_custom: "添加自定义属性",
json_warning: "导入的数据非JSON格式",
json_schema_warning: '导入的数据非JSON-SCHEMA 格式',
},
loop: {
loops_title: "次数循环",

View File

@ -57,6 +57,7 @@ export default {
confirm: '確定',
cancel: '取消',
scenario: '場景',
scenario_warning: '當前場景沒有環境,需要先設定自身環境',
confirm_info: '未保存,是否確認關閉?',
track: '用例',
actuator: '執行器',
@ -99,6 +100,9 @@ export default {
test_resource_pool: '測試資源池',
system_setting: '系統設置',
api: '接口測試',
encode: '编码',
follow_api: '跟隨API定義',
response_time_delay: '響應延遲時間',
performance: '性能測試',
enable_settings: '啟用設置',
view_settings: '顯示設置',
@ -200,6 +204,9 @@ export default {
create_user_id: '創建人ID',
run_message: "任務執行中,請到任務中心查看詳情",
executor: "執行人",
edit_info: "編輯詳情",
enable_scene: "啟用場景環境",
enable_scene_info: "啟用場景環境:當前步驟使用場景原始環境配寘運行",
execute_history: "執行歷史",
debug_history: "調試歷史",
testing: "測試中",
@ -1459,6 +1466,23 @@ export default {
set_failure_status: "設置失敗狀態",
set_failure_msg: "設置失敗消息",
suggest_tip: "點擊便簽添加JSONPath斷言",
regex_info: '特殊字元“$* + . [ ] \\ ^ { } |”需轉義為“\\”+“特殊字元”,如“\\$”',
regular_match: '正則匹配',
none: '不校驗[]',
value_eq: '值-等於[value=]',
value_not_eq: '值-不等於[value=]',
value_in: '值-包含[include=]',
length_eq: '長度-等於[length=]',
length_not_eq: '長度-不等於[length=]',
length_gt: '長度-大於[length>]',
length_lt: '長度-小於[length<]',
must_contain: '必含',
type_verification: '類型校驗',
content_verification: '内容校驗',
expected_results: '預期結果',
check: '校驗組內元素',
add_check: '添加校驗',
add_subfield: '添加子字段'
},
extract: {
label: "提取",
@ -1735,6 +1759,7 @@ export default {
assertions_pass: "成功斷言",
assertions_name: "斷言名稱",
assertions_error_message: "錯誤信息",
assertions_content: "內容",
assertions_is_success: "是否成功",
result: "結果",
success: "成功",
@ -2368,7 +2393,9 @@ export default {
format: "格式化",
nothing: "無",
preview: "預覽",
add_custom: "添加自定義屬性"
add_custom: "添加自定義屬性",
json_warning: "導入的數據非JSON格式",
json_schema_warning: '導入的數據非JSON-SCHEMA格式',
},
loop: {
loops_title: "次數循環",