Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
27f83eec
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5994
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
27f83eec
编写于
10月 26, 2023
作者:
Y
yurj26
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: 优化waitfor 时间
上级
9a487ea3
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
14 addition
and
32 deletion
+14
-32
pages/component/button/button.test.js
pages/component/button/button.test.js
+2
-7
pages/component/checkbox/checkbox.test.js
pages/component/checkbox/checkbox.test.js
+1
-4
pages/component/picker-view/picker-view.test.js
pages/component/picker-view/picker-view.test.js
+4
-6
pages/component/progress/progress.test.js
pages/component/progress/progress.test.js
+6
-11
pages/component/radio/radio.test.js
pages/component/radio/radio.test.js
+1
-4
未找到文件。
pages/component/button/button.test.js
浏览文件 @
27f83eec
...
@@ -4,7 +4,7 @@ describe('Button.uvue', () => {
...
@@ -4,7 +4,7 @@ describe('Button.uvue', () => {
let
page
let
page
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
'
view
'
)
})
})
it
(
'
click
'
,
async
()
=>
{
it
(
'
click
'
,
async
()
=>
{
// TODO 待测试框架支持text的dispatchEvent
// TODO 待测试框架支持text的dispatchEvent
...
@@ -41,12 +41,10 @@ describe('Button.uvue', () => {
...
@@ -41,12 +41,10 @@ describe('Button.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
type_enum_current
:
1
,
type_enum_current
:
1
,
})
})
await
page
.
waitFor
(
500
)
expect
(
await
btn
.
property
(
'
type
'
)).
toBe
(
'
primary
'
)
expect
(
await
btn
.
property
(
'
type
'
)).
toBe
(
'
primary
'
)
await
page
.
setData
({
await
page
.
setData
({
type_enum_current
:
2
,
type_enum_current
:
2
,
})
})
await
page
.
waitFor
(
500
)
expect
(
await
btn
.
property
(
'
type
'
)).
toBe
(
'
warn
'
)
expect
(
await
btn
.
property
(
'
type
'
)).
toBe
(
'
warn
'
)
})
})
it
(
'
size
'
,
async
()
=>
{
it
(
'
size
'
,
async
()
=>
{
...
@@ -55,7 +53,6 @@ describe('Button.uvue', () => {
...
@@ -55,7 +53,6 @@ describe('Button.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
size_enum_current
:
1
,
size_enum_current
:
1
,
})
})
await
page
.
waitFor
(
500
)
expect
(
await
btn
.
property
(
'
size
'
)).
toBe
(
'
mini
'
)
expect
(
await
btn
.
property
(
'
size
'
)).
toBe
(
'
mini
'
)
})
})
it
(
'
plain
'
,
async
()
=>
{
it
(
'
plain
'
,
async
()
=>
{
...
@@ -64,7 +61,6 @@ describe('Button.uvue', () => {
...
@@ -64,7 +61,6 @@ describe('Button.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
plain_boolean
:
true
,
plain_boolean
:
true
,
})
})
await
page
.
waitFor
(
500
)
expect
(
await
btn
.
property
(
'
plain
'
)).
toBe
(
true
)
expect
(
await
btn
.
property
(
'
plain
'
)).
toBe
(
true
)
})
})
it
(
'
disabled
'
,
async
()
=>
{
it
(
'
disabled
'
,
async
()
=>
{
...
@@ -73,7 +69,6 @@ describe('Button.uvue', () => {
...
@@ -73,7 +69,6 @@ describe('Button.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
disabled_boolean
:
true
,
disabled_boolean
:
true
,
})
})
await
page
.
waitFor
(
500
)
expect
(
await
btn
.
property
(
'
disabled
'
)).
toBe
(
true
)
expect
(
await
btn
.
property
(
'
disabled
'
)).
toBe
(
true
)
})
})
})
})
\ No newline at end of file
pages/component/checkbox/checkbox.test.js
浏览文件 @
27f83eec
...
@@ -8,7 +8,7 @@ function getData(key = '') {
...
@@ -8,7 +8,7 @@ function getData(key = '') {
let
page
let
page
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/checkbox/checkbox
'
)
page
=
await
program
.
reLaunch
(
'
/pages/component/checkbox/checkbox
'
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
'
view
'
)
})
})
describe
(
'
Checkbox.uvue
'
,
()
=>
{
describe
(
'
Checkbox.uvue
'
,
()
=>
{
...
@@ -46,7 +46,6 @@ describe('Checkbox.uvue', () => {
...
@@ -46,7 +46,6 @@ describe('Checkbox.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
checked
:
false
,
checked
:
false
,
})
})
await
page
.
waitFor
(
500
)
expect
(
await
cb
.
property
(
'
checked
'
)).
toBe
(
false
)
expect
(
await
cb
.
property
(
'
checked
'
)).
toBe
(
false
)
})
})
it
(
'
color
'
,
async
()
=>
{
it
(
'
color
'
,
async
()
=>
{
...
@@ -55,7 +54,6 @@ describe('Checkbox.uvue', () => {
...
@@ -55,7 +54,6 @@ describe('Checkbox.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
color
:
'
#63acfc
'
,
color
:
'
#63acfc
'
,
})
})
await
page
.
waitFor
(
500
)
expect
(
await
cb
.
property
(
'
color
'
)).
toBe
(
'
#63acfc
'
)
expect
(
await
cb
.
property
(
'
color
'
)).
toBe
(
'
#63acfc
'
)
})
})
it
(
'
disabled
'
,
async
()
=>
{
it
(
'
disabled
'
,
async
()
=>
{
...
@@ -64,7 +62,6 @@ describe('Checkbox.uvue', () => {
...
@@ -64,7 +62,6 @@ describe('Checkbox.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
disabled
:
false
,
disabled
:
false
,
})
})
await
page
.
waitFor
(
500
)
expect
(
await
cb
.
property
(
'
disabled
'
)).
toBe
(
false
)
expect
(
await
cb
.
property
(
'
disabled
'
)).
toBe
(
false
)
})
})
})
})
pages/component/picker-view/picker-view.test.js
浏览文件 @
27f83eec
...
@@ -8,18 +8,18 @@ function getData(key = '') {
...
@@ -8,18 +8,18 @@ function getData(key = '') {
let
page
let
page
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/picker-view/picker-view
'
)
page
=
await
program
.
reLaunch
(
'
/pages/component/picker-view/picker-view
'
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
'
view
'
)
})
})
describe
(
'
PickerView.uvue
'
,
()
=>
{
describe
(
'
PickerView.uvue
'
,
()
=>
{
it
(
'
value
'
,
async
()
=>
{
it
(
'
value
'
,
async
()
=>
{
const
el
=
await
page
.
$
(
'
.picker-view
'
)
const
el
=
await
page
.
$
(
'
.picker-view
'
)
await
page
.
callMethod
(
'
setValue
'
)
await
page
.
callMethod
(
'
setValue
'
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
1000
)
expect
(
await
el
.
property
(
'
value
'
)).
toEqual
([
0
,
0
,
0
])
expect
(
await
el
.
property
(
'
value
'
)).
toEqual
([
0
,
0
,
0
])
expect
(
await
getData
(
'
result
'
)).
toEqual
([
0
,
0
,
0
])
expect
(
await
getData
(
'
result
'
)).
toEqual
([
0
,
0
,
0
])
await
page
.
callMethod
(
'
setValue1
'
)
await
page
.
callMethod
(
'
setValue1
'
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
1000
)
expect
(
await
el
.
property
(
'
value
'
)).
toEqual
([
10
,
10
,
10
])
expect
(
await
el
.
property
(
'
value
'
)).
toEqual
([
10
,
10
,
10
])
expect
(
await
getData
(
'
result
'
)).
toEqual
([
10
,
10
,
10
])
expect
(
await
getData
(
'
result
'
)).
toEqual
([
10
,
10
,
10
])
...
@@ -35,7 +35,7 @@ describe('PickerView.uvue', () => {
...
@@ -35,7 +35,7 @@ describe('PickerView.uvue', () => {
const
el
=
await
page
.
$
(
'
.picker-view
'
)
const
el
=
await
page
.
$
(
'
.picker-view
'
)
await
page
.
setData
({
await
page
.
setData
({
indicatorStyle
:
'
height: 100px;
'
,
indicatorStyle
:
'
height: 100px;
'
,
})
})
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
500
)
expect
(
await
el
.
property
(
'
indicatorStyle
'
)).
toBe
(
'
height: 100px;
'
)
expect
(
await
el
.
property
(
'
indicatorStyle
'
)).
toBe
(
'
height: 100px;
'
)
})
})
...
@@ -44,7 +44,6 @@ describe('PickerView.uvue', () => {
...
@@ -44,7 +44,6 @@ describe('PickerView.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
maskTopStyle
:
'
background: #ffffff;
'
,
maskTopStyle
:
'
background: #ffffff;
'
,
})
})
await
page
.
waitFor
(
500
)
expect
(
await
el
.
property
(
'
mask-top-style
'
)).
toBe
(
'
background: #ffffff;
'
)
expect
(
await
el
.
property
(
'
mask-top-style
'
)).
toBe
(
'
background: #ffffff;
'
)
})
})
it
(
'
mask-bottom-style
'
,
async
()
=>
{
it
(
'
mask-bottom-style
'
,
async
()
=>
{
...
@@ -52,7 +51,6 @@ describe('PickerView.uvue', () => {
...
@@ -52,7 +51,6 @@ describe('PickerView.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
maskBottomStyle
:
'
background: #ffffff;
'
,
maskBottomStyle
:
'
background: #ffffff;
'
,
})
})
await
page
.
waitFor
(
500
)
expect
(
await
el
.
property
(
'
mask-bottom-style
'
)).
toBe
(
'
background: #ffffff;
'
)
expect
(
await
el
.
property
(
'
mask-bottom-style
'
)).
toBe
(
'
background: #ffffff;
'
)
})
})
})
})
pages/component/progress/progress.test.js
浏览文件 @
27f83eec
...
@@ -8,7 +8,7 @@ function getData(key = '') {
...
@@ -8,7 +8,7 @@ function getData(key = '') {
let
page
let
page
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/progress/progress
'
)
page
=
await
program
.
reLaunch
(
'
/pages/component/progress/progress
'
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
'
view
'
)
})
})
describe
(
'
Progress.uvue
'
,
()
=>
{
describe
(
'
Progress.uvue
'
,
()
=>
{
...
@@ -17,15 +17,15 @@ describe('Progress.uvue', () => {
...
@@ -17,15 +17,15 @@ describe('Progress.uvue', () => {
const
p1
=
await
page
.
$
(
'
.p1
'
)
const
p1
=
await
page
.
$
(
'
.p1
'
)
const
p2
=
await
page
.
$
(
'
.p2
'
)
const
p2
=
await
page
.
$
(
'
.p2
'
)
const
p3
=
await
page
.
$
(
'
.p3
'
)
const
p3
=
await
page
.
$
(
'
.p3
'
)
page
.
callMethod
(
'
setProgress
'
)
page
.
callMethod
(
'
setProgress
'
)
await
page
.
waitFor
(
10
00
)
await
page
.
waitFor
(
5
00
)
expect
(
await
p
.
property
(
'
percent
'
)).
toEqual
(
20
)
expect
(
await
p
.
property
(
'
percent
'
)).
toEqual
(
20
)
expect
(
await
p1
.
property
(
'
percent
'
)).
toEqual
(
40
)
expect
(
await
p1
.
property
(
'
percent
'
)).
toEqual
(
40
)
expect
(
await
p2
.
property
(
'
percent
'
)).
toEqual
(
60
)
expect
(
await
p2
.
property
(
'
percent
'
)).
toEqual
(
60
)
expect
(
await
p3
.
property
(
'
percent
'
)).
toEqual
(
80
)
expect
(
await
p3
.
property
(
'
percent
'
)).
toEqual
(
80
)
expect
(
await
getData
(
'
curPercent
'
)).
toEqual
(
20
)
expect
(
await
getData
(
'
curPercent
'
)).
toEqual
(
20
)
page
.
callMethod
(
'
clearProgress
'
)
page
.
callMethod
(
'
clearProgress
'
)
await
page
.
waitFor
(
10
00
)
await
page
.
waitFor
(
5
00
)
expect
(
await
p
.
property
(
'
percent
'
)).
toEqual
(
0
)
expect
(
await
p
.
property
(
'
percent
'
)).
toEqual
(
0
)
expect
(
await
p1
.
property
(
'
percent
'
)).
toEqual
(
0
)
expect
(
await
p1
.
property
(
'
percent
'
)).
toEqual
(
0
)
expect
(
await
p2
.
property
(
'
percent
'
)).
toEqual
(
0
)
expect
(
await
p2
.
property
(
'
percent
'
)).
toEqual
(
0
)
...
@@ -42,7 +42,6 @@ describe('Progress.uvue', () => {
...
@@ -42,7 +42,6 @@ describe('Progress.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
showInfo
:
false
showInfo
:
false
})
})
await
page
.
waitFor
(
500
)
expect
(
await
el
.
property
(
'
show-info
'
)).
toEqual
(
false
)
expect
(
await
el
.
property
(
'
show-info
'
)).
toEqual
(
false
)
})
})
it
(
'
border-radius
'
,
async
()
=>
{
it
(
'
border-radius
'
,
async
()
=>
{
...
@@ -51,7 +50,6 @@ describe('Progress.uvue', () => {
...
@@ -51,7 +50,6 @@ describe('Progress.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
borderRadius
:
5
borderRadius
:
5
})
})
await
page
.
waitFor
(
500
)
expect
(
await
el
.
property
(
'
border-radius
'
)).
toEqual
(
5
)
expect
(
await
el
.
property
(
'
border-radius
'
)).
toEqual
(
5
)
})
})
it
(
'
font-size
'
,
async
()
=>
{
it
(
'
font-size
'
,
async
()
=>
{
...
@@ -60,7 +58,6 @@ describe('Progress.uvue', () => {
...
@@ -60,7 +58,6 @@ describe('Progress.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
fontSize
:
18
fontSize
:
18
})
})
await
page
.
waitFor
(
500
)
expect
(
await
el
.
property
(
'
font-size
'
)).
toEqual
(
18
)
expect
(
await
el
.
property
(
'
font-size
'
)).
toEqual
(
18
)
})
})
it
(
'
stroke-width
'
,
async
()
=>
{
it
(
'
stroke-width
'
,
async
()
=>
{
...
@@ -69,7 +66,6 @@ describe('Progress.uvue', () => {
...
@@ -69,7 +66,6 @@ describe('Progress.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
strokeWidth
:
6
strokeWidth
:
6
})
})
await
page
.
waitFor
(
500
)
expect
(
await
el
.
property
(
'
stroke-width
'
)).
toEqual
(
6
)
expect
(
await
el
.
property
(
'
stroke-width
'
)).
toEqual
(
6
)
})
})
it
(
'
backgroundColor
'
,
async
()
=>
{
it
(
'
backgroundColor
'
,
async
()
=>
{
...
@@ -78,7 +74,6 @@ describe('Progress.uvue', () => {
...
@@ -78,7 +74,6 @@ describe('Progress.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
backgroundColor
:
"
#007aff
"
backgroundColor
:
"
#007aff
"
})
})
await
page
.
waitFor
(
500
)
expect
(
await
el
.
property
(
'
background-color
'
)).
toEqual
(
'
#007aff
'
)
expect
(
await
el
.
property
(
'
background-color
'
)).
toEqual
(
'
#007aff
'
)
})
})
})
})
\ No newline at end of file
pages/component/radio/radio.test.js
浏览文件 @
27f83eec
...
@@ -8,7 +8,7 @@ function getData(key = '') {
...
@@ -8,7 +8,7 @@ function getData(key = '') {
let
page
let
page
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/radio/radio
'
)
page
=
await
program
.
reLaunch
(
'
/pages/component/radio/radio
'
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
'
view
'
)
})
})
describe
(
'
Radio.uvue
'
,
()
=>
{
describe
(
'
Radio.uvue
'
,
()
=>
{
...
@@ -44,7 +44,6 @@ describe('Radio.uvue', () => {
...
@@ -44,7 +44,6 @@ describe('Radio.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
checked
:
false
,
checked
:
false
,
})
})
await
page
.
waitFor
(
500
)
expect
(
await
radio
.
property
(
'
checked
'
)).
toBe
(
false
)
expect
(
await
radio
.
property
(
'
checked
'
)).
toBe
(
false
)
})
})
it
(
'
color
'
,
async
()
=>
{
it
(
'
color
'
,
async
()
=>
{
...
@@ -53,7 +52,6 @@ describe('Radio.uvue', () => {
...
@@ -53,7 +52,6 @@ describe('Radio.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
color
:
'
#63acfc
'
,
color
:
'
#63acfc
'
,
})
})
await
page
.
waitFor
(
500
)
expect
(
await
radio
.
property
(
'
color
'
)).
toBe
(
'
#63acfc
'
)
expect
(
await
radio
.
property
(
'
color
'
)).
toBe
(
'
#63acfc
'
)
})
})
it
(
'
disabled
'
,
async
()
=>
{
it
(
'
disabled
'
,
async
()
=>
{
...
@@ -62,7 +60,6 @@ describe('Radio.uvue', () => {
...
@@ -62,7 +60,6 @@ describe('Radio.uvue', () => {
await
page
.
setData
({
await
page
.
setData
({
disabled
:
false
,
disabled
:
false
,
})
})
await
page
.
waitFor
(
500
)
expect
(
await
radio
.
property
(
'
disabled
'
)).
toBe
(
false
)
expect
(
await
radio
.
property
(
'
disabled
'
)).
toBe
(
false
)
})
})
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录