fix(接口测试): 接口定义中前置脚本英文下显示不全

This commit is contained in:
wxg0103 2021-12-20 16:31:42 +08:00 committed by BugKing
parent 17fc3d0871
commit 74308ac4e0
12 changed files with 56 additions and 342 deletions

View File

@ -486,6 +486,7 @@ export default {
this.$store.state.scenarioMap.set(this.currentScenario.id, change); this.$store.state.scenarioMap.set(this.currentScenario.id, change);
} }
}, },
}, },
created() { created() {
if (!this.currentScenario.apiScenarioModuleId) { if (!this.currentScenario.apiScenarioModuleId) {
@ -905,9 +906,9 @@ export default {
fabClick() { fabClick() {
if (this.operatingElements && this.operatingElements.length < 1) { if (this.operatingElements && this.operatingElements.length < 1) {
if (this.selectedTreeNode && this.selectedTreeNode.referenced === 'REF' || this.selectedTreeNode.disabled) { if (this.selectedTreeNode && this.selectedTreeNode.referenced === 'REF' || this.selectedTreeNode.disabled) {
this.$warning("引用的场景步骤及子步骤都无法添加其他步骤"); this.$warning(this.$t('api_test.scenario.scenario_warning'));
} else { } else {
this.$warning("当前步骤下不能添加其他步骤"); this.$warning(this.$t('api_test.scenario.scenario_step_warning'));
} }
} }
}, },
@ -1005,7 +1006,7 @@ export default {
if (arr && arr.length > 0) { if (arr && arr.length > 0) {
arr.forEach(item => { arr.forEach(item => {
if (item.id === this.currentScenario.id) { if (item.id === this.currentScenario.id) {
this.$error("不能引用或复制自身!"); this.$error(this.$t("api_test.scenario.scenario_error"));
this.$refs.scenarioRelevance.changeButtonLoadingType(); this.$refs.scenarioRelevance.changeButtonLoadingType();
return; return;
} }

View File

@ -235,6 +235,7 @@
.script-index { .script-index {
padding: 0 20px; padding: 0 20px;
width: 230px;
} }
.template-title { .template-title {

View File

@ -208,6 +208,7 @@ export default {
.script-index { .script-index {
padding: 0 20px; padding: 0 20px;
width: 230px;
} }
.template-title { .template-title {

View File

@ -130,6 +130,7 @@ export default {
.script-index { .script-index {
padding: 0 20px; padding: 0 20px;
width: 230px;
} }
.template-title { .template-title {

View File

@ -133,7 +133,7 @@
</el-row> </el-row>
</el-card> </el-card>
<edit-project ref="editProject"/> <edit-project ref="editProject" :is-show-app="isShowApp"/>
</ms-main-container> </ms-main-container>
</ms-container> </ms-container>
@ -157,7 +157,8 @@ export default {
createUser: '' createUser: ''
}, },
memberSize: 0, memberSize: 0,
result: {} result: {},
isShowApp: false
} }
}, },
methods: { methods: {

View File

@ -7,7 +7,8 @@
<el-input v-model="form.name" autocomplete="off"></el-input> <el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item> </el-form-item>
<el-form-item v-if="platformOptions.length > 1" :label-width="labelWidth" :label="$t('test_track.issue.third_party_integrated')" prop="platform"> <el-form-item v-if="platformOptions.length > 1" :label-width="labelWidth" :label="$t('集成第三方平台')"
prop="platform">
<el-select filterable v-model="form.platform"> <el-select filterable v-model="form.platform">
<el-option v-for="item in platformOptions" :key="item.value" :label="item.text" :value="item.value"> <el-option v-for="item in platformOptions" :key="item.value" :label="item.text" :value="item.value">
</el-option> </el-option>
@ -18,16 +19,19 @@
<template-select :data="form" scene="API_CASE" prop="caseTemplateId" ref="caseTemplate"/> <template-select :data="form" scene="API_CASE" prop="caseTemplateId" ref="caseTemplate"/>
</el-form-item> </el-form-item>
<el-form-item v-if="xpackEable && form.platform === 'Jira'" :label-width="labelWidth" :label="$t('test_track.issue.use_third_party')" prop="scenarioCustomNum"> <el-form-item v-if="xpackEable" :label-width="labelWidth" :label="$t('使用第三方平台模板')" prop="scenarioCustomNum">
<el-switch v-model="form.thirdPartTemplate"></el-switch> <el-switch v-model="form.thirdPartTemplate"></el-switch>
</el-form-item> </el-form-item>
<el-form-item v-if="!xpackEable || !form.thirdPartTemplate" :label-width="labelWidth" :label="$t('workspace.issue_template_manage')" prop="issueTemplateId"> <el-form-item v-if="!xpackEable || !form.thirdPartTemplate" :label-width="labelWidth"
<template-select :platform="form.platform" :data="form" scene="ISSUE" prop="issueTemplateId" ref="issueTemplate"/> :label="$t('workspace.issue_template_manage')" prop="issueTemplateId">
<template-select :platform="form.platform" :data="form" scene="ISSUE" prop="issueTemplateId"
ref="issueTemplate"/>
</el-form-item> </el-form-item>
<el-form-item :label-width="labelWidth" label="TCP Mock Port"> <el-form-item :label-width="labelWidth" label="TCP Mock Port">
<el-input-number v-model="form.mockTcpPort" :controls="false" style="width: 37%;margin-right: 30px"></el-input-number> <el-input-number v-model="form.mockTcpPort" :controls="false"
style="width: 37%;margin-right: 30px"></el-input-number>
<el-switch v-model="form.isMockTcpOpen" @change="chengeMockTcpSwitch"></el-switch> <el-switch v-model="form.isMockTcpOpen" @change="chengeMockTcpSwitch"></el-switch>
</el-form-item> </el-form-item>
@ -63,6 +67,18 @@
<el-input v-model="form.azureFilterId" autocomplete="off"/> <el-input v-model="form.azureFilterId" autocomplete="off"/>
<ms-instructions-icon content="非必填项,用例关联需求时,可以只筛选出,所填的 workItem 下的选项" effect="light"/> <ms-instructions-icon content="非必填项,用例关联需求时,可以只筛选出,所填的 workItem 下的选项" effect="light"/>
</el-form-item> </el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('project.repeatable')" prop="repeatable"
v-if="this.isShowApp">
<el-switch v-model="form.repeatable"></el-switch>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('project.test_case_custom_id')" prop="customNum"
v-if="this.isShowApp">
<el-switch v-model="form.customNum"></el-switch>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('project.scenario_custom_id')" prop="scenarioCustomNum"
v-if="this.isShowApp">
<el-switch v-model="form.scenarioCustomNum"></el-switch>
</el-form-item>
</el-form> </el-form>
<template v-slot:footer> <template v-slot:footer>
<div class="dialog-footer"> <div class="dialog-footer">
@ -147,7 +163,7 @@ export default {
// issueTemplateId: [{required: true}], // issueTemplateId: [{required: true}],
}, },
screenHeight: 'calc(100vh - 195px)', screenHeight: 'calc(100vh - 195px)',
labelWidth: '210px', labelWidth: '150px',
platformOptions: [], platformOptions: [],
xpackEable: false xpackEable: false
}; };
@ -155,6 +171,10 @@ export default {
props: { props: {
baseUrl: { baseUrl: {
type: String type: String
},
isShowApp: {
type: Boolean,
default: true
} }
}, },
mounted() { mounted() {
@ -222,7 +242,7 @@ export default {
if (platforms.indexOf(platform) === -1) { if (platforms.indexOf(platform) === -1) {
for (let i = 0; i < this.platformOptions.length; i++) { for (let i = 0; i < this.platformOptions.length; i++) {
if (this.platformOptions[i].value === platform) { if (this.platformOptions[i].value === platform) {
this.platformOptions.splice(i, 1); this.platformOptions.splice(1, i);
break; break;
} }
} }
@ -278,8 +298,8 @@ export default {
removeGoBackListener(this.handleClose); removeGoBackListener(this.handleClose);
this.createVisible = false; this.createVisible = false;
}, },
chengeMockTcpSwitch(value){ chengeMockTcpSwitch(value) {
if(value && this.form.mockTcpPort === 0){ if (value && this.form.mockTcpPort === 0) {
this.result = this.$get('/project/genTcpMockPort/' + this.form.id, res => { this.result = this.$get('/project/genTcpMockPort/' + this.form.id, res => {
let port = res.data; let port = res.data;
this.form.mockTcpPort = port; this.form.mockTcpPort = port;
@ -302,7 +322,7 @@ pre {
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", Arial, sans-serif; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
} }
.el-input,.el-textarea { .el-input, .el-textarea {
width: 80%; width: 80%;
} }
</style> </style>

View File

@ -331,6 +331,7 @@ export default {
.script-index { .script-index {
margin-top: 10px; margin-top: 10px;
width: 230px;
} }
.show-menu { .show-menu {

View File

@ -1,321 +0,0 @@
<template>
<div v-loading="result.loading">
<el-dialog :close-on-click-modal="false" :title="title" :visible.sync="createVisible" destroy-on-close
@close="handleClose">
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="80px" size="small">
<el-form-item :label-width="labelWidth" :label="$t('commons.name')" prop="name">
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item v-if="platformOptions.length > 1" :label-width="labelWidth" :label="$t('集成第三方平台')"
prop="platform">
<el-select filterable v-model="form.platform">
<el-option v-for="item in platformOptions" :key="item.value" :label="item.text" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('workspace.case_template_manage')" prop="caseTemplateId">
<template-select :data="form" scene="API_CASE" prop="caseTemplateId" ref="caseTemplate"/>
</el-form-item>
<el-form-item v-if="xpackEable" :label-width="labelWidth" :label="$t('使用第三方平台模板')" prop="scenarioCustomNum">
<el-switch v-model="form.thirdPartTemplate"></el-switch>
</el-form-item>
<el-form-item v-if="!xpackEable || !form.thirdPartTemplate" :label-width="labelWidth"
:label="$t('workspace.issue_template_manage')" prop="issueTemplateId">
<template-select :platform="form.platform" :data="form" scene="ISSUE" prop="issueTemplateId"
ref="issueTemplate"/>
</el-form-item>
<el-form-item :label-width="labelWidth" label="TCP Mock Port">
<el-input-number v-model="form.mockTcpPort" :controls="false"
style="width: 37%;margin-right: 30px"></el-input-number>
<el-switch v-model="form.isMockTcpOpen" @change="chengeMockTcpSwitch"></el-switch>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('commons.description')" prop="description">
<el-input :autosize="{ minRows: 2, maxRows: 4}" type="textarea" v-model="form.description"></el-input>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('project.tapd_id')" v-if="tapd">
<el-input v-model="form.tapdId" autocomplete="off"></el-input>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('project.jira_key')" v-if="jira">
<el-input v-model="form.jiraKey" autocomplete="off"/>
<ms-instructions-icon effect="light">
<template>
<img class="jira-image" src="../../../../assets/jira-key.png"/>
</template>
</ms-instructions-icon>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('project.zentao_id')" v-if="zentao">
<el-input v-model="form.zentaoId" autocomplete="off"></el-input>
<ms-instructions-icon effect="light">
<template>
禅道流程产品-项目 | 产品-迭代 | 产品-冲刺 | 项目-迭代 | 项目-冲刺 <br/><br/>
根据 "后台 -> 自定义 -> 流程" 查看对应流程根据流程填写ID <br/><br/>
产品-项目 | 产品-迭代 | 产品-冲刺 需要填写产品ID <br/><br/>
项目-迭代 | 项目-冲刺 需要填写项目ID
</template>
</ms-instructions-icon>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('project.azureDevops_id')" v-if="azuredevops">
<el-input v-model="form.azureDevopsId" autocomplete="off"></el-input>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('project.azureDevops_filter_id')" v-if="azuredevops">
<el-input v-model="form.azureFilterId" autocomplete="off"/>
<ms-instructions-icon content="非必填项,用例关联需求时,可以只筛选出,所填的 workItem 下的选项" effect="light"/>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('project.repeatable')" prop="repeatable">
<el-switch v-model="form.repeatable"></el-switch>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('project.test_case_custom_id')" prop="customNum">
<el-switch v-model="form.customNum"></el-switch>
</el-form-item>
<el-form-item :label-width="labelWidth" :label="$t('project.scenario_custom_id')" prop="scenarioCustomNum">
<el-switch v-model="form.scenarioCustomNum"></el-switch>
</el-form-item>
</el-form>
<template v-slot:footer>
<div class="dialog-footer">
<ms-dialog-footer
@cancel="createVisible = false"
@confirm="submit('form')"/>
</div>
</template>
</el-dialog>
<ms-delete-confirm :title="$t('project.delete')" @delete="_handleDelete" ref="deleteConfirm"/>
</div>
</template>
<script>
import {
getCurrentProjectID,
getCurrentUser, getCurrentUserId,
getCurrentWorkspaceId, hasLicense,
listenGoBack,
removeGoBackListener
} from "@/common/js/utils";
import {AZURE_DEVOPS, JIRA, PROJECT_ID, TAPD, ZEN_TAO} from "@/common/js/constants";
import {PROJECT_CONFIGS} from "@/business/components/common/components/search/search-components";
import MsInstructionsIcon from "@/business/components/common/components/MsInstructionsIcon";
import TemplateSelect from "@/business/components/settings/workspace/template/TemplateSelect";
import MsResourceFiles from "@/business/components/performance/test/components/ResourceFiles";
import MsTableButton from "@/business/components/common/components/MsTableButton";
import MsJarConfig from "@/business/components/api/test/components/jar/JarConfig";
import TemplateComponent
from "@/business/components/track/plan/view/comonents/report/TemplateComponent/TemplateComponent";
import ApiEnvironmentConfig from "@/business/components/api/test/components/ApiEnvironmentConfig";
import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton";
import MsDeleteConfirm from "@/business/components/common/components/MsDeleteConfirm";
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
import MsContainer from "@/business/components/common/components/MsContainer";
import MsTableOperator from "@/business/components/common/components/MsTableOperator";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import MsTableHeader from "@/business/components/common/components/MsTableHeader";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import {ISSUE_PLATFORM_OPTION} from "@/common/js/table-constants";
export default {
name: "EditProject",
components: {
MsInstructionsIcon,
TemplateSelect,
MsResourceFiles,
MsTableButton,
MsJarConfig,
TemplateComponent,
ApiEnvironmentConfig,
MsTableOperatorButton,
MsDeleteConfirm,
MsMainContainer,
MsContainer, MsTableOperator, MsTablePagination, MsTableHeader, MsDialogFooter
},
data() {
return {
createVisible: false,
result: {},
btnTips: this.$t('project.create'),
title: this.$t('project.create'),
condition: {components: PROJECT_CONFIGS},
items: [],
form: {},
currentPage: 1,
pageSize: 10,
total: 0,
userFilters: [],
rules: {
name: [
{required: true, message: this.$t('project.input_name'), trigger: 'blur'},
{min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'}
],
description: [
{max: 250, message: this.$t('commons.input_limit', [0, 250]), trigger: 'blur'}
],
// caseTemplateId: [{required: true}],
// issueTemplateId: [{required: true}],
},
screenHeight: 'calc(100vh - 195px)',
labelWidth: '150px',
platformOptions: [],
xpackEable: false
};
},
props: {
baseUrl: {
type: String
}
},
mounted() {
if (this.$route.path.split('/')[2] === 'project' &&
this.$route.path.split('/')[3] === 'create') {
this.create();
this.$router.replace('/setting/project/all');
}
this.xpackEable = hasLicense();
},
computed: {
currentUser: () => {
return getCurrentUser();
},
tapd() {
return this.form.platform === TAPD && this.platformOptions.map(i => i.value).indexOf(TAPD) > -1;
},
jira() {
return this.form.platform === JIRA && this.platformOptions.map(i => i.value).indexOf(JIRA) > -1;
},
zentao() {
return this.form.platform === ZEN_TAO && this.platformOptions.map(i => i.value).indexOf(ZEN_TAO) > -1;
},
azuredevops() {
return this.form.platform === AZURE_DEVOPS && this.platformOptions.map(i => i.value).indexOf(AZURE_DEVOPS) > -1;
},
},
inject: [
'reload'
],
destroyed() {
this.createVisible = false;
},
methods: {
getOptions() {
if (this.$refs.issueTemplate) {
this.$refs.issueTemplate.getTemplateOptions();
}
if (this.$refs.caseTemplate) {
this.$refs.caseTemplate.getTemplateOptions();
}
},
edit(row) {
this.title = this.$t('project.edit');
this.getOptions();
this.createVisible = true;
listenGoBack(this.handleClose);
if (row) {
this.form = Object.assign({}, row);
} else {
this.form = {};
}
this.platformOptions = [];
this.platformOptions.push(...ISSUE_PLATFORM_OPTION);
this.$get("/service/integration/all/" + getCurrentUser().lastWorkspaceId, response => {
let data = response.data;
let platforms = data.map(d => d.platform);
this.filterPlatformOptions(platforms, TAPD);
this.filterPlatformOptions(platforms, JIRA);
this.filterPlatformOptions(platforms, ZEN_TAO);
this.filterPlatformOptions(platforms, AZURE_DEVOPS);
});
},
filterPlatformOptions(platforms, platform) {
if (platforms.indexOf(platform) === -1) {
for (let i = 0; i < this.platformOptions.length; i++) {
if (this.platformOptions[i].value === platform) {
this.platformOptions.splice(1, i);
break;
}
}
}
},
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
let saveType = "add";
if (this.form.id) {
saveType = "update";
}
let protocol = document.location.protocol;
protocol = protocol.substring(0, protocol.indexOf(":"));
this.form.protocal = protocol;
this.form.workspaceId = getCurrentWorkspaceId();
this.form.createUser = getCurrentUserId();
this.result = this.$post("/project/" + saveType, this.form, () => {
this.createVisible = false;
this.reload();
this.$success(this.$t('commons.save_success'));
});
} else {
return false;
}
});
},
handleDelete(project) {
this.$refs.deleteConfirm.open(project);
},
_handleDelete(project) {
this.$confirm(this.$t('project.delete_tip'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
this.$get('/project/delete/' + project.id, () => {
if (project.id === getCurrentProjectID()) {
localStorage.removeItem(PROJECT_ID);
this.$post("/user/update/current", {id: getCurrentUser().id, lastProjectId: ''});
}
this.$success(this.$t('commons.delete_success'));
this.list();
});
}).catch(() => {
this.$message({
type: 'info',
message: this.$t('commons.delete_cancelled')
});
});
},
handleClose() {
removeGoBackListener(this.handleClose);
this.createVisible = false;
},
chengeMockTcpSwitch(value) {
if (value && this.form.mockTcpPort === 0) {
this.result = this.$get('/project/genTcpMockPort/' + this.form.id, res => {
let port = res.data;
this.form.mockTcpPort = port;
})
}
}
},
created() {
document.addEventListener('keydown', this.handleEvent);
},
beforeDestroy() {
document.removeEventListener('keydown', this.handleEvent);
},
};
</script>
<style scoped>
pre {
margin: 0 0;
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
}
.el-input, .el-textarea {
width: 80%;
}
</style>

View File

@ -209,7 +209,7 @@ import {PROJECT_CONFIGS} from "@/business/components/common/components/search/se
import MsRolesTag from "@/business/components/common/components/MsRolesTag"; import MsRolesTag from "@/business/components/common/components/MsRolesTag";
import AddMember from "@/business/components/settings/common/AddMember"; import AddMember from "@/business/components/settings/common/AddMember";
import MsInstructionsIcon from "@/business/components/common/components/MsInstructionsIcon"; import MsInstructionsIcon from "@/business/components/common/components/MsInstructionsIcon";
import EditProject from "@/business/components/settings/workspace/EditProject"; import EditProject from "@/business/components/project/menu/EditProject";
export default { export default {
name: "MsProject", name: "MsProject",

View File

@ -1347,12 +1347,15 @@ export default {
clone: "Copy", clone: "Copy",
cant_reference: 'Historical test files, can be referenced after re-saving', cant_reference: 'Historical test files, can be referenced after re-saving',
share_cookie: 'share cookie', share_cookie: 'share cookie',
module_id:'Scenario Module ID', module_id: 'Scenario Module ID',
level: 'Level', level: 'Level',
version:"Scenario Version", version: "Scenario Version",
warning_context:"It is not currently supported to add all scenarios to the test plan in batches!", warning_context: "It is not currently supported to add all scenarios to the test plan in batches!",
jmx_file_set:"Scenario JMX file set", jmx_file_set: "Scenario JMX file set",
error_report_jmx:"Failed to export JMX file", error_report_jmx: "Failed to export JMX file",
scenario_warning: "No other steps can be added to the referenced scenario steps and sub-steps",
scenario_step_warning: "No other steps can be added under the current step",
scenario_error: "Cannot reference or copy itself",
}, },
request: { request: {
debug: "Debug", debug: "Debug",

View File

@ -1357,6 +1357,9 @@ export default {
warning_context: "暂不支持批量添加所有场景到测试计划!", warning_context: "暂不支持批量添加所有场景到测试计划!",
jmx_file_set: "场景JMX文件集", jmx_file_set: "场景JMX文件集",
error_report_jmx: "导出JMX文件失败", error_report_jmx: "导出JMX文件失败",
scenario_warning: "引用的场景步骤及子步骤都无法添加其他步骤",
scenario_step_warning: "当前步骤下不能添加其他步骤",
scenario_error: "不能引用或复制自身!",
}, },
request: { request: {
debug: "调试", debug: "调试",

View File

@ -1357,6 +1357,9 @@ export default {
warning_context: "暫不支持批量添加所有場景到測試計劃!", warning_context: "暫不支持批量添加所有場景到測試計劃!",
jmx_file_set: "場景JMX文件集", jmx_file_set: "場景JMX文件集",
error_report_jmx: "導出JMX文件失敗", error_report_jmx: "導出JMX文件失敗",
scenario_warning: "引用的場景步驟及子步驟都無法添加其他步驟",
scenario_step_warning: "當前步驟下不能添加其他步驟",
scenario_error: "不能引用或複製自身!",
}, },
request: { request: {
debug: "調試", debug: "調試",