Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
Captain.B 2020-12-21 16:11:03 +08:00
commit 51142905ad
12 changed files with 346 additions and 295 deletions

10
Jenkinsfile vendored
View File

@ -4,7 +4,7 @@ pipeline {
label 'master'
}
}
options { quietPeriod(2400) }
options { quietPeriod(1200) }
parameters {
string(name: 'IMAGE_NAME', defaultValue: 'metersphere', description: '构建后的 Docker 镜像名称')
string(name: 'IMAGE_FREFIX', defaultValue: 'registry.cn-qingdao.aliyuncs.com/metersphere', description: '构建后的 Docker 镜像带仓库名的前缀')
@ -25,4 +25,12 @@ pipeline {
}
}
}
post('Notification') {
always {
sh "echo \$WEBHOOK\n"
withCredentials([string(credentialsId: 'wechat-bot-webhook', variable: 'WEBHOOK')]) {
qyWechatNotification failSend: true, mentionedId: '', mentionedMobile: '', webhookUrl: "$WEBHOOK"
}
}
}
}

View File

@ -121,9 +121,11 @@
</select>
<select id="list" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select test_plan_test_case.id as id, test_case.id as caseId, test_case.name, test_case.priority, test_case.type,
select test_plan_test_case.id as id, test_case.id as caseId, test_case.name, test_case.priority,
test_case.type,test_case.test_id as testId,
test_case.node_path, test_case.method, test_case.num, test_plan_test_case.executor, test_plan_test_case.status,
test_plan_test_case.update_time, test_case_node.name as model, project.name as projectName, test_plan_test_case.plan_id as planId
test_plan_test_case.update_time, test_case_node.name as model, project.name as projectName,
test_plan_test_case.plan_id as planId
from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id=test_case.node_id

View File

@ -1,6 +1,6 @@
<template>
<el-card class="card-content">
<div class="ms-main-div">
<div class="ms-main-div" @click="showAll">
<el-row>
<el-col>
<!--操作按钮-->
@ -127,12 +127,11 @@
{{$t('api_test.automation.step_total')}}{{scenarioDefinition.length}}
</el-col>
<el-col :span="3" class="ms-col-one">
<el-link class="head" @click="showScenarioParameters">{{$t('api_test.automation.scenario_total')}}
{{this.currentScenario.variables!=undefined?this.currentScenario.variables.length-1: 0}}
</el-link>
<el-link class="head" @click="showScenarioParameters">{{$t('api_test.automation.scenario_total')}}</el-link>
{{this.currentScenario.variables!=undefined?this.currentScenario.variables.length-1: 0}}
</el-col>
<el-col :span="3">
<el-checkbox v-model="currentScenario.enableCookieShare" style="margin-top: 5px">{{ '共享cookie' }}</el-checkbox>
<el-checkbox v-model="enableCookieShare" style="margin-top: 5px">{{ '共享cookie' }}</el-checkbox>
</el-col>
<el-col :span="7">
{{$t('api_test.definition.request.run_env')}}:
@ -239,7 +238,7 @@
</div>
<!--接口列表-->
<el-drawer :visible.sync="apiListVisible" :destroy-on-close="true" direction="ltr" :withHeader="false" :title="$t('api_test.automation.api_list_import')" :modal="false" size="90%">
<el-drawer :visible.sync="apiListVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false" size="90%">
<ms-api-definition :visible="visibleRef" :currentRow="currentRow"/>
<el-button style="float: right;margin: 0px 20px 0px" type="primary" @click="pushApiOrCase('REF')">{{$t('api_test.scenario.reference')}}</el-button>
<el-button style="float: right;" type="primary" @click="pushApiOrCase('Copy')">{{ $t('commons.copy') }}</el-button>
@ -362,6 +361,7 @@
reportId: "",
projectId: "",
visibleRef: "",
enableCookieShare: false,
}
},
created() {
@ -375,11 +375,6 @@
this.getApiScenario();
this.getEnvironments();
},
mounted() {
document.addEventListener('click', e => {
this.showAll();
})
},
watch: {},
methods: {
addComponent(type) {
@ -591,7 +586,7 @@
}
this.debugData = {
id: this.currentScenario.id, name: this.currentScenario.name, type: "scenario",
variables: this.currentScenario.variables, referenced: 'Created', enableCookieShare: this.currentScenario.enableCookieShare,
variables: this.currentScenario.variables, referenced: 'Created', enableCookieShare: this.enableCookieShare,
environmentId: this.currentEnvironmentId, hashTree: this.scenarioDefinition
};
this.reportId = getUUID().substring(0, 8);
@ -735,7 +730,7 @@
if (obj) {
this.currentEnvironmentId = obj.environmentId;
this.currentScenario.variables = obj.variables;
this.currentScenario.enableCookieShare = obj.enableCookieShare;
this.enableCookieShare = obj.enableCookieShare;
this.scenarioDefinition = obj.hashTree;
}
}
@ -752,7 +747,7 @@
this.currentScenario.modulePath = this.getPath(this.currentScenario.apiScenarioModuleId);
// 便
let scenario = {
id: this.currentScenario.id, enableCookieShare: this.currentScenario.enableCookieShare, name: this.currentScenario.name, variables: this.currentScenario.variables,
id: this.currentScenario.id, enableCookieShare: this.enableCookieShare, name: this.currentScenario.name, variables: this.currentScenario.variables,
type: "scenario", referenced: 'Created', environmentId: this.currentEnvironmentId, hashTree: this.scenarioDefinition
};
this.currentScenario.scenarioDefinition = scenario;
@ -915,7 +910,7 @@
}
.head {
border-bottom: 1px solid #dedede;
border-bottom: 1px solid #474849;
font-size: 13px;
}
</style>

View File

@ -8,9 +8,9 @@
<div class="variable-combine"> {{api.name}}</div>
</el-col>
<el-col :span="api.protocol==='HTTP'? 1:3">
<ms-tag v-if="api.status == 'Prepare'" type="info" effect="plain" :content="$t('test_track.plan.plan_status_prepare')"/>
<ms-tag v-if="api.status == 'Underway'" type="warning" effect="plain" :content="$t('test_track.plan.plan_status_running')"/>
<ms-tag v-if="api.status == 'Completed'" type="success" effect="plain" :content="$t('test_track.plan.plan_status_completed')"/>
<el-tag size="mini" :style="{'background-color': getColor(true, api.method), border: getColor(true, api.method)}" class="api-el-tag">
{{ api.method}}
</el-tag>
</el-col>
<el-col :span="api.protocol==='HTTP'? 4:0">
<div class="variable-combine" style="margin-left: 10px">{{api.path ===null ? " " : api.path}}</div>
@ -151,6 +151,7 @@
import MsTcpBasisParameters from "../../../definition/components/request/tcp/BasisParameters";
import MsDubboBasisParameters from "../../../definition/components/request/dubbo/BasisParameters";
import MsApiExtendBtns from "../../../definition/components/reference/ApiExtendBtns";
import {API_METHOD_COLOUR} from "../../../definition/model/JsonData";
export default {
name: 'ApiCaseList',
@ -192,7 +193,7 @@
reportId: "",
projectId: "",
checkedCases: new Set(),
methodColorMap: new Map(API_METHOD_COLOUR),
}
},
watch: {
@ -403,6 +404,11 @@
environmentConfigClose() {
this.getEnvironments();
},
getColor(enable, method) {
if (enable) {
return this.methodColorMap.get(method);
}
},
caseChecked(row) {
row.protocol = this.api.protocol;
row.hashTree = [];
@ -477,6 +483,9 @@
padding: 7px;
}
.api-el-tag {
color: white;
}
.is-selected {
background: #EFF7FF;
}

View File

@ -6,9 +6,9 @@
<div class="variable-combine"> {{api.name}}</div>
</el-col>
<el-col :span="api.protocol==='HTTP'? 1:3">
<ms-tag v-if="api.status == 'Prepare'" type="info" effect="plain" :content="$t('test_track.plan.plan_status_prepare')"/>
<ms-tag v-if="api.status == 'Underway'" type="warning" effect="plain" :content="$t('test_track.plan.plan_status_running')"/>
<ms-tag v-if="api.status == 'Completed'" type="success" effect="plain" :content="$t('test_track.plan.plan_status_completed')"/>
<el-tag size="mini" :style="{'background-color': getColor(true, api.method), border: getColor(true, api.method)}" class="api-el-tag">
{{ api.method}}
</el-tag>
</el-col>
<el-col :span="api.protocol==='HTTP'? 4:0">
<div class="variable-combine" style="margin-left: 10px">{{api.path ===null ? " " : api.path}}</div>
@ -75,6 +75,8 @@
import ApiEnvironmentConfig from "../../../test/components/ApiEnvironmentConfig";
import {parseEnvironment} from "../../../test/model/EnvironmentModel";
import MsTag from "../../../../common/components/MsTag";
import {API_METHOD_COLOUR} from "../../model/JsonData";
export default {
name: "ApiCaseHeader",
components: {MsTag, ApiEnvironmentConfig},
@ -82,6 +84,7 @@
return {
environments: [],
environment: {},
methodColorMap: new Map(API_METHOD_COLOUR),
}
},
props: {
@ -149,6 +152,11 @@
this.$emit('batchRun');
}
},
getColor(enable, method) {
if (enable) {
return this.methodColorMap.get(method);
}
},
}
}
</script>
@ -190,5 +198,8 @@
line-height: 32px;
}
.api-el-tag {
color: white;
}
</style>

View File

@ -1,4 +1,5 @@
<template>
<div v-loading="loading">
<el-form :model="basicForm" label-position="right" label-width="80px" size="small" :rules="rule" ref="basicForm" style="margin-right: 20px">
<!-- 基础信息 -->
<el-row>
@ -9,7 +10,7 @@
</el-col>
<el-col :span="12">
<el-form-item :label="$t('test_track.module.module')" prop="moduleId">
<el-select class="ms-http-input" size="small" v-model="basicForm.moduleId" style="width: 100%">
<el-select class="ms-http-input" size="small" v-model="basicForm.moduleId" style="width: 100%" @change="reload">
<el-option v-for="item in moduleOptions" :key="item.id" :label="item.path" :value="item.id"/>
</el-select>
</el-form-item>
@ -51,9 +52,8 @@
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
@ -81,6 +81,7 @@
httpVisible: false,
currentModule: {},
maintainerOptions: [],
loading: false,
rule: {
name: [
{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},
@ -102,6 +103,12 @@
this.maintainerOptions = response.data;
});
},
reload() {
this.loading = true
this.$nextTick(() => {
this.loading = false
})
},
validate() {
this.$refs['basicForm'].validate((valid) => {
if (valid) {

View File

@ -61,6 +61,7 @@
this.validateApi();
if (this.validated) {
this.basisData.request = this.request;
console.log(this.basisData)
this.$emit('saveApi', this.basisData);
}
},

View File

@ -47,9 +47,7 @@
},
methods: {
handleSelect(index) {
console.log(index)
this.activeIndex = index
},
active() {
if (this.activeIndex === '/api') {

View File

@ -9,6 +9,7 @@
<review-comment-item v-for="(comment,index) in comments"
:key="index"
:comment="comment"
:read-only="readOnly"
@refresh="getComments()"/>
<div v-if="comments.length === 0" style="text-align: center">
<i class="el-icon-chat-line-square" style="font-size: 15px;color: #8a8b8d;">
@ -31,6 +32,10 @@ export default {
caseId: {
type: String,
default: ''
},
readOnly: {
type: Boolean,
default: false
}
},
watch: {

View File

@ -1,4 +1,7 @@
<template>
<el-row :gutter="10">
<el-col :span="16">
<el-card>
<el-form :model="form" ref="caseFrom" v-loading="result.loading">
<el-row>
@ -151,13 +154,21 @@
</el-col>
</el-row>
</el-form>
</el-card>
</el-col>
<el-col :span="8">
<case-comment :case-id="testCaseId" :read-only="true"/>
</el-col>
</el-row>
</template>
<script>
import CaseComment from "@/business/components/track/case/components/CaseComment";
export default {
name: "TestCaseDetail",
components: {CaseComment},
data() {
return {
result: {},

View File

@ -62,7 +62,7 @@
<el-popover
placement="right-end"
:title="$t('test_track.case.view_case')"
width="60%"
width="70%"
trigger="hover"
>
<test-case-detail v-if="currentCaseId === scope.row.id" :test-case-id="currentCaseId"/>

View File

@ -11,8 +11,8 @@
{{ comment.createTime | timestampFormatDate }}
</span>
<span class="comment-delete">
<i class="el-icon-edit" style="font-size: 9px;margin-right: 6px;" @click="openEdit"/>
<i class="el-icon-close" @click="deleteComment"/>
<el-link icon="el-icon-edit" style="font-size: 9px;margin-right: 6px;" @click="openEdit" :disabled="readOnly"/>
<el-link icon="el-icon-close" @click="deleteComment" :disabled="readOnly"/>
</span>
<br/>
<div class="comment-desc" style="font-size: 10px;color: #303133">
@ -50,7 +50,11 @@ export default {
name: "ReviewCommentItem",
components: {MsDialogFooter},
props: {
comment: Object
comment: Object,
readOnly: {
type: Boolean,
default: false
}
},
data() {
return {