Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
965c0628
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6067
Star
93
Fork
166
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
965c0628
编写于
11月 27, 2023
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: 规避 web 端不兼容测试
上级
dbd4486f
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
392 addition
and
299 deletion
+392
-299
pages/API/get-app/get-app.test.js
pages/API/get-app/get-app.test.js
+57
-38
pages/API/globalProperties/globalProperties.test.js
pages/API/globalProperties/globalProperties.test.js
+64
-35
pages/component/list-view/list-view-multiplex.test.js
pages/component/list-view/list-view-multiplex.test.js
+19
-13
pages/component/list-view/list-view.test.js
pages/component/list-view/list-view.test.js
+8
-2
pages/component/sticky-header/sticky-header.test.js
pages/component/sticky-header/sticky-header.test.js
+20
-13
pages/component/sticky-section/sticky-section.test.js
pages/component/sticky-section/sticky-section.test.js
+20
-13
pages/component/web-view-local/web-view-local.test.js
pages/component/web-view-local/web-view-local.test.js
+25
-23
pages/component/web-view/web-view.test.js
pages/component/web-view/web-view.test.js
+20
-14
pages/pages.test.js
pages/pages.test.js
+159
-148
未找到文件。
pages/API/get-app/get-app.test.js
浏览文件 @
965c0628
const
PAGE_PATH
=
'
/pages/API/get-app/get-app
'
describe
(
'
getApp
'
,
()
=>
{
let
page
=
null
beforeAll
(
async
()
=>
{
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
})
it
(
'
globalData
'
,
async
()
=>
{
await
page
.
callMethod
(
'
getGlobalData
'
)
let
data
=
await
page
.
data
()
expect
(
data
.
originGlobalData
.
str
).
toBe
(
'
default globalData str
'
)
expect
(
data
.
originGlobalData
.
num
).
toBe
(
0
)
expect
(
data
.
originGlobalData
.
bool
).
toBe
(
false
)
expect
(
data
.
originGlobalData
.
obj
).
toEqual
({
bool
:
false
,
num
:
0
,
str
:
'
default globalData obj str
'
})
expect
(
data
.
originGlobalData
.
arr
).
toEqual
([])
expect
(
data
.
originGlobalData
.
set
).
toEqual
([])
expect
(
data
.
originGlobalData
.
map
).
toEqual
({})
expect
(
data
.
originGlobalDataFuncRes
).
toBe
(
'
globalData func
'
)
await
page
.
callMethod
(
'
setGlobalData
'
)
data
=
await
page
.
data
()
expect
(
data
.
newGlobalData
.
str
).
toBe
(
'
new globalData str
'
)
expect
(
data
.
newGlobalData
.
num
).
toBe
(
100
)
expect
(
data
.
newGlobalData
.
bool
).
toBe
(
true
)
expect
(
data
.
newGlobalData
.
obj
).
toEqual
({
bool
:
true
,
num
:
200
,
str
:
'
new globalData obj str
'
})
expect
(
data
.
newGlobalData
.
arr
).
toEqual
([
1
,
2
,
3
])
expect
(
data
.
newGlobalData
.
set
).
toEqual
([
'
a
'
,
'
b
'
,
'
c
'
])
expect
(
data
.
newGlobalData
.
map
).
toEqual
({
'
a
'
:
1
,
'
b
'
:
2
,
'
c
'
:
3
})
expect
(
data
.
newGlobalDataFuncRes
).
toBe
(
'
new globalData func
'
)
})
it
(
'
method
'
,
async
()
=>
{
const
oldLifeCycleNum
=
await
page
.
data
(
'
lifeCycleNum
'
)
await
page
.
callMethod
(
'
_increasetLifeCycleNum
'
)
const
newLifeCycleNum
=
await
page
.
data
(
'
lifeCycleNum
'
)
expect
(
newLifeCycleNum
-
oldLifeCycleNum
).
toBe
(
100
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
oldLifeCycleNum
)
})
})
const
PAGE_PATH
=
'
/pages/API/get-app/get-app
'
describe
(
'
getApp
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
let
page
=
null
beforeAll
(
async
()
=>
{
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
})
it
(
'
globalData
'
,
async
()
=>
{
await
page
.
callMethod
(
'
getGlobalData
'
)
let
data
=
await
page
.
data
()
expect
(
data
.
originGlobalData
.
str
).
toBe
(
'
default globalData str
'
)
expect
(
data
.
originGlobalData
.
num
).
toBe
(
0
)
expect
(
data
.
originGlobalData
.
bool
).
toBe
(
false
)
expect
(
data
.
originGlobalData
.
obj
).
toEqual
({
bool
:
false
,
num
:
0
,
str
:
'
default globalData obj str
'
})
expect
(
data
.
originGlobalData
.
arr
).
toEqual
([])
expect
(
data
.
originGlobalData
.
set
).
toEqual
([])
expect
(
data
.
originGlobalData
.
map
).
toEqual
({})
expect
(
data
.
originGlobalDataFuncRes
).
toBe
(
'
globalData func
'
)
await
page
.
callMethod
(
'
setGlobalData
'
)
data
=
await
page
.
data
()
expect
(
data
.
newGlobalData
.
str
).
toBe
(
'
new globalData str
'
)
expect
(
data
.
newGlobalData
.
num
).
toBe
(
100
)
expect
(
data
.
newGlobalData
.
bool
).
toBe
(
true
)
expect
(
data
.
newGlobalData
.
obj
).
toEqual
({
bool
:
true
,
num
:
200
,
str
:
'
new globalData obj str
'
})
expect
(
data
.
newGlobalData
.
arr
).
toEqual
([
1
,
2
,
3
])
expect
(
data
.
newGlobalData
.
set
).
toEqual
([
'
a
'
,
'
b
'
,
'
c
'
])
expect
(
data
.
newGlobalData
.
map
).
toEqual
({
'
a
'
:
1
,
'
b
'
:
2
,
'
c
'
:
3
})
expect
(
data
.
newGlobalDataFuncRes
).
toBe
(
'
new globalData func
'
)
})
it
(
'
method
'
,
async
()
=>
{
const
oldLifeCycleNum
=
await
page
.
data
(
'
lifeCycleNum
'
)
await
page
.
callMethod
(
'
_increasetLifeCycleNum
'
)
const
newLifeCycleNum
=
await
page
.
data
(
'
lifeCycleNum
'
)
expect
(
newLifeCycleNum
-
oldLifeCycleNum
).
toBe
(
100
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
oldLifeCycleNum
)
})
}
else
{
// TODO: web 端暂不支持
it
(
'
web
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
}
})
\ No newline at end of file
pages/API/globalProperties/globalProperties.test.js
浏览文件 @
965c0628
const
PAGE_PATH
=
'
/pages/API/globalProperties/globalProperties
'
describe
(
'
globalProperties
'
,
()
=>
{
let
page
=
null
beforeAll
(
async
()
=>
{
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
500
)
})
it
(
'
globalProperties
'
,
async
()
=>
{
let
data
=
await
page
.
data
()
expect
(
data
.
myGlobalProperties
.
str
).
toBe
(
'
default string
'
)
expect
(
data
.
myGlobalProperties
.
num
).
toBe
(
0
)
expect
(
data
.
myGlobalProperties
.
bool
).
toBe
(
false
)
expect
(
data
.
myGlobalProperties
.
obj
).
toEqual
({
bool
:
false
,
num
:
0
,
str
:
'
default globalProperties obj string
'
})
expect
(
data
.
myGlobalProperties
.
arr
).
toEqual
([])
expect
(
data
.
myGlobalProperties
.
set
).
toEqual
([])
expect
(
data
.
myGlobalProperties
.
map
).
toEqual
({})
expect
(
data
.
myGlobalProperties
.
reactiveObj
).
toEqual
({
str
:
'
default reactive string
'
,
num
:
0
,
bool
:
false
})
expect
(
data
.
globalPropertiesFnRes
).
toBe
(
'
globalPropertiesStr: default string, globalPropertiesNum: 0
'
)
await
page
.
callMethod
(
'
updateGlobalProperties
'
)
data
=
await
page
.
data
()
expect
(
data
.
myGlobalProperties
.
str
).
toBe
(
'
new string
'
)
expect
(
data
.
myGlobalProperties
.
num
).
toBe
(
100
)
expect
(
data
.
myGlobalProperties
.
bool
).
toBe
(
true
)
expect
(
data
.
myGlobalProperties
.
obj
).
toEqual
({
bool
:
true
,
num
:
100
,
str
:
'
new globalProperties obj string
'
})
expect
(
data
.
myGlobalProperties
.
arr
).
toEqual
([
1
,
2
,
3
])
expect
(
data
.
myGlobalProperties
.
set
).
toEqual
([
'
a
'
,
'
b
'
,
'
c
'
])
expect
(
data
.
myGlobalProperties
.
map
).
toEqual
({
'
a
'
:
1
,
'
b
'
:
2
,
'
c
'
:
3
})
expect
(
data
.
myGlobalProperties
.
reactiveObj
).
toEqual
({
str
:
'
new reactive string
'
,
num
:
200
,
bool
:
true
})
expect
(
data
.
globalPropertiesFnRes
).
toBe
(
'
globalPropertiesStr: new string, globalPropertiesNum: 100
'
)
})
it
(
'
screenshot
'
,
async
()
=>
{
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
();
})
const
PAGE_PATH
=
'
/pages/API/globalProperties/globalProperties
'
describe
(
'
globalProperties
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
let
page
=
null
beforeAll
(
async
()
=>
{
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
500
)
})
it
(
'
globalProperties
'
,
async
()
=>
{
let
data
=
await
page
.
data
()
expect
(
data
.
myGlobalProperties
.
str
).
toBe
(
'
default string
'
)
expect
(
data
.
myGlobalProperties
.
num
).
toBe
(
0
)
expect
(
data
.
myGlobalProperties
.
bool
).
toBe
(
false
)
expect
(
data
.
myGlobalProperties
.
obj
).
toEqual
({
bool
:
false
,
num
:
0
,
str
:
'
default globalProperties obj string
'
})
expect
(
data
.
myGlobalProperties
.
arr
).
toEqual
([])
expect
(
data
.
myGlobalProperties
.
set
).
toEqual
([])
expect
(
data
.
myGlobalProperties
.
map
).
toEqual
({})
expect
(
data
.
myGlobalProperties
.
reactiveObj
).
toEqual
({
str
:
'
default reactive string
'
,
num
:
0
,
bool
:
false
})
expect
(
data
.
globalPropertiesFnRes
).
toBe
(
'
globalPropertiesStr: default string, globalPropertiesNum: 0
'
)
await
page
.
callMethod
(
'
updateGlobalProperties
'
)
data
=
await
page
.
data
()
expect
(
data
.
myGlobalProperties
.
str
).
toBe
(
'
new string
'
)
expect
(
data
.
myGlobalProperties
.
num
).
toBe
(
100
)
expect
(
data
.
myGlobalProperties
.
bool
).
toBe
(
true
)
expect
(
data
.
myGlobalProperties
.
obj
).
toEqual
({
bool
:
true
,
num
:
100
,
str
:
'
new globalProperties obj string
'
})
expect
(
data
.
myGlobalProperties
.
arr
).
toEqual
([
1
,
2
,
3
])
expect
(
data
.
myGlobalProperties
.
set
).
toEqual
([
'
a
'
,
'
b
'
,
'
c
'
])
expect
(
data
.
myGlobalProperties
.
map
).
toEqual
({
'
a
'
:
1
,
'
b
'
:
2
,
'
c
'
:
3
})
expect
(
data
.
myGlobalProperties
.
reactiveObj
).
toEqual
({
str
:
'
new reactive string
'
,
num
:
200
,
bool
:
true
})
expect
(
data
.
globalPropertiesFnRes
).
toBe
(
'
globalPropertiesStr: new string, globalPropertiesNum: 100
'
)
})
it
(
'
screenshot
'
,
async
()
=>
{
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
();
})
}
else
{
// TODO: web 端暂不支持
it
(
'
web
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
}
})
pages/component/list-view/list-view-multiplex.test.js
浏览文件 @
965c0628
describe
(
'
component-native-list-view
'
,
()
=>
{
let
page
beforeAll
(
async
()
=>
{
//打开list-view-multiplex测试页
page
=
await
program
.
reLaunch
(
'
/pages/component/list-view/list-view-multiplex
'
)
await
page
.
waitFor
(
'
list-view
'
)
})
//滚动list-view到底部 加载更多 如果异常则直接闪退
it
(
'
check_list_item_multiplex
'
,
async
()
=>
{
await
page
.
callMethod
(
'
listViewScrollByY
'
,
5000
)
await
page
.
waitFor
(
400
)
await
page
.
callMethod
(
'
listViewScrollByY
'
,
100
)
})
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
let
page
beforeAll
(
async
()
=>
{
//打开list-view-multiplex测试页
page
=
await
program
.
reLaunch
(
'
/pages/component/list-view/list-view-multiplex
'
)
await
page
.
waitFor
(
'
list-view
'
)
})
//滚动list-view到底部 加载更多 如果异常则直接闪退
it
(
'
check_list_item_multiplex
'
,
async
()
=>
{
await
page
.
callMethod
(
'
listViewScrollByY
'
,
5000
)
await
page
.
waitFor
(
400
)
await
page
.
callMethod
(
'
listViewScrollByY
'
,
100
)
})
}
else
{
// TODO: web 端暂不支持
it
(
'
web
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
}
})
pages/component/list-view/list-view.test.js
浏览文件 @
965c0628
describe
(
'
component-native-list-view
'
,
()
=>
{
describe
(
'
component-native-list-view
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
let
page
beforeAll
(
async
()
=>
{
//打开list-view测试页
...
...
@@ -75,5 +76,10 @@ describe('component-native-list-view', () => {
await
page
.
callMethod
(
'
item_change_size_enum
'
,
0
)
expect
(
scrollLeft
-
1080
).
toBeGreaterThanOrEqual
(
0
)
})
}
else
{
// TODO: web 端暂不支持
it
(
'
web
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
}
})
pages/component/sticky-header/sticky-header.test.js
浏览文件 @
965c0628
describe
(
'
component-native-sticky-header
'
,
()
=>
{
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/sticky-header/sticky-header
'
)
await
page
.
waitFor
(
'
sticky-header
'
)
})
//检测吸顶效果
it
(
'
check_sticky_header
'
,
async
()
=>
{
await
page
.
callMethod
(
'
confirm_scroll_top_input
'
,
600
)
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toMatchImageSnapshot
();
})
})
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/sticky-header/sticky-header
'
)
await
page
.
waitFor
(
'
sticky-header
'
)
})
//检测吸顶效果
it
(
'
check_sticky_header
'
,
async
()
=>
{
await
page
.
callMethod
(
'
confirm_scroll_top_input
'
,
600
)
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toMatchImageSnapshot
();
})
}
else
{
// TODO: web 端暂不支持
it
(
'
web
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
}
})
\ No newline at end of file
pages/component/sticky-section/sticky-section.test.js
浏览文件 @
965c0628
describe
(
'
component-native-sticky-section
'
,
()
=>
{
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/sticky-section/sticky-section
'
)
await
page
.
waitFor
(
'
sticky-section
'
)
})
//检测吸顶上推效果
it
(
'
check_sticky_section
'
,
async
()
=>
{
await
page
.
callMethod
(
'
listViewScrollByY
'
,
1000
)
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toMatchImageSnapshot
();
})
})
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/sticky-section/sticky-section
'
)
await
page
.
waitFor
(
'
sticky-section
'
)
})
//检测吸顶上推效果
it
(
'
check_sticky_section
'
,
async
()
=>
{
await
page
.
callMethod
(
'
listViewScrollByY
'
,
1000
)
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toMatchImageSnapshot
();
})
}
else
{
// TODO: web 端暂不支持
it
(
'
web
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
}
})
\ No newline at end of file
pages/component/web-view-local/web-view-local.test.js
浏览文件 @
965c0628
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe
(
'
component-native-web-view
'
,
()
=>
{
let
page
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/web-view-local/web-view-local
'
);
await
page
.
waitFor
(
1000
);
});
it
(
'
check_load_url
'
,
async
()
=>
{
expect
(
await
page
.
data
(
'
loadError
'
)).
toBe
(
false
)
});
it
(
'
screenshot
'
,
async
()
=>
{
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
loadFinish
'
)
===
true
;
});
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
();
});
});
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe
(
'
component-native-web-view
'
,
()
=>
{
let
page
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/web-view-local/web-view-local
'
);
await
page
.
waitFor
(
1000
);
});
it
(
'
check_load_url
'
,
async
()
=>
{
expect
(
await
page
.
data
(
'
loadError
'
)).
toBe
(
false
)
});
it
(
'
screenshot
'
,
async
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
loadFinish
'
)
===
true
;
});
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toMatchImageSnapshot
();
}
});
});
\ No newline at end of file
pages/component/web-view/web-view.test.js
浏览文件 @
965c0628
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe
(
'
component-native-web-view
'
,
()
=>
{
let
page
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/web-view/web-view
'
);
await
page
.
waitFor
(
3000
);
});
it
(
'
check_load_url
'
,
async
()
=>
{
expect
(
await
page
.
data
(
'
loadError
'
)).
toBe
(
false
)
});
});
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe
(
'
component-native-web-view
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
let
page
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/web-view/web-view
'
);
await
page
.
waitFor
(
3000
);
});
it
(
'
check_load_url
'
,
async
()
=>
{
expect
(
await
page
.
data
(
'
loadError
'
)).
toBe
(
false
)
});
}
else
{
// TODO: web 端暂不支持
it
(
'
web
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
}
});
\ No newline at end of file
pages/pages.test.js
浏览文件 @
965c0628
let
pageIndex
=
0
const
pages
=
[
// component
'
/pages/component/button/button
'
,
'
/pages/component/checkbox/checkbox
'
,
'
/pages/component/general-attribute/general-attribute
'
,
'
/pages/component/general-event/general-event
'
,
'
/pages/component/image/image-format
'
,
// '/pages/component/image/image-large', // 截图过大
'
/pages/component/image/image-mode
'
,
// '/pages/component/image/image-path', // 网络资源加载,单独测试例截图
'
/pages/component/image/image
'
,
// '/pages/component/input/input', // 自动获取焦点,单独测试例截图
'
/pages/component/list-view/list-view
'
,
'
/pages/component/navigator/navigate
'
,
'
/pages/component/navigator/navigator
'
,
'
/pages/component/navigator/redirect
'
,
// '/pages/component/picker-view/picker-view', //动态内容
'
/pages/component/progress/progress
'
,
'
/pages/component/radio/radio
'
,
'
/pages/component/rich-text/rich-text-complex
'
,
'
/pages/component/rich-text/rich-text-tags
'
,
'
/pages/component/rich-text/rich-text
'
,
'
/pages/component/scroll-view/scroll-view-custom-refresher-props
'
,
'
/pages/component/scroll-view/scroll-view-props
'
,
'
/pages/component/scroll-view/scroll-view-refresher-props
'
,
'
/pages/component/scroll-view/scroll-view-refresher
'
,
'
/pages/component/scroll-view/scroll-view
'
,
'
/pages/component/slider/slider
'
,
'
/pages/component/slider-100/slider-100
'
,
'
/pages/component/swiper/swiper
'
,
'
/pages/component/switch/switch
'
,
'
/pages/component/text/text-props
'
,
'
/pages/component/text/text
'
,
'
/pages/component/textarea/textarea
'
,
// '/pages/component/video/video',
'
/pages/component/view/view
'
,
// '/pages/component/web-view/web-view', // 动态内容
// '/pages/component/web-view-local/web-view-local', // 依赖加载完成回调,单独测试例截图
'
/pages/component/general-event/transition-event
'
,
// CSS
'
/pages/CSS/background/background-color
'
,
'
/pages/CSS/background/background-image
'
,
'
/pages/CSS/border/complex-border/complex-border
'
,
'
/pages/CSS/border/border-bottom
'
,
'
/pages/CSS/border/border-color
'
,
'
/pages/CSS/border/border-left
'
,
'
/pages/CSS/border/border-radius
'
,
'
/pages/CSS/border/border-right
'
,
'
/pages/CSS/border/border-style
'
,
'
/pages/CSS/border/border-top
'
,
'
/pages/CSS/border/border-width
'
,
'
/pages/CSS/border/border
'
,
// '/pages/CSS/box-shadow/box-shadow',
'
/pages/CSS/display/flex
'
,
'
/pages/CSS/display/none
'
,
'
/pages/CSS/flex/align-content
'
,
'
/pages/CSS/flex/align-items
'
,
'
/pages/CSS/flex/flex-basis
'
,
'
/pages/CSS/flex/flex-direction
'
,
'
/pages/CSS/flex/flex-flow
'
,
'
/pages/CSS/flex/flex-grow
'
,
'
/pages/CSS/flex/flex-shrink
'
,
'
/pages/CSS/flex/flex
'
,
'
/pages/CSS/flex/justify-content
'
,
'
/pages/CSS/layout/height
'
,
'
/pages/CSS/layout/max-height
'
,
'
/pages/CSS/layout/max-width
'
,
'
/pages/CSS/layout/min-height
'
,
'
/pages/CSS/layout/min-width
'
,
'
/pages/CSS/layout/position
'
,
'
/pages/CSS/layout/visibility
'
,
'
/pages/CSS/layout/width
'
,
'
/pages/CSS/layout/z-index
'
,
'
/pages/CSS/margin/margin-bottom
'
,
'
/pages/CSS/margin/margin-left
'
,
'
/pages/CSS/margin/margin-right
'
,
'
/pages/CSS/margin/margin-top
'
,
'
/pages/CSS/margin/margin
'
,
'
/pages/CSS/padding/padding-bottom
'
,
'
/pages/CSS/padding/padding-left
'
,
'
/pages/CSS/padding/padding-right
'
,
'
/pages/CSS/padding/padding-top
'
,
'
/pages/CSS/padding/padding
'
,
'
/pages/CSS/text/color
'
,
// '/pages/CSS/text/font-family', // 网络资源加载,单独测试例截图
'
/pages/CSS/text/font-size
'
,
'
/pages/CSS/text/font-style
'
,
'
/pages/CSS/text/font-weight
'
,
'
/pages/CSS/text/letter-spacing
'
,
'
/pages/CSS/text/line-height
'
,
'
/pages/CSS/text/text-align
'
,
'
/pages/CSS/text/text-decoration-line
'
,
'
/pages/CSS/text/text-overflow
'
,
'
/pages/CSS/transform/rotate
'
,
'
/pages/CSS/transform/scale
'
,
'
/pages/CSS/transform/translate
'
,
'
/pages/CSS/transition/transition
'
,
// tabBar //改动频繁,不再测试
// '/pages/tabBar/API',
// '/pages/tabBar/component',
// '/pages/tabBar/CSS',
// '/pages/tabBar/template',
// template
// '/pages/template/calendar/calendar', // 动态内容
'
/pages/template/custom-refresher/custom-refresher
'
,
'
/pages/template/custom-tab-bar/custom-tab-bar
'
,
// '/pages/template/drop-card/drop-card',
'
/pages/template/half-screen/half-screen
'
,
// '/pages/template/list-news/list-news', // 网络资源加载,单独测试例截图
// '/pages/template/long-list/long-list', // 动态内容
'
/pages/template/navbar-lite/navbar-lite
'
,
'
/pages/template/pull-zoom-image/pull-zoom-image
'
,
'
/pages/template/scroll-fold-nav/scroll-fold-nav
'
,
'
/pages/template/scroll-sticky/scroll-sticky
'
,
'
/pages/template/swiper-list/swiper-list
'
,
'
/pages/template/swiper-list2/swiper-list2
'
,
// '/pages/template/swiper-vertical-video/swiper-vertical-video'
// api
'
/pages/API/element-draw/element-draw
'
,
]
let
pageIndex
=
0
const
pages
=
[
// component
'
/pages/component/button/button
'
,
'
/pages/component/checkbox/checkbox
'
,
'
/pages/component/general-attribute/general-attribute
'
,
'
/pages/component/general-event/general-event
'
,
'
/pages/component/image/image-format
'
,
// '/pages/component/image/image-large', // 截图过大
'
/pages/component/image/image-mode
'
,
// '/pages/component/image/image-path', // 网络资源加载,单独测试例截图
'
/pages/component/image/image
'
,
// '/pages/component/input/input', // 自动获取焦点,单独测试例截图
// '/pages/component/list-view/list-view',
'
/pages/component/navigator/navigate
'
,
'
/pages/component/navigator/navigator
'
,
'
/pages/component/navigator/redirect
'
,
// '/pages/component/picker-view/picker-view', //动态内容
'
/pages/component/progress/progress
'
,
'
/pages/component/radio/radio
'
,
'
/pages/component/rich-text/rich-text-complex
'
,
'
/pages/component/rich-text/rich-text-tags
'
,
'
/pages/component/rich-text/rich-text
'
,
'
/pages/component/scroll-view/scroll-view-custom-refresher-props
'
,
'
/pages/component/scroll-view/scroll-view-props
'
,
'
/pages/component/scroll-view/scroll-view-refresher-props
'
,
'
/pages/component/scroll-view/scroll-view-refresher
'
,
'
/pages/component/scroll-view/scroll-view
'
,
'
/pages/component/slider/slider
'
,
'
/pages/component/slider-100/slider-100
'
,
'
/pages/component/swiper/swiper
'
,
'
/pages/component/switch/switch
'
,
'
/pages/component/text/text-props
'
,
'
/pages/component/text/text
'
,
'
/pages/component/textarea/textarea
'
,
// '/pages/component/video/video',
'
/pages/component/view/view
'
,
// '/pages/component/web-view/web-view', // 动态内容
// '/pages/component/web-view-local/web-view-local', // 依赖加载完成回调,单独测试例截图
'
/pages/component/general-event/transition-event
'
,
// CSS
'
/pages/CSS/background/background-color
'
,
'
/pages/CSS/background/background-image
'
,
'
/pages/CSS/border/complex-border/complex-border
'
,
'
/pages/CSS/border/border-bottom
'
,
'
/pages/CSS/border/border-color
'
,
'
/pages/CSS/border/border-left
'
,
'
/pages/CSS/border/border-radius
'
,
'
/pages/CSS/border/border-right
'
,
'
/pages/CSS/border/border-style
'
,
'
/pages/CSS/border/border-top
'
,
'
/pages/CSS/border/border-width
'
,
'
/pages/CSS/border/border
'
,
// '/pages/CSS/box-shadow/box-shadow',
'
/pages/CSS/display/flex
'
,
'
/pages/CSS/display/none
'
,
'
/pages/CSS/flex/align-content
'
,
'
/pages/CSS/flex/align-items
'
,
'
/pages/CSS/flex/flex-basis
'
,
'
/pages/CSS/flex/flex-direction
'
,
'
/pages/CSS/flex/flex-flow
'
,
'
/pages/CSS/flex/flex-grow
'
,
'
/pages/CSS/flex/flex-shrink
'
,
'
/pages/CSS/flex/flex
'
,
'
/pages/CSS/flex/justify-content
'
,
'
/pages/CSS/layout/height
'
,
'
/pages/CSS/layout/max-height
'
,
'
/pages/CSS/layout/max-width
'
,
'
/pages/CSS/layout/min-height
'
,
'
/pages/CSS/layout/min-width
'
,
'
/pages/CSS/layout/position
'
,
'
/pages/CSS/layout/visibility
'
,
'
/pages/CSS/layout/width
'
,
'
/pages/CSS/layout/z-index
'
,
'
/pages/CSS/margin/margin-bottom
'
,
'
/pages/CSS/margin/margin-left
'
,
'
/pages/CSS/margin/margin-right
'
,
'
/pages/CSS/margin/margin-top
'
,
'
/pages/CSS/margin/margin
'
,
'
/pages/CSS/padding/padding-bottom
'
,
'
/pages/CSS/padding/padding-left
'
,
'
/pages/CSS/padding/padding-right
'
,
'
/pages/CSS/padding/padding-top
'
,
'
/pages/CSS/padding/padding
'
,
'
/pages/CSS/text/color
'
,
// '/pages/CSS/text/font-family', // 网络资源加载,单独测试例截图
'
/pages/CSS/text/font-size
'
,
'
/pages/CSS/text/font-style
'
,
'
/pages/CSS/text/font-weight
'
,
'
/pages/CSS/text/letter-spacing
'
,
'
/pages/CSS/text/line-height
'
,
'
/pages/CSS/text/text-align
'
,
'
/pages/CSS/text/text-decoration-line
'
,
'
/pages/CSS/text/text-overflow
'
,
'
/pages/CSS/transform/rotate
'
,
'
/pages/CSS/transform/scale
'
,
'
/pages/CSS/transform/translate
'
,
// '/pages/CSS/transition/transition',
// tabBar //改动频繁,不再测试
// '/pages/tabBar/API',
// '/pages/tabBar/component',
// '/pages/tabBar/CSS',
// '/pages/tabBar/template',
// template
// '/pages/template/calendar/calendar', // 动态内容
'
/pages/template/custom-refresher/custom-refresher
'
,
'
/pages/template/custom-tab-bar/custom-tab-bar
'
,
// '/pages/template/drop-card/drop-card',
'
/pages/template/half-screen/half-screen
'
,
// '/pages/template/list-news/list-news', // 网络资源加载,单独测试例截图
// '/pages/template/long-list/long-list', // 动态内容
'
/pages/template/navbar-lite/navbar-lite
'
,
'
/pages/template/pull-zoom-image/pull-zoom-image
'
,
'
/pages/template/scroll-fold-nav/scroll-fold-nav
'
,
'
/pages/template/scroll-sticky/scroll-sticky
'
,
// '/pages/template/swiper-list/swiper-list',
// '/pages/template/swiper-list2/swiper-list2',
// '/pages/template/swiper-vertical-video/swiper-vertical-video'
// api
// '/pages/API/element-draw/element-draw',
]
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
// 规避 web 端不支持页面
pages
.
push
(
"
/pages/component/list-view/list-view
"
,
"
/pages/CSS/transition/transition
"
,
'
/pages/template/swiper-list/swiper-list
'
,
'
/pages/template/swiper-list2/swiper-list2
'
,
'
/pages/API/element-draw/element-draw
'
,
)
}
let
page
;
describe
(
"
page screenshot test
"
,
()
=>
{
beforeAll
(
async
()
=>
{
console
.
log
(
"
page screenshot test start
"
);
});
beforeEach
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
pages
[
pageIndex
]);
await
page
.
waitFor
(
1000
);
});
afterEach
(()
=>
{
pageIndex
++
;
});
afterAll
(()
=>
{
console
.
log
(
"
page screenshot test finish
"
);
});
test
.
each
(
pages
)(
"
%s
"
,
async
()
=>
{
console
.
log
(
"
Taking screenshot:
"
,
pageIndex
,
pages
[
pageIndex
]);
const
image
=
await
program
.
screenshot
({
fullPage
:
true
,
});
expect
(
image
).
toMatchImageSnapshot
();
await
page
.
waitFor
(
500
);
});
let
page
;
describe
(
"
page screenshot test
"
,
()
=>
{
beforeAll
(
async
()
=>
{
console
.
log
(
"
page screenshot test start
"
);
});
beforeEach
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
pages
[
pageIndex
]);
await
page
.
waitFor
(
1000
);
});
afterEach
(()
=>
{
pageIndex
++
;
});
afterAll
(()
=>
{
console
.
log
(
"
page screenshot test finish
"
);
});
test
.
each
(
pages
)(
"
%s
"
,
async
()
=>
{
console
.
log
(
"
Taking screenshot:
"
,
pageIndex
,
pages
[
pageIndex
]);
const
image
=
await
program
.
screenshot
({
fullPage
:
true
,
});
expect
(
image
).
toMatchImageSnapshot
();
await
page
.
waitFor
(
500
);
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录