feat: 添加模版示例,增加接口测试报告路径

This commit is contained in:
wenyann 2021-01-26 16:05:08 +08:00
parent 96431f0899
commit 2ec320b519
11 changed files with 279 additions and 7 deletions

View File

@ -243,21 +243,23 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
String url = reportUrl;
String url2 = reportUrl;
if (StringUtils.isEmpty(url)) {
url = baseSystemConfigDTO.getUrl() + "/#/api/report/view/" + report.getId();
url2 = baseSystemConfigDTO.getUrl() + "/#/api/automation/report";
}
String successContext = "";
String failedContext = "";
String subject = "";
String event = "";
if (StringUtils.equals(ReportTriggerMode.API.name(), report.getTriggerMode())) {
successContext = "接口测试 API任务通知:'" + report.getName() + "'执行成功" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + url;
failedContext = "接口测试 API任务通知:'" + report.getName() + "'执行失败" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + url;
successContext = "接口测试 API任务通知:'" + report.getName() + "'执行成功" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
failedContext = "接口测试 API任务通知:'" + report.getName() + "'执行失败" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
subject = Translator.get("task_notification_jenkins");
}
if (StringUtils.equals(ReportTriggerMode.SCHEDULE.name(), report.getTriggerMode())) {
successContext = "接口测试定时任务通知:'" + report.getName() + "'执行成功" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + url;
failedContext = "接口测试定时任务通知:'" + report.getName() + "'执行失败" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + url;
successContext = "接口测试定时任务通知:'" + report.getName() + "'执行成功" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
failedContext = "接口测试定时任务通知:'" + report.getName() + "'执行失败" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
subject = Translator.get("task_notification");
}
if (StringUtils.equals("Success", report.getStatus())) {

View File

@ -6,6 +6,26 @@
@click="handleAddTaskModel">
{{ $t('organization.message.create_new_notification') }}
</el-button>
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="title">
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.mail_template_example') }}
</el-button>
</el-popover>
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="robotTitle">
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.robot_template') }}
</el-button>
</el-popover>
</el-col>
</el-row>
<el-row>
@ -134,7 +154,35 @@ export default {
},
data() {
return {
title: '<!DOCTYPE html>\n' +
'<html lang="en">\n' +
'<head>\n' +
' <meta charset="UTF-8">\n' +
' <title>MeterSphere</title>\n' +
'</head>\n' +
'<body>\n' +
'<div>\n' +
' <div style="text-align: left">\n' +
' <p>尊敬的用户:</p>\n' +
' <p style="margin-left: 60px">您好:\n' +
' </div>\n' +
' <div style="margin-left: 100px">\n' +
' <p>您所执行的 ${testName} 接口测试运行失败<br/>\n' +
' 请点击下面链接进入测试报告页面</p>\n' +
' <a href="${url}/#/${type}/report/view/${id}">${url}/#/${type}/report/view/${id}</a>\n' +
' <p>新版接口测试报告路径</p>\n' +
' <a href="${url}/#/api/automation">${url}/#/api/automation</a>\n' +
' </div>\n' +
'\n' +
'</div>\n' +
'</body>\n' +
'</html>',
robotTitle:
"测试【任务通知】:'您所执行的 ${testName} ${type}测试运行${status}\n" +
"请点击下面链接进入测试报告页面\n" +
"${url}/#/${type}/report/view/${id}" +
"新版接口测试报告路径\n" +
"${url}/#/api/automation",
scheduleTask: [{
taskType: "scheduleTask",
event: "",

View File

@ -181,7 +181,7 @@ export default {
methods: {
scheduleEdit() {
if (!this.formData.swaggerUrl) {
this.$warning(this.$t('commons.please_upload'));
this.$warning(this.$t('commons.please_fill_path'));
this.swaggerSynchronization = !this.swaggerSynchronization
} else {
if (this.swaggerSynchronization) {

View File

@ -6,6 +6,26 @@
<el-button icon="el-icon-circle-plus-outline" plain size="mini" @click="handleAddTaskModel">
{{ $t('organization.message.create_new_notification') }}
</el-button>
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="title">
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.mail_template_example') }}
</el-button>
</el-popover>
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="robotTitle">
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.robot_template') }}
</el-button>
</el-popover>
</el-col>
</el-row>
<el-row>
@ -129,6 +149,19 @@ export default {
},
data() {
return {
title: "<!DOCTYPE html>\n" +
"<html lang=\"en\">\n" +
"<head>\n" +
" <meta charset=\"UTF-8\">\n" +
" <title>MeterSphere</title>\n" +
"</head>\n" +
"<body>\n" +
"<div>\n" +
" <p>${creator}发起了一个缺陷:${issuesName},请跟进</p>\n" +
"</div>\n" +
"</body>\n" +
"</html>",
robotTitle: "【任务通知】:${creator}发起了一个缺陷:${issuesName},请跟进",
defectTask: [{
taskType: "defectTask",
event: "",

View File

@ -6,6 +6,28 @@
<el-button icon="el-icon-circle-plus-outline" plain size="mini" @click="handleAddTaskModel">
{{ $t('organization.message.create_new_notification') }}
</el-button>
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="title">
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.mail_template_example') }}
</el-button>
</el-popover>
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="robotTitle">
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.robot_template') }}
</el-button>
</el-popover>
</el-col>
</el-row>
<el-row>
@ -132,6 +154,35 @@ export default {
},
data() {
return {
title: '<!DOCTYPE html>\n' +
'<html lang="en">\n' +
'<head>\n' +
' <meta charset="UTF-8">\n' +
' <title>MeterSphere</title>\n' +
'</head>\n' +
'<body>\n' +
'<div>\n' +
' <div style="text-align: left">\n' +
' <p>尊敬的用户:</p>\n' +
' <p style="margin-left: 60px">您好:\n' +
' </div>\n' +
' <div style="margin-left: 100px">\n' +
' <p>您所执行的 ${testName} 接口测试运行失败<br/>\n' +
' 请点击下面链接进入测试报告页面</p>\n' +
' <a href="${url}/#/${type}/report/view/${id}">${url}/#/${type}/report/view/${id}</a>\n' +
' <p>新版接口测试报告路径</p>\n' +
' <a href="${url}/#/api/automation">${url}/#/api/automation</a>\n' +
' </div>\n' +
'\n' +
'</div>\n' +
'</body>\n' +
'</html>',
robotTitle:
"测试【任务通知】:'您所执行的 ${testName} ${type}测试运行${status}\n" +
"请点击下面链接进入测试报告页面\n" +
"${url}/#/${type}/report/view/${id}" +
"新版接口测试报告路径\n" +
"${url}/#/api/automation",
jenkinsTask: [{
taskType: "jenkinsTask",
event: "",

View File

@ -6,6 +6,26 @@
@click="handleAddTaskModel">
{{ $t('organization.message.create_new_notification') }}
</el-button>
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="title">
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.mail_template_example') }}
</el-button>
</el-popover>
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="robotTitle">
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.robot_template') }}
</el-button>
</el-popover>
</el-col>
</el-row>
<el-row>
@ -135,7 +155,35 @@ export default {
},
data() {
return {
title: '<!DOCTYPE html>\n' +
'<html lang="en">\n' +
'<head>\n' +
' <meta charset="UTF-8">\n' +
' <title>MeterSphere</title>\n' +
'</head>\n' +
'<body>\n' +
'<div>\n' +
' <div style="text-align: left">\n' +
' <p>尊敬的用户:</p>\n' +
' <p style="margin-left: 60px">您好:\n' +
' </div>\n' +
' <div style="margin-left: 100px">\n' +
' <p>您所执行的 ${testName} 接口测试运行失败<br/>\n' +
' 请点击下面链接进入测试报告页面</p>\n' +
' <a href="${url}/#/${type}/report/view/${id}">${url}/#/${type}/report/view/${id}</a>\n' +
' <p>新版接口测试报告路径</p>\n' +
' <a href="${url}/#/api/automation">${url}/#/api/automation</a>\n' +
' </div>\n' +
'\n' +
'</div>\n' +
'</body>\n' +
'</html>',
robotTitle:
"测试【任务通知】:'您所执行的 ${testName} ${type}测试运行${status}\n" +
"请点击下面链接进入测试报告页面\n" +
"${url}/#/${type}/report/view/${id}" +
"新版接口测试报告路径\n" +
"${url}/#/api/automation",
scheduleTask: [{
taskType: "scheduleTask",
event: "",

View File

@ -6,6 +6,26 @@
<el-button icon="el-icon-circle-plus-outline" plain size="mini" @click="handleAddTaskModel">
{{ $t('organization.message.create_new_notification') }}
</el-button>
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="title">
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.mail_template_example') }}
</el-button>
</el-popover>
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="robotTitle">
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.robot_template') }}
</el-button>
</el-popover>
</el-col>
</el-row>
<el-row>
@ -130,6 +150,27 @@ export default {
},
data() {
return {
title: "<!DOCTYPE html>\n" +
"<html lang=\"en\">\n" +
"<head>\n" +
" <meta charset=\"UTF-8\">\n" +
" <title>MeterSphere</title>\n" +
"</head>\n" +
"<body>\n" +
"<div>\n" +
" <p style=\"text-align: left\">${creator} 创建的:<br>\n" +
" ${testPlanName}<br>\n" +
" 计划开始时间是:${start}<br>\n" +
" 计划结束时间为:${end}<br>\n" +
" 请跟进!<br>\n" +
" 点击下面链接进入测试计划页面</p>\n" +
" <a href=\"${url}/#/track/plan/all\">${url}/#/track/plan/all</a>\n" +
"</div>\n" +
"</body>\n" +
"</html>",
robotTitle:
" 【任务通知】:${creator} 创建的:${testPlanName}计划开始时间是:${start}计划结束时间是:${end}请跟进!/ ${status}" +
"点击下面链接进入测试计划页面${url}/#/track/plan/all",
testCasePlanTask: [{
taskType: "testPlanTask",
event: "",

View File

@ -6,6 +6,26 @@
<el-button icon="el-icon-circle-plus-outline" plain size="mini" @click="handleAddTaskModel">
{{ $t('organization.message.create_new_notification') }}
</el-button>
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="title">
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.mail_template_example') }}
</el-button>
</el-popover>
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="robotTitle">
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.robot_template') }}
</el-button>
</el-popover>
</el-col>
</el-row>
<el-row>
@ -130,6 +150,26 @@ export default {
},
data() {
return {
title: "<!DOCTYPE html>\n" +
"<html lang=\"en\">\n" +
"<head>\n" +
" <meta charset=\"UTF-8\">\n" +
" <title>MeterSphere</title>\n" +
"</head>\n" +
"<body>\n" +
"<div>\n" +
" <p style=\"text-align: left\">${creator} 创建的:<br>\n" +
" ${reviewName}待开始<br>\n" +
" 计划开始时间是:${start}<br>\n" +
" 计划结束时间为:${end}<br>\n" +
" 请跟进!/${status}<br>\n" +
" 点击下面链接进入评审页面进行审核</p>\n" +
" <a href=\"${url}/#/track/review/view/${id}\">${url}/#/track/review/view/${id}</a>\n" +
"</div>\n" +
"</body>\n" +
"</html>",
robotTitle: "【任务通知】:${creator} 创建的:${reviewName}待开始,计划开始时间是:${start}," +
"计划结束时间是:${end}请跟进!/ ${status}!点击下面链接进入测试评审页面${url}/#/track/review/view/${id}",
reviewTask: [{
taskType: "reviewTask",
event: "",

View File

@ -123,6 +123,7 @@ export default {
required: "{0} is required",
millisecond: 'ms',
please_upload: 'Please upload file',
please_fill_path: 'Please fill in the path',
reference_documentation: "Reference documentation",
already_exists: 'The name already exists',
modifier: 'Modifier',
@ -250,6 +251,8 @@ export default {
test_review_task_notice: 'Test review task notice',
defect_task_notification: 'Defect task notification',
create_new_notification: 'Create a new notification',
mail_template_example: 'Mail template',
robot_template: 'Robot template',
select_events: 'Select event',
select_receiving_method: 'Select receiving method',
mail: 'mail',

View File

@ -117,6 +117,7 @@ export default {
input_login_username: '请输入用户 ID 或 邮箱',
input_name: '请输入名称',
please_upload: '请上传文件',
please_fill_path: '请填写ur路径',
formatErr: '格式错误',
please_save: '请先保存',
reference_documentation: "参考文档",
@ -250,6 +251,8 @@ export default {
test_plan_task_notification: '测试计划任务通知',
test_review_task_notice: '测试评审任务通知',
create_new_notification: '创建新通知',
mail_template_example: '邮件模版',
robot_template: '机器人模版',
select_events: '选择事件',
defect_task_notification: '缺陷任务通知',
select_receiving_method: '选择接收方式',

View File

@ -117,6 +117,7 @@ export default {
input_login_username: '請輸入用戶 ID 或 郵箱',
input_name: '請輸入名稱',
please_upload: '請上傳文件',
please_fill_path: '請填寫ur路徑',
formatErr: '格式錯誤',
please_save: '請先保存',
reference_documentation: "參考文檔",
@ -250,6 +251,8 @@ export default {
test_plan_task_notification: '測試計劃任務通知',
test_review_task_notice: '測試評審任務通知',
create_new_notification: '創建新通知',
mail_template_example: '郵件範本示例',
robot_template: '機器人模版',
select_events: '選擇事件',
defect_task_notification: '缺陷任務通知',
select_receiving_method: '選擇接收方式',