Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
fc2fab39
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
9 个月 前同步成功
通知
11
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zentaoatf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
fc2fab39
编写于
8月 03, 2022
作者:
Z
zhaoke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
* Add show zentao case.
上级
9fb86044
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
323 addition
and
62 deletion
+323
-62
internal/pkg/domain/sync.go
internal/pkg/domain/sync.go
+1
-0
internal/pkg/domain/testing.go
internal/pkg/domain/testing.go
+8
-5
internal/pkg/helper/exec/file.go
internal/pkg/helper/exec/file.go
+7
-6
internal/pkg/helper/exec/result.go
internal/pkg/helper/exec/result.go
+11
-7
internal/pkg/helper/exec/script.go
internal/pkg/helper/exec/script.go
+5
-3
internal/pkg/helper/exec/unit.go
internal/pkg/helper/exec/unit.go
+7
-6
internal/pkg/helper/zentao/bug.go
internal/pkg/helper/zentao/bug.go
+12
-2
internal/pkg/helper/zentao/case.go
internal/pkg/helper/zentao/case.go
+20
-4
internal/pkg/helper/zentao/sync.go
internal/pkg/helper/zentao/sync.go
+4
-1
internal/server/modules/v1/controller/zentao.go
internal/server/modules/v1/controller/zentao.go
+22
-0
internal/server/modules/v1/index/zentao.go
internal/server/modules/v1/index/zentao.go
+1
-0
res/template/python.tpl
res/template/python.tpl
+1
-0
ui/src/components/Table.vue
ui/src/components/Table.vue
+48
-21
ui/src/locales/en-US.ts
ui/src/locales/en-US.ts
+11
-0
ui/src/locales/zh-CN.ts
ui/src/locales/zh-CN.ts
+11
-0
ui/src/services/zentao.ts
ui/src/services/zentao.ts
+9
-0
ui/src/views/result/FormBug.vue
ui/src/views/result/FormBug.vue
+51
-2
ui/src/views/script/FormSyncFromZentao.vue
ui/src/views/script/FormSyncFromZentao.vue
+94
-5
未找到文件。
internal/pkg/domain/sync.go
浏览文件 @
fc2fab39
...
...
@@ -8,6 +8,7 @@ type SyncSettings struct {
SuiteId
int
`json:"suiteId"`
TaskId
int
`json:"taskId"`
CaseId
int
`json:"caseId"`
CaseIds
[]
int
`json:"caseIds"`
CasePath
string
`json:"casePath"`
Lang
string
`json:"lang"`
...
...
internal/pkg/domain/testing.go
浏览文件 @
fc2fab39
...
...
@@ -29,11 +29,14 @@ type ZtfModule struct {
Cases
map
[
int
]
ZtfCaseInModule
}
type
ZtfCaseInModule
struct
{
Id
int
Title
string
Product
int
Module
int
Case
int
// case id in task
Id
int
Title
string
Product
int
Module
int
Case
int
// case id in task
Type
string
StatusName
string
LastRunResult
string
}
type
ZtfSuite
struct
{
...
...
internal/pkg/helper/exec/file.go
浏览文件 @
fc2fab39
...
...
@@ -3,6 +3,11 @@ package execHelper
import
(
"bufio"
"fmt"
"io"
"os"
"os/exec"
"strings"
commConsts
"github.com/easysoft/zentaoatf/internal/pkg/consts"
commDomain
"github.com/easysoft/zentaoatf/internal/pkg/domain"
configHelper
"github.com/easysoft/zentaoatf/internal/pkg/helper/config"
...
...
@@ -15,10 +20,6 @@ import (
"github.com/fatih/color"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/websocket"
"io"
"os"
"os/exec"
"strings"
)
func
RunFile
(
filePath
,
workspacePath
string
,
conf
commDomain
.
WorkspaceConf
,
...
...
@@ -162,8 +163,6 @@ func RunFile(filePath, workspacePath string, conf commDomain.WorkspaceConf,
}
}
cmd
.
Wait
()
ExitCurrCase
:
errOutputArr
:=
make
([]
string
,
0
)
if
!
isTerminal
{
...
...
@@ -180,5 +179,7 @@ ExitCurrCase:
stdOutput
=
strings
.
Join
(
stdOutputArr
,
""
)
errOutput
=
strings
.
Join
(
errOutputArr
,
""
)
cmd
.
Wait
()
return
}
internal/pkg/helper/exec/result.go
浏览文件 @
fc2fab39
...
...
@@ -2,13 +2,14 @@ package execHelper
import
(
"fmt"
i118Utils
"github.com/easysoft/zentaoatf/pkg/lib/i118"
logUtils
"github.com/easysoft/zentaoatf/pkg/lib/log"
stringUtils
"github.com/easysoft/zentaoatf/pkg/lib/string"
"regexp"
"strconv"
"strings"
i118Utils
"github.com/easysoft/zentaoatf/pkg/lib/i118"
logUtils
"github.com/easysoft/zentaoatf/pkg/lib/log"
stringUtils
"github.com/easysoft/zentaoatf/pkg/lib/string"
commConsts
"github.com/easysoft/zentaoatf/internal/pkg/consts"
commDomain
"github.com/easysoft/zentaoatf/internal/pkg/domain"
langHelper
"github.com/easysoft/zentaoatf/internal/pkg/helper/lang"
...
...
@@ -22,7 +23,7 @@ import (
func
CheckCaseResult
(
scriptFile
string
,
logs
string
,
report
*
commDomain
.
ZtfReport
,
scriptIdx
int
,
total
int
,
secs
string
,
pathMaxWidth
int
,
numbMaxWidth
int
,
wsMsg
*
websocket
.
Message
)
{
wsMsg
*
websocket
.
Message
,
errOutput
string
)
{
steps
,
isOldFormat
:=
scriptHelper
.
GetStepAndExpectMap
(
scriptFile
)
...
...
@@ -45,13 +46,13 @@ func CheckCaseResult(scriptFile string, logs string, report *commDomain.ZtfRepor
language
:=
langHelper
.
GetLangByFile
(
scriptFile
)
ValidateCaseResult
(
scriptFile
,
language
,
steps
,
skip
,
actualArr
,
report
,
scriptIdx
,
total
,
secs
,
pathMaxWidth
,
numbMaxWidth
,
wsMsg
)
scriptIdx
,
total
,
secs
,
pathMaxWidth
,
numbMaxWidth
,
wsMsg
,
errOutput
)
}
func
ValidateCaseResult
(
scriptFile
string
,
langType
string
,
steps
[]
commDomain
.
ZentaoCaseStep
,
skip
bool
,
actualArr
[][]
string
,
report
*
commDomain
.
ZtfReport
,
scriptIdx
int
,
total
int
,
secs
string
,
pathMaxWidth
int
,
numbMaxWidth
int
,
wsMsg
*
websocket
.
Message
)
{
wsMsg
*
websocket
.
Message
,
errOutput
string
)
{
key
:=
stringUtils
.
Md5
(
scriptFile
)
...
...
@@ -65,7 +66,7 @@ func ValidateCaseResult(scriptFile string, langType string,
caseResult
=
commConsts
.
SKIP
}
else
{
stepIdxToCheck
:=
0
for
_
,
step
:=
range
steps
{
// iterate by checkpoints
for
index
,
step
:=
range
steps
{
// iterate by checkpoints
stepName
:=
strings
.
TrimSpace
(
step
.
Desc
)
expect
:=
strings
.
TrimSpace
(
step
.
Expect
)
...
...
@@ -82,6 +83,9 @@ func ValidateCaseResult(scriptFile string, langType string,
}
stepResult
,
checkpointLogs
:=
ValidateStepResult
(
langType
,
expectLines
,
actualLines
)
if
errOutput
!=
""
&&
index
==
0
&&
len
(
checkpointLogs
)
>
0
{
checkpointLogs
[
0
]
.
Actual
=
errOutput
}
stepLog
:=
commDomain
.
StepLog
{
Id
:
strconv
.
Itoa
(
stepIdxToCheck
),
Name
:
stepName
,
Status
:
stepResult
,
CheckPoints
:
checkpointLogs
}
stepLogs
=
append
(
stepLogs
,
stepLog
)
if
stepResult
==
commConsts
.
FAIL
{
...
...
internal/pkg/helper/exec/script.go
浏览文件 @
fc2fab39
...
...
@@ -2,12 +2,13 @@ package execHelper
import
(
"fmt"
"strings"
"time"
dateUtils
"github.com/easysoft/zentaoatf/pkg/lib/date"
i118Utils
"github.com/easysoft/zentaoatf/pkg/lib/i118"
logUtils
"github.com/easysoft/zentaoatf/pkg/lib/log"
stringUtils
"github.com/easysoft/zentaoatf/pkg/lib/string"
"strings"
"time"
commConsts
"github.com/easysoft/zentaoatf/internal/pkg/consts"
commDomain
"github.com/easysoft/zentaoatf/internal/pkg/domain"
...
...
@@ -54,7 +55,8 @@ func ExecScript(scriptFile, workspacePath string,
entTime
:=
time
.
Now
()
secs
:=
fmt
.
Sprintf
(
"%.2f"
,
float32
(
entTime
.
Sub
(
startTime
)
/
time
.
Second
))
report
.
WorkspacePath
=
workspacePath
CheckCaseResult
(
scriptFile
,
logs
,
report
,
scriptIdx
,
total
,
secs
,
pathMaxWidth
,
numbMaxWidth
,
wsMsg
)
CheckCaseResult
(
scriptFile
,
logs
,
report
,
scriptIdx
,
total
,
secs
,
pathMaxWidth
,
numbMaxWidth
,
wsMsg
,
errOutput
)
endMsg
:=
i118Utils
.
Sprintf
(
"end_execution"
,
scriptFile
,
dateUtils
.
DateTimeStr
(
entTime
))
if
commConsts
.
ExecFrom
!=
commConsts
.
FromCmd
{
...
...
internal/pkg/helper/exec/unit.go
浏览文件 @
fc2fab39
...
...
@@ -3,6 +3,11 @@ package execHelper
import
(
"bufio"
"errors"
"io"
"os/exec"
"strings"
"time"
commConsts
"github.com/easysoft/zentaoatf/internal/pkg/consts"
configHelper
"github.com/easysoft/zentaoatf/internal/pkg/helper/config"
websocketHelper
"github.com/easysoft/zentaoatf/internal/pkg/helper/websocket"
...
...
@@ -16,10 +21,6 @@ import (
"github.com/fatih/color"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/websocket"
"io"
"os/exec"
"strings"
"time"
)
func
ExecUnit
(
ch
chan
int
,
...
...
@@ -155,8 +156,6 @@ func RunUnitTest(ch chan int, cmdStr, workspacePath string, wsMsg *websocket.Mes
}
}
cmd
.
Wait
()
ExitUnitTest
:
errOutputArr
:=
make
([]
string
,
0
)
if
!
isTerminal
{
...
...
@@ -181,5 +180,7 @@ ExitUnitTest:
logUtils
.
ExecFilef
(
errOutput
)
}
cmd
.
Wait
()
return
}
internal/pkg/helper/zentao/bug.go
浏览文件 @
fc2fab39
...
...
@@ -63,26 +63,36 @@ func PrepareBug(workspacePath, seq string, caseIdStr string, productId int) (bug
}
steps
:=
make
([]
string
,
0
)
stepsArray
:=
make
([]
map
[
string
]
interface
{},
0
)
stepIds
:=
""
for
_
,
step
:=
range
cs
.
Steps
{
if
step
.
Status
==
commConsts
.
FAIL
{
stepIds
+=
step
.
Id
+
"_"
}
stepsContent
:=
GenBugStepText
(
step
)
steps
=
append
(
steps
,
stepsContent
)
stepsArray
=
append
(
stepsArray
,
map
[
string
]
interface
{}{
"name"
:
step
.
Name
,
"status"
:
step
.
Status
,
"steps"
:
stepsContent
,
})
}
bug
=
commDomain
.
ZtfBug
{
Title
:
cs
.
Title
,
Case
:
cs
.
Id
,
Product
:
productId
,
Steps
:
strings
.
Join
(
steps
,
"
\n
"
),
StepIds
:
stepIds
,
Steps
:
strings
.
Join
(
steps
,
"
\n
"
),
StepIds
:
stepIds
,
Uid
:
uuid
.
NewV4
()
.
String
(),
Type
:
"codeerror"
,
Severity
:
3
,
Pri
:
3
,
OpenedBuild
:
[]
string
{
"trunk"
},
CaseVersion
:
"0"
,
OldTaskID
:
"0"
,
}
if
commConsts
.
ExecFrom
!=
commConsts
.
FromCmd
{
jsonSteps
,
_
:=
json
.
Marshal
(
stepsArray
)
bug
.
Steps
=
string
(
jsonSteps
)
}
return
}
...
...
internal/pkg/helper/zentao/case.go
浏览文件 @
fc2fab39
...
...
@@ -3,9 +3,13 @@ package zentaoHelper
import
(
"encoding/json"
"fmt"
"sort"
"strconv"
"strings"
"github.com/bitly/go-simplejson"
commConsts
"github.com/easysoft/zentaoatf/internal/pkg/consts"
"github.com/easysoft/zentaoatf/internal/pkg/domain"
commDomain
"github.com/easysoft/zentaoatf/internal/pkg/domain"
configHelper
"github.com/easysoft/zentaoatf/internal/pkg/helper/config"
scriptHelper
"github.com/easysoft/zentaoatf/internal/pkg/helper/script"
serverDomain
"github.com/easysoft/zentaoatf/internal/server/modules/v1/domain"
...
...
@@ -16,9 +20,6 @@ import (
logUtils
"github.com/easysoft/zentaoatf/pkg/lib/log"
stdinUtils
"github.com/easysoft/zentaoatf/pkg/lib/stdin"
"github.com/kataras/iris/v12"
"sort"
"strconv"
"strings"
)
func
CommitCase
(
caseId
int
,
title
string
,
...
...
@@ -223,6 +224,21 @@ func LoadTestCasesDetail(productId, moduleId, suiteId, taskId int,
return
}
func
LoadTestCasesDetailByCaseIds
(
caseIds
[]
int
,
config
commDomain
.
WorkspaceConf
)
(
cases
[]
commDomain
.
ZtfCase
,
err
error
)
{
for
_
,
caseId
:=
range
caseIds
{
cs
,
err
:=
GetTestCaseDetail
(
caseId
,
config
)
if
err
!=
nil
{
continue
}
cases
=
append
(
cases
,
cs
)
}
return
}
func
GetTestCaseDetail
(
caseId
int
,
config
commDomain
.
WorkspaceConf
)
(
cs
commDomain
.
ZtfCase
,
err
error
)
{
csWithSteps
,
err
:=
GetCaseById
(
config
.
Url
,
caseId
)
stepArr
:=
genCaseSteps
(
csWithSteps
)
...
...
internal/pkg/helper/zentao/sync.go
浏览文件 @
fc2fab39
...
...
@@ -2,10 +2,11 @@ package zentaoHelper
import
(
"fmt"
"path/filepath"
fileUtils
"github.com/easysoft/zentaoatf/pkg/lib/file"
i118Utils
"github.com/easysoft/zentaoatf/pkg/lib/i118"
logUtils
"github.com/easysoft/zentaoatf/pkg/lib/log"
"path/filepath"
commDomain
"github.com/easysoft/zentaoatf/internal/pkg/domain"
langHelper
"github.com/easysoft/zentaoatf/internal/pkg/helper/lang"
...
...
@@ -39,6 +40,8 @@ func SyncFromZentao(settings commDomain.SyncSettings, config commDomain.Workspac
if
err
==
nil
{
cases
=
append
(
cases
,
cs
)
}
}
else
if
len
(
settings
.
CaseIds
)
>
0
{
cases
,
err
=
LoadTestCasesDetailByCaseIds
(
settings
.
CaseIds
,
config
)
}
else
{
cases
,
err
=
LoadTestCasesDetail
(
productId
,
moduleId
,
suiteId
,
taskId
,
config
)
}
...
...
internal/server/modules/v1/controller/zentao.go
浏览文件 @
fc2fab39
...
...
@@ -143,6 +143,28 @@ func (c *ZentaoCtrl) ListTask(ctx iris.Context) {
ctx
.
JSON
(
c
.
SuccessResp
(
data
))
}
func
(
c
*
ZentaoCtrl
)
ListCase
(
ctx
iris
.
Context
)
{
siteId
,
err
:=
ctx
.
URLParamInt
(
"currSiteId"
)
productId
,
err
:=
ctx
.
URLParamInt
(
"currProductId"
)
moduleId
:=
ctx
.
URLParamIntDefault
(
"moduleId"
,
0
)
suiteId
:=
ctx
.
URLParamIntDefault
(
"suiteId"
,
0
)
taskId
:=
ctx
.
URLParamIntDefault
(
"taskId"
,
0
)
if
siteId
==
0
||
productId
==
0
{
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
ParamErr
,
err
.
Error
()))
return
}
site
,
_
:=
c
.
SiteService
.
Get
(
uint
(
siteId
))
config
:=
configHelper
.
LoadBySite
(
site
)
casesResp
,
err
:=
zentaoHelper
.
LoadTestCaseSimple
(
productId
,
moduleId
,
suiteId
,
taskId
,
config
)
if
err
!=
nil
{
ctx
.
JSON
(
c
.
ErrResp
(
commConsts
.
ErrZentaoRequest
,
err
.
Error
()))
return
}
ctx
.
JSON
(
c
.
SuccessResp
(
casesResp
.
Cases
))
}
func
(
c
*
ZentaoCtrl
)
ListBugFields
(
ctx
iris
.
Context
)
{
siteId
,
_
:=
ctx
.
URLParamInt
(
"currSiteId"
)
productId
,
_
:=
ctx
.
URLParamInt
(
"currProductId"
)
...
...
internal/server/modules/v1/index/zentao.go
浏览文件 @
fc2fab39
...
...
@@ -29,6 +29,7 @@ func (m *ZentaoModule) Party() module.WebModule {
index
.
Get
(
"/listModule"
,
m
.
ZentaoCtrl
.
ListModule
)
.
Name
=
"模块列表"
index
.
Get
(
"/listSuite"
,
m
.
ZentaoCtrl
.
ListSuite
)
.
Name
=
"套件列表"
index
.
Get
(
"/listTask"
,
m
.
ZentaoCtrl
.
ListTask
)
.
Name
=
"任务列表"
index
.
Get
(
"/listCase"
,
m
.
ZentaoCtrl
.
ListCase
)
.
Name
=
"用例列表"
index
.
Get
(
"/listBugFields"
,
m
.
ZentaoCtrl
.
ListBugFields
)
.
Name
=
"获取缺陷属性数据"
}
...
...
res/template/python.tpl
浏览文件 @
fc2fab39
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
%s
...
...
ui/src/components/Table.vue
浏览文件 @
fc2fab39
...
...
@@ -18,6 +18,7 @@
type=
"checkbox"
class=
"z-thead-checkbox"
v-model=
"setting.isCheckAll"
@
click=
"checkAll"
/>
</div>
</th>
...
...
@@ -61,6 +62,7 @@
}
"
:value="row[setting.keyColumn]"
:checked="row.checked"
@click="checked"/>
</div>
</td>
...
...
@@ -95,6 +97,7 @@
}
"
:value="row[setting.keyColumn]"
:checked="row.checked"
@click="checked"/>
</div>
</td>
...
...
@@ -268,6 +271,10 @@ export default defineComponent({
type
:
Boolean
,
default
:
false
,
},
isCheckAll
:
{
type
:
Boolean
,
default
:
false
,
},
//Returns data type for checked of Checkbox
checkedReturnType
:
{
type
:
String
,
...
...
@@ -402,7 +409,7 @@ export default defineComponent({
// Enable slot mode
isSlotMode
:
props
.
isSlotMode
,
// Whether to select all
isCheckAll
:
false
,
isCheckAll
:
props
.
isCheckAll
,
// Hide paging
isHidePaging
:
props
.
isHidePaging
,
// KEY field name
...
...
@@ -525,26 +532,44 @@ export default defineComponent({
/**
* Check all checkboxes for monitoring
*/
watch
(
()
=>
setting
.
isCheckAll
,
(
state
:
boolean
)
=>
{
let
isChecked
:
Array
<
string
|
unknown
>
=
[];
rowCheckbox
.
value
.
forEach
((
val
:
HTMLInputElement
,
i
:
number
)
=>
{
if
(
val
)
{
val
.
checked
=
state
;
if
(
val
.
checked
)
{
if
(
props
.
checkedReturnType
==
"
row
"
)
{
isChecked
.
push
(
localRows
.
value
[
i
]);
}
else
{
isChecked
.
push
(
val
.
value
);
}
// watch(
// () => setting.isCheckAll,
// (state: boolean) => {
// let isChecked: Array
<
string
|
unknown
>
=
[];
// rowCheckbox.value.forEach((val: HTMLInputElement, i: number) => {
// if (val) {
// val.checked = state;
// if (val.checked) {
// if (props.checkedReturnType == "row") {
// isChecked.push(localRows.value[i]);
// } else {
// isChecked.push(val.value);
// }
// }
// }
// });
// // 回傳畫面上選上的資料 (Return the selected data on the screen)
// emit("return-checked-rows", isChecked);
// }
// );
}
const
checkAll
=
(
event
:
Event
)
=>
{
event
.
stopPropagation
();
setting
.
isCheckAll
=
!
setting
.
isCheckAll
;
let
isChecked
:
Array
<
string
|
unknown
>
=
[];
rowCheckbox
.
value
.
forEach
((
val
:
HTMLInputElement
,
i
:
number
)
=>
{
val
.
checked
=
setting
.
isCheckAll
;
if
(
val
.
checked
)
{
if
(
props
.
checkedReturnType
==
"
row
"
)
{
isChecked
.
push
(
localRows
.
value
[
i
]);
}
else
{
isChecked
.
push
(
val
.
value
);
}
}
});
// 回傳畫面上選上的資料 (Return the selected data on the screen)
emit
(
"
return-checked-rows
"
,
isChecked
);
}
);
}
});
// 回傳畫面上選上的資料 (Return the selected data on the screen)
emit
(
"
return-checked-rows
"
,
isChecked
);
}
/**
...
...
@@ -554,7 +579,7 @@ export default defineComponent({
event
.
stopPropagation
();
let
isChecked
:
Array
<
string
|
unknown
>
=
[];
rowCheckbox
.
value
.
forEach
((
val
:
HTMLInputElement
,
i
:
number
)
=>
{
if
(
val
&&
val
.
checked
)
{
if
(
val
.
checked
)
{
if
(
props
.
checkedReturnType
==
"
row
"
)
{
isChecked
.
push
(
localRows
.
value
[
i
]);
}
else
{
...
...
@@ -562,6 +587,7 @@ export default defineComponent({
}
}
});
setting
.
isCheckAll
=
isChecked
.
length
>=
localRows
.
value
.
length
;
// 回傳畫面上選上的資料 (Return the selected data on the screen)
emit
(
"
return-checked-rows
"
,
isChecked
);
};
...
...
@@ -745,6 +771,7 @@ export default defineComponent({
setting
,
rowCheckbox
,
checked
,
checkAll
,
doSort
,
prevPage
,
movePage
,
...
...
ui/src/locales/en-US.ts
浏览文件 @
fc2fab39
...
...
@@ -38,6 +38,15 @@ export default {
'
none
'
:
'
None
'
,
'
all
'
:
'
All
'
,
'
only_failed
'
:
'
Only Failed
'
,
'
case_type_config
'
:
'
Configuration
'
,
'
case_type_feature
'
:
'
Feature
'
,
'
case_type_install
'
:
'
Installation
'
,
'
case_type_security
'
:
'
Security
'
,
'
case_type_performance
'
:
'
Performance
'
,
'
case_type_standard
'
:
'
Standard Specification
'
,
'
case_type_automation
'
:
'
TestScript
'
,
'
case_type_designdefect
'
:
'
DesignDefect
'
,
'
case_type_others
'
:
'
Others
'
,
'
zentao_site
'
:
'
Zentao Site
'
,
'
local
'
:
'
Local
'
,
...
...
@@ -229,6 +238,7 @@ export default {
'
open-in-terminal
'
:
'
Open In Terminal
'
,
'
pls_select_task
'
:
'
Please select task
'
,
'
pls_select_step
'
:
'
Please select step
'
,
'
or_input_task_name
'
:
'
Or input new task name
'
,
'
task_name
'
:
'
Zentao Task Name
'
,
...
...
@@ -241,6 +251,7 @@ export default {
'
pls_title
'
:
'
Please input title.
'
,
'
pls_name
'
:
'
Please input name.
'
,
'
pls_select_case
'
:
'
Please select cases.
'
,
'
pls_select_co_case
'
:
'
Please select cases.
'
,
'
pls_module
'
:
'
Please select module.
'
,
'
pls_suite
'
:
'
Please select suite.
'
,
'
pls_task
'
:
'
Please select task.
'
,
...
...
ui/src/locales/zh-CN.ts
浏览文件 @
fc2fab39
...
...
@@ -41,6 +41,15 @@ export default {
'
all
'
:
'
所有
'
,
'
none
'
:
'
无
'
,
'
only_failed
'
:
'
仅失败用例
'
,
'
case_type_config
'
:
'
配置相关
'
,
'
case_type_feature
'
:
'
功能测试
'
,
'
case_type_install
'
:
'
安装部署
'
,
'
case_type_security
'
:
'
安全相关
'
,
'
case_type_performance
'
:
'
性能测试
'
,
'
case_type_standard
'
:
'
标准规范
'
,
'
case_type_automation
'
:
'
测试脚本
'
,
'
case_type_designdefect
'
:
'
设计缺陷
'
,
'
case_type_others
'
:
'
其他
'
,
'
zentao_site
'
:
'
禅道站点
'
,
'
local
'
:
'
本地
'
,
...
...
@@ -240,6 +249,7 @@ export default {
'
open-in-terminal
'
:
'
从此位置打开命令行
'
,
'
pls_select_task
'
:
'
请选择任务
'
,
'
pls_select_step
'
:
'
请选择步骤
'
,
'
or_input_task_name
'
:
'
或输入新任务标题
'
,
'
task_name
'
:
'
禅道任务标题
'
,
...
...
@@ -252,6 +262,7 @@ export default {
'
pls_title
'
:
'
请输入标题
'
,
'
pls_name
'
:
'
请输入名称
'
,
'
pls_select_case
'
:
'
请选择需要执行的用例
'
,
'
pls_select_co_case
'
:
'
请选择用例
'
,
'
pls_module
'
:
'
请选择模块
'
,
'
pls_suite
'
:
'
请选择套件
'
,
'
pls_task
'
:
'
请选择任务
'
,
...
...
ui/src/services/zentao.ts
浏览文件 @
fc2fab39
...
...
@@ -62,6 +62,15 @@ export async function queryTask(productId: string): Promise<any> {
});
}
export
async
function
queryCase
(
params
):
Promise
<
any
>
{
return
request
({
url
:
`/
${
apiPath
}
/listCase`
,
method
:
'
GET
'
,
params
,
});
}
export
async
function
queryBugFields
():
Promise
<
any
>
{
return
request
({
url
:
`/
${
apiPath
}
/listBugFields`
,
...
...
ui/src/views/result/FormBug.vue
浏览文件 @
fc2fab39
...
...
@@ -65,7 +65,13 @@
</FormItem>
<FormItem
name=
"type"
:label=
"t('step')"
>
<textarea
v-model=
"modelRef.steps"
rows=
"6"
/>
<div
class=
"steps-contain"
>
<div
class=
"steps-select"
v-for=
"(item,index) in steps"
:key=
"index"
>
<input
type=
"checkbox"
:id=
"'cbox'+index"
:value=
"index"
:checked=
"item.checked"
@
click=
"stepSelect"
/>
<label
:for=
"'cbox'+index"
:class=
"'steps-label step-' + item.status"
>
{{
item
.
name
}}
</label>
</div>
<textarea
v-model=
"modelRef.steps"
rows=
"6"
/>
</div>
</FormItem>
</Form>
</ZModal>
...
...
@@ -121,13 +127,19 @@ let types = ref([])
let
builds
=
ref
([])
let
severities
=
ref
([])
let
priorities
=
ref
([])
const
steps
=
ref
([]
as
any
)
const
getBugData
=
()
=>
{
prepareBugData
(
props
.
data
).
then
((
jsn
)
=>
{
steps
.
value
=
JSON
.
parse
(
jsn
.
data
.
steps
);
steps
.
value
.
map
((
item
,
index
)
=>
{
item
.
checked
=
true
;
});
modelRef
.
value
=
jsn
.
data
modelRef
.
value
.
module
=
''
modelRef
.
value
.
severity
=
''
+
modelRef
.
value
.
severity
modelRef
.
value
.
pri
=
''
+
modelRef
.
value
.
pri
genSteps
();
getBugFields
()
})
}
...
...
@@ -158,6 +170,10 @@ const submit = () => {
data
.
severity
=
parseInt
(
data
.
severity
)
data
.
pri
=
parseInt
(
data
.
pri
)
if
(
!
Array
.
isArray
(
data
.
openedBuild
))
data
.
openedBuild
=
[
data
.
openedBuild
]
if
(
data
.
steps
==
''
)
{
notification
.
error
({
message
:
t
(
'
pls_select_step
'
)})
return
}
submitBugToZentao
(
data
).
then
((
json
)
=>
{
console
.
log
(
'
json
'
,
json
)
...
...
@@ -182,11 +198,44 @@ const clearFormData = () => {
modelRef
.
value
=
{};
};
const
stepSelect
=
(
val
)
=>
{
const
index
=
val
.
target
.
value
;
steps
.
value
[
index
].
checked
=
val
.
target
.
checked
;
genSteps
();
}
const
genSteps
=
()
=>
{
let
newSteps
=
[]
as
any
;
steps
.
value
.
forEach
((
item
)
=>
{
if
(
item
.
checked
)
{
newSteps
.
push
(
item
.
steps
);
}
});
modelRef
.
value
.
steps
=
newSteps
.
join
(
'
\n
'
);
}
defineExpose
({
clearFormData
,
});
</
script
>
<
style
lang=
"less"
scoped
>
.steps-contain{
display: flex;
flex: 1;
flex-direction: column;
.steps-select{
display: flex;
.steps-label{
margin-left: 10px;
}
.step-fail{
color: var(--color-red);
}
.step-pass{
color: var(--color-green);
}
}
}
</
style
>
ui/src/views/script/FormSyncFromZentao.vue
浏览文件 @
fc2fab39
...
...
@@ -8,7 +8,7 @@
>
<Form>
<FormItem
labelWidth=
"140px"
:label=
"t('module')"
>
<select
v-model=
"modelRef.moduleId"
>
<select
v-model=
"modelRef.moduleId"
@
change=
"fetchCases"
>
<option
key=
""
value=
""
>
</option>
<option
v-for=
"item in modules"
:key=
"item.id"
:value=
"item.id"
>
<span
v-html=
"item.name"
></span>
...
...
@@ -17,7 +17,7 @@
</FormItem>
<FormItem
labelWidth=
"140px"
:label=
"t('suite')"
>
<select
v-model=
"modelRef.suiteId"
>
<select
v-model=
"modelRef.suiteId"
@
change=
"fetchCases"
>
<option
key=
""
value=
""
>
</option>
<option
v-for=
"item in suites"
:key=
"item.id"
:value=
"item.id"
>
{{
item
.
name
}}
...
...
@@ -26,7 +26,7 @@
</FormItem>
<FormItem
labelWidth=
"140px"
:label=
"t('task')"
>
<select
v-model=
"modelRef.taskId"
>
<select
v-model=
"modelRef.taskId"
@
change=
"fetchCases"
>
<option
key=
""
value=
""
>
</option>
<option
v-for=
"item in tasks"
:key=
"item.id"
:value=
"item.id"
>
{{
item
.
name
}}
...
...
@@ -49,6 +49,28 @@
<FormItem
labelWidth=
"140px"
:label=
"t('independent_expect')"
>
<Switch
v-model=
"modelRef.independentFile"
/>
</FormItem>
<Table
v-if=
"cases.length > 0"
:columns=
"columns"
:rows=
"cases"
:isHidePaging=
"true"
:isSlotMode=
"true"
:sortable=
"
{}"
:hasCheckbox="true"
:isCheckAll="true"
ref="tableRef"
@return-checked-rows="onCheckedRows"
>
<template
#Type
="
record
"
>
{{
t
(
'
case_type_
'
+
record
.
value
.
Type
)
}}
</
template
>
<
template
#LastRunResult=
"record"
>
{{
record
.
value
.
LastRunResult
==
''
?
''
:
t
(
record
.
value
.
LastRunResult
)
}}
</
template
>
</Table>
<p
v-else
class=
"empty-tip"
>
{{ t("empty_data") }}
</p>
</Form>
</ZModal>
</template>
...
...
@@ -74,6 +96,9 @@ import notification from "@/utils/notification";
import
{
useForm
}
from
"
@/utils/form
"
;
import
Switch
from
"
@/components/Switch.vue
"
;
import
{
ZentaoData
}
from
"
@/store/zentao
"
;
import
{
queryCase
}
from
"
@/services/zentao
"
;
import
Table
from
"
@/components/Table.vue
"
;
export
interface
FormWorkspaceProps
{
show
?:
boolean
;
...
...
@@ -122,13 +147,19 @@ const cancel = () => {
};
const
submit
=
()
=>
{
if
(
selectedCases
.
value
.
length
===
0
)
{
notification
.
error
({
message
:
t
(
"
pls_select_co_case
"
),
});
return
;
}
if
(
disabled
.
value
)
{
return
;
}
disabled
.
value
=
true
;
console
.
log
(
"
syncFromZentaoSubmit
"
,
console
.
log
(
modelRef
.
value
));
console
.
log
(
"
syncFromZentaoSubmit
"
,
console
.
log
(
selectedCases
.
value
));
if
(
validate
())
{
emit
(
"
submit
"
,
modelRef
.
value
);
emit
(
"
submit
"
,
{
caseIds
:
selectedCases
.
value
,
...
modelRef
.
value
}
);
}
};
...
...
@@ -143,6 +174,22 @@ const langs = computed<any[]>(() => store.state.Zentao.langs);
const
modules
=
computed
<
any
[]
>
(()
=>
store
.
state
.
Zentao
.
modules
);
const
suites
=
computed
<
any
[]
>
(()
=>
store
.
state
.
Zentao
.
suites
);
const
tasks
=
computed
<
any
[]
>
(()
=>
store
.
state
.
Zentao
.
tasks
);
const
selectedCases
=
ref
([]
as
number
[]);
const
cases
=
ref
([]);
const
fetchCases
=
()
=>
{
queryCase
({
siteId
:
currSite
.
value
.
id
,
productId
:
currProduct
.
value
.
id
,
...
modelRef
.
value
,
}).
then
((
res
)
=>
{
res
.
data
.
forEach
((
item
,
index
)
=>
{
res
.
data
[
index
].
checked
=
true
;
selectedCases
.
value
.
push
(
item
.
Id
);
});
cases
.
value
=
res
.
data
;
});
}
const
fetchData
=
()
=>
{
if
(
currSite
.
value
.
id
==
undefined
||
currSite
.
value
.
id
<=
1
||
currProduct
.
value
.
id
==
undefined
||
currProduct
.
value
.
id
<=
0
)
return
;
...
...
@@ -159,6 +206,7 @@ const fetchData = () => {
productId
:
currProduct
.
value
.
id
,
});
};
fetchCases
();
fetchData
();
watch
(
...
...
@@ -190,6 +238,47 @@ const selectWorkspace = () => {
};
selectWorkspace
();
const
columns
=
ref
([]
as
any
[]);
const
setColumns
=
()
=>
{
columns
.
value
=
[
{
isKey
:
true
,
label
:
t
(
"
no
"
),
field
:
"
Id
"
,
width
:
"
60px
"
,
},
{
label
:
t
(
"
title
"
),
field
:
"
Title
"
,
width
:
"
60px
"
,
},
{
label
:
t
(
"
type
"
),
field
:
"
Type
"
,
width
:
"
60px
"
,
},
{
label
:
t
(
"
status
"
),
field
:
"
StatusName
"
,
width
:
"
60px
"
,
},
{
label
:
t
(
"
result
"
),
field
:
"
LastRunResult
"
,
width
:
"
60px
"
,
},
];
};
setColumns
();
const
tableRef
=
ref
({}
as
any
);
const
onCheckedRows
=
(
rows
:
any
[])
=>
{
selectedCases
.
value
=
rows
.
map
((
item
)
=>
{
return
parseInt
(
item
);
});
}
defineExpose
({
clearFormData
,
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录