Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
8a9a5c07
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
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看板
提交
8a9a5c07
编写于
6月 11, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test(pages): 补充遗漏页面及未截图说明
上级
0afece61
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
305 addition
and
83 deletion
+305
-83
pages/pages.test.js
pages/pages.test.js
+305
-83
未找到文件。
pages/pages.test.js
浏览文件 @
8a9a5c07
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
isAndroid
=
platformInfo
.
startsWith
(
'
android
'
)
const
isIos
=
platformInfo
.
startsWith
(
'
ios
'
)
const
isApp
=
isAndroid
||
isIos
const
isWeb
=
platformInfo
.
startsWith
(
'
web
'
)
const
isAppWebview
=
!!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
let
pageIndex
=
0
let
pageIndex
=
0
const
pages
=
[
const
pages
=
[
// tabBar //改动频繁,不再测试
// '/pages/tabBar/component',
// '/pages/tabBar/API',
// '/pages/tabBar/CSS',
// '/pages/tabBar/template',
// component
// component
'
/pages/component/button/button
'
,
'
/pages/component/view/view
'
,
'
/pages/component/checkbox/checkbox
'
,
// 单独测试例截图
'
/pages/component/general-attribute/general-attribute
'
,
// 'pages/component/scroll-view/scroll-view',
'
/pages/component/general-event/general-event
'
,
// 单独测试例截图
'
/pages/component/image/image-format
'
,
// '/pages/component/scroll-view/scroll-view-refresher',
// '/pages/component/image/image-large', // 截图过大
// 单独测试例截图
// '/pages/component/image/image-mode', // 判断CPU类型,单独测试例截图
// '/pages/component/scroll-view/scroll-view-props',
// '/pages/component/image/image-path', // 网络资源加载,单独测试例截图
'
/pages/component/image/image
'
,
// '/pages/component/input/input', // 自动获取焦点,单独测试例截图
'
/pages/component/list-view/list-view
'
,
'
/pages/component/scroll-view/scroll-view-custom-refresher-props
'
,
'
/pages/component/scroll-view/scroll-view-refresher-props
'
,
'
/pages/component/scroll-view/scroll-view-refresher-props
'
,
'
/pages/component/navigator/navigate
'
,
'
/pages/component/scroll-view/scroll-view-custom-refresher-props
'
,
'
/pages/component/navigator/navigator
'
,
'
/pages/component/swiper/swiper
'
,
'
/pages/component/navigator/redirect
'
,
'
/pages/component/list-view/list-view
'
,
// '/pages/component/picker-view/picker-view', //动态内容
// 单独测试例截图
// '/pages/component/list-view/list-view-refresh',
// 单独测试例截图
// '/pages/component/list-view/list-view-multiplex',
'
/pages/component/list-view/list-view-multiplex-input
'
,
'
/pages/component/list-view/list-view-multiplex-video
'
,
'
/pages/component/list-view/list-view-children-in-slot
'
,
// 单独测试例截图
// '/pages/component/sticky-section/sticky-section',
// 单独测试例截图
// '/pages/component/sticky-header/sticky-header',
'
/pages/component/text/text
'
,
// 单独测试例截图
// '/pages/component/text/text-props',
'
/pages/component/rich-text/rich-text
'
,
'
/pages/component/rich-text/rich-text-tags
'
,
'
/pages/component/rich-text/rich-text-complex
'
,
'
/pages/component/progress/progress
'
,
'
/pages/component/progress/progress
'
,
'
/pages/component/form/form
'
,
'
/pages/component/button/button
'
,
'
/pages/component/button/buttonstatus
'
,
'
/pages/component/radio/radio
'
,
'
/pages/component/radio/radio
'
,
'
/pages/component/rich-text/rich-text-complex
'
,
'
/pages/component/checkbox/checkbox
'
,
'
/pages/component/rich-text/rich-text-tags
'
,
// 自动获取焦点,单独测试例截图
'
/pages/component/rich-text/rich-text
'
,
// '/pages/component/input/input',
'
/pages/component/textarea/textarea
'
,
'
/pages/component/slider/slider
'
,
'
/pages/component/slider/slider
'
,
'
/pages/component/slider/slider-in-swiper
'
,
//动态内容
// '/pages/component/picker-view/picker-view',
'
/pages/component/slider-100/slider-100
'
,
'
/pages/component/slider-100/slider-100
'
,
'
/pages/component/swiper/swiper
'
,
'
/pages/component/switch/switch
'
,
'
/pages/component/switch/switch
'
,
'
/pages/component/text/text-props
'
,
'
/pages/component/image/image
'
,
'
/pages/component/text/text
'
,
'
/pages/component/image/image-format
'
,
'
/pages/component/textarea/textarea
'
,
// 判断CPU类型,单独测试例截图
// '/pages/component/video/video',
// '/pages/component/image/image-mode',
'
/pages/component/view/view
'
,
// 网络资源加载,单独测试例截图
// '/pages/component/web-view/web-view', // 动态内容
// '/pages/component/image/image-path',
// '/pages/component/web-view-local/web-view-local', // 依赖加载完成回调,单独测试例截图
// 截图过大
// '/pages/component/image/image-large',
'
/pages/component/video/video
'
,
'
/pages/component/video/video-format
'
,
'
/pages/component/navigator/navigator
'
,
'
/pages/component/navigator/navigate
'
,
'
/pages/component/navigator/redirect
'
,
// 动态内容
// '/pages/component/web-view/web-view',
// 依赖加载完成回调,单独测试例截图
// '/pages/component/web-view-local/web-view-local',
// 动态内容
// '/pages/component/unicloud-db-contacts/list',
'
/pages/component/unicloud-db-contacts/add
'
,
// 动态内容
// '/pages/component/unicloud-db-contacts/edit',
// 动态内容
// '/pages/component/unicloud-db-contacts/detail',
'
/pages/component/mixin-datacom/mixin-datacom
'
,
// 单独测试例截图
// '/pages/component/general-attribute/general-attribute',
'
/pages/component/general-event/general-event
'
,
'
/pages/component/general-event/transition-event
'
,
'
/pages/component/general-event/transition-event
'
,
'
/pages/component/general-event/touch-event
'
,
// 单独测试例截图
// '/pages/component/nested-scroll-header/nested-scroll-header',
// 单独测试例截图
// '/pages/component/nested-scroll-body/nested-scroll-body',
// 单独测试例截图
// '/pages/component/swiper/swiper-list-view',
'
/pages/component/list-view/list-view-refresh
'
,
// 单独测试例截图
// '/pages/component/list-view/issue-2199',
// API
'
/pages/API/get-app/get-app
'
,
// 单独测试例截图
// '/pages/API/get-current-pages/get-current-pages',
// 单独测试例截图
// '/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh',
'
/pages/API/get-launch-options-sync/get-launch-options-sync
'
,
'
/pages/API/navigator/navigator
'
,
// 单独测试例截图
// '/pages/API/set-navigation-bar-color/set-navigation-bar-color',
// 单独测试例截图
// '/pages/API/set-navigation-bar-title/set-navigation-bar-title',
// 单独测试例截图
// '/pages/API/set-page-backgroundColorContent/set-page-backgroundColorContent',
// 单独测试例截图
// '/pages/API/navigator/new-page/new-page-1',
'
/pages/API/navigator/new-page/new-page-3
'
,
'
/pages/API/navigator/new-page/onLoad
'
,
// 下拉刷新,不进行截图
'
/pages/API/pull-down-refresh/pull-down-refresh
'
,
// 单独测试例截图
// '/pages/API/get-element-by-id/get-element-by-id',
// 单独测试例截图
// '/pages/API/get-element-by-id/get-element-by-id-multiple-root-node',
'
/pages/API/nodes-info/nodes-info
'
,
'
/pages/API/storage/storage
'
,
// 单独测试例截图
// '/pages/API/action-sheet/action-sheet',
// 单独测试例截图
// '/pages/API/modal/modal',
'
/pages/API/loading/loading
'
,
// 单独测试例截图
// '/pages/API/toast/toast',
// 单独测试例截图
// '/pages/API/load-font-face/load-font-face',
// 单独测试例截图
// '/pages/API/load-font-face/load-font-face-child',
'
/pages/API/get-location/get-location
'
,
'
/pages/API/interceptor/interceptor
'
,
'
/pages/API/interceptor/page1
'
,
'
/pages/API/interceptor/page2
'
,
'
/pages/API/request/request
'
,
'
/pages/API/upload-file/upload-file
'
,
'
/pages/API/download-file/download-file
'
,
'
/pages/API/websocket-socketTask/websocket-socketTask
'
,
// 页面销毁时会关闭socket连接,所以规避
// '/pages/API/websocket-global/websocket-global',
'
/pages/API/unicloud-call-function/unicloud-call-function
'
,
'
/pages/API/unicloud-import-object/unicloud-import-object
'
,
'
/pages/API/get-system-info/get-system-info
'
,
'
/pages/API/get-device-info/get-device-info
'
,
'
/pages/API/get-app-base-info/get-app-base-info
'
,
'
/pages/API/preview-image/preview-image
'
,
'
/pages/API/choose-image/choose-image
'
,
'
/pages/API/choose-video/choose-video
'
,
'
/pages/API/get-network-type/get-network-type
'
,
'
/pages/API/page-scroll-to/page-scroll-to
'
,
'
/pages/API/event-bus/event-bus
'
,
'
/pages/API/unicloud-file-api/unicloud-file-api
'
,
'
/pages/API/unicloud-database/unicloud-database
'
,
'
/pages/API/get-battery-info/get-battery-info
'
,
'
/pages/API/get-window-info/get-window-info
'
,
'
/pages/API/rpx2px/rpx2px
'
,
'
/pages/API/request-payment-uni-pay/request-payment-uni-pay
'
,
'
/pages/API/request-payment-uni-pay/order-detail
'
,
// 单独测试例截图
// '/pages/API/resize-observer/resize-observer',
// 单独测试例截图
// '/pages/API/map/map',
// CSS
// CSS
'
/pages/CSS/background/background-color
'
,
'
/pages/CSS/background/background-color
'
,
'
/pages/CSS/border/complex-border/complex-border
'
,
// 单独测试例中截图
'
/pages/CSS/border/border-bottom
'
,
// '/pages/CSS/background/background-image',
'
/pages/CSS/border/border
'
,
'
/pages/CSS/border/border-color
'
,
'
/pages/CSS/border/border-color
'
,
'
/pages/CSS/border/border-top
'
,
'
/pages/CSS/border/border-bottom
'
,
'
/pages/CSS/border/border-left
'
,
'
/pages/CSS/border/border-left
'
,
'
/pages/CSS/border/border-radius
'
,
'
/pages/CSS/border/border-right
'
,
'
/pages/CSS/border/border-right
'
,
'
/pages/CSS/border/border-radius
'
,
'
/pages/CSS/border/border-style
'
,
'
/pages/CSS/border/border-style
'
,
'
/pages/CSS/border/border-top
'
,
'
/pages/CSS/border/border-width
'
,
'
/pages/CSS/border/border-width
'
,
'
/pages/CSS/border/border
'
,
'
/pages/CSS/border/complex-border/complex-border
'
,
'
/pages/CSS/border/dynamic-border
'
,
// 单独测试例中截图
// '/pages/CSS/box-shadow/box-shadow',
// '/pages/CSS/border/dynamic-border',
'
/pages/CSS/box-shadow/box-shadow
'
,
'
/pages/CSS/display/flex
'
,
'
/pages/CSS/display/flex
'
,
'
/pages/CSS/display/none
'
,
'
/pages/CSS/display/none
'
,
'
/pages/CSS/flex/flex
'
,
'
/pages/CSS/flex/align-content
'
,
'
/pages/CSS/flex/align-content
'
,
'
/pages/CSS/flex/align-items
'
,
'
/pages/CSS/flex/align-items
'
,
'
/pages/CSS/flex/flex-basis
'
,
'
/pages/CSS/flex/flex-basis
'
,
...
@@ -59,78 +194,137 @@ const pages = [
...
@@ -59,78 +194,137 @@ const pages = [
'
/pages/CSS/flex/flex-flow
'
,
'
/pages/CSS/flex/flex-flow
'
,
'
/pages/CSS/flex/flex-grow
'
,
'
/pages/CSS/flex/flex-grow
'
,
'
/pages/CSS/flex/flex-shrink
'
,
'
/pages/CSS/flex/flex-shrink
'
,
'
/pages/CSS/flex/flex
'
,
'
/pages/CSS/flex/justify-content
'
,
'
/pages/CSS/flex/justify-content
'
,
'
/pages/CSS/layout/height
'
,
'
/pages/CSS/layout/height
'
,
'
/pages/CSS/layout/max-height
'
,
'
/pages/CSS/layout/max-width
'
,
'
/pages/CSS/layout/min-height
'
,
'
/pages/CSS/layout/min-height
'
,
'
/pages/CSS/layout/max-height
'
,
'
/pages/CSS/layout/min-width
'
,
'
/pages/CSS/layout/min-width
'
,
'
/pages/CSS/layout/max-width
'
,
'
/pages/CSS/layout/position
'
,
'
/pages/CSS/layout/position
'
,
'
/pages/CSS/layout/visibility
'
,
'
/pages/CSS/layout/width
'
,
'
/pages/CSS/layout/width
'
,
'
/pages/CSS/layout/z-index
'
,
'
/pages/CSS/layout/z-index
'
,
'
/pages/CSS/layout/visibility
'
,
'
/pages/CSS/margin/margin
'
,
'
/pages/CSS/margin/margin-top
'
,
'
/pages/CSS/margin/margin-bottom
'
,
'
/pages/CSS/margin/margin-bottom
'
,
'
/pages/CSS/margin/margin-left
'
,
'
/pages/CSS/margin/margin-left
'
,
'
/pages/CSS/margin/margin-right
'
,
'
/pages/CSS/margin/margin-right
'
,
'
/pages/CSS/
margin/margin-top
'
,
'
/pages/CSS/
padding/padding
'
,
'
/pages/CSS/
margin/margin
'
,
'
/pages/CSS/
padding/padding-top
'
,
'
/pages/CSS/padding/padding-bottom
'
,
'
/pages/CSS/padding/padding-bottom
'
,
'
/pages/CSS/padding/padding-left
'
,
'
/pages/CSS/padding/padding-left
'
,
'
/pages/CSS/padding/padding-right
'
,
'
/pages/CSS/padding/padding-right
'
,
'
/pages/CSS/padding/padding-top
'
,
// 单独测试例中截图
'
/pages/CSS/padding/padding
'
,
// '/pages/CSS/overflow/overflow
',
'
/pages/CSS/text/color
'
,
'
/pages/CSS/text/color
'
,
// '/pages/CSS/text/font-family', // 网络资源加载,单独测试例截图
// 网络资源加载,单独测试例截图
'
/pages/CSS/text/font-size
'
,
// '/pages/CSS/text/font-family',
// 单独测试例截图
// '/pages/CSS/text/font-size',
'
/pages/CSS/text/font-style
'
,
'
/pages/CSS/text/font-style
'
,
'
/pages/CSS/text/font-weight
'
,
'
/pages/CSS/text/font-weight
'
,
'
/pages/CSS/text/letter-spacing
'
,
'
/pages/CSS/text/letter-spacing
'
,
'
/pages/CSS/text/line-height
'
,
'
/pages/CSS/text/line-height
'
,
'
/pages/CSS/text/text-align
'
,
'
/pages/CSS/text/text-align
'
,
'
/pages/CSS/text/text-decoration-line
'
,
'
/pages/CSS/text/text-overflow
'
,
'
/pages/CSS/text/text-overflow
'
,
'
/pages/CSS/transform/rotate
'
,
'
/pages/CSS/text/text-decoration-line
'
,
'
/pages/CSS/transform/scale
'
,
// 单独测试例截图
'
/pages/CSS/transform/translate
'
,
// '/pages/CSS/transition/transition',
'
/pages/CSS/transition/transition
'
,
'
/pages/CSS/pointer-events/pointer-events
'
,
'
/pages/CSS/pointer-events/pointer-events
'
,
// 单独测试例截图
// tabBar //改动频繁,不再测试
// '/pages/CSS/transform/translate',
// '/pages/tabBar/API',
// 单独测试例截图
// '/pages/tabBar/component',
// '/pages/CSS/transform/scale',
// '/pages/tabBar/CSS',
// 单独测试例截图
// '/pages/tabBar/template',
// '/pages/CSS/transform/rotate',
// 单独测试例截图
// '/pages/CSS/variable/variable',
'
/pages/CSS/overflow/overflow-visible-event
'
,
// template
// template
// '/pages/template/calendar/calendar', // 动态内容
// 网络资源加载,单独测试例截图
// '/pages/template/list-news/list-news',
// 依赖网络资源加载
// '/pages/template/list-news/detail/detail',
'
/pages/template/drop-card/drop-card
'
,
'
/pages/template/swiper-list/swiper-list
'
,
'
/pages/template/swiper-list2/swiper-list2
'
,
'
/pages/template/swiper-vertical-video/swiper-vertical-video
'
,
'
/pages/template/scroll-fold-nav/scroll-fold-nav
'
,
'
/pages/template/custom-refresher/custom-refresher
'
,
'
/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/half-screen/half-screen
'
,
// '/pages/template/list-news/list-news', // 网络资源加载,单独测试例截图
// 动态内容
// '/pages/template/long-list/long-list', // 动态内容
// '/pages/template/long-list/long-list',
'
/pages/template/navbar-lite/navbar-lite
'
,
'
/pages/template/long-list2/long-list2
'
,
'
/pages/template/long-list-nested/long-list-nested
'
,
'
/pages/template/pull-zoom-image/pull-zoom-image
'
,
'
/pages/template/pull-zoom-image/pull-zoom-image
'
,
'
/pages/template/scroll-fold-nav/scroll-fold-nav
'
,
'
/pages/template/navbar-lite/navbar-lite
'
,
// '/pages/template/scroll-sticky/scroll-sticky',
'
/pages/template/custom-tab-bar/custom-tab-bar
'
,
'
/pages/template/swiper-list/swiper-list
'
,
// 动态内容
'
/pages/template/swiper-list2/swiper-list2
'
,
// '/pages/template/calendar/calendar',
// '/pages/template/swiper-vertical-video/swiper-vertical-video'
'
/pages/template/schema/schema
'
,
'
/uni_modules/uni-pay-x/pages/success/success
'
,
// api
// 依赖 onload 参数获取 web-view src
// '/pages/API/element-draw/element-draw',
// '/uni_modules/uni-pay-x/pages/ad-interactive-webview/ad-interactive-webview',
'
/uni_modules/uni-pay-x/pages/pay-desk/pay-desk
'
,
'
/pages/template/custom-long-list/custom-long-list
'
,
'
/pages/template/test-background-color-content/test-background-color-content
'
,
]
]
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
if
(
isApp
&&
!
isAppWebview
)
{
if
((
platformInfo
.
startsWith
(
'
android
'
)
||
platformInfo
.
startsWith
(
'
ios
'
))
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
// 规避 web 端不支持页面
pages
.
push
(
pages
.
push
(
'
/pages/API/element-draw/element-draw
'
,
'
/pages/API/element-draw/element-draw
'
,
'
/pages/API/get-file-system-manager/get-file-system-manager
'
,
'
/pages/API/env/env
'
,
'
/pages/API/get-system-setting/get-system-setting
'
,
'
/pages/API/element-takesnapshot/element-takesnapshot
'
,
'
/pages/API/get-app-authorize-setting/get-app-authorize-setting
'
,
'
/pages/API/save-image-to-photos-album/save-image-to-photos-album
'
,
'
/pages/API/save-video-to-photos-album/save-video-to-photos-album
'
,
'
/pages/API/facial-recognition-verify/facial-recognition-verify
'
,
'
/pages/API/get-univerify-manager/get-univerify-manager
'
,
'
/pages/API/request-payment/request-payment
'
,
'
/pages/API/theme-change/theme-change
'
,
'
/pages/template/scroll-sticky/scroll-sticky
'
,
'
/pages/template/scroll-sticky/scroll-sticky
'
,
)
)
}
}
if
(
isAndroid
&&
!
isAppWebview
)
{
pages
.
push
(
'
/pages/component/canvas/canvas
'
,
'
/pages/API/exit/exit
'
,
'
/pages/API/install-apk/install-apk
'
,
'
/pages/API/get-image-info/get-image-info
'
,
'
/pages/API/get-video-info/get-video-info
'
,
'
/pages/API/rewarded-video-ad/rewarded-video-ad
'
,
'
/pages/API/create-request-permission-listener/create-request-permission-listener
'
,
'
/pages/API/compress-image/compress-image
'
,
'
/pages/API/compress-video/compress-video
'
,
'
/pages/template/share/share
'
,
)
}
if
(
isWeb
)
{
pages
.
push
(
'
/pages/component/movable-view/movable-view
'
,
'
/pages/component/label/label
'
,
'
/pages/component/picker/picker
'
,
'
/pages/component/map/map
'
,
'
/pages/component/cover-view/cover-view
'
,
'
/pages/component/editor/editor
'
,
'
/pages/API/get-image-info/get-image-info
'
,
'
/pages/API/get-video-info/get-video-info
'
,
'
/pages/API/make-phone-call/make-phone-call
'
,
'
/pages/API/inner-audio/inner-audio
'
,
'
/pages/API/inner-audio/inner-audio-format
'
,
'
/pages/API/inner-audio/inner-audio-path
'
,
'
/pages/API/clipboard/clipboard
'
,
'
/pages/API/on-compass-change/on-compass-change
'
,
'
/pages/template/browser-canvas/browser-canvas
'
,
)
}
// 设置position: fixed的页面不能截取完整内容
// 设置position: fixed的页面不能截取完整内容
const
notFullPages
=
[
const
notFullPages
=
[
'
/pages/CSS/layout/position
'
,
'
/pages/CSS/layout/position
'
,
...
@@ -146,13 +340,40 @@ async function getWindowInfo() {
...
@@ -146,13 +340,40 @@ async function getWindowInfo() {
return
await
windowInfoPage
.
callMethod
(
'
jest_getWindowInfo
'
)
return
await
windowInfoPage
.
callMethod
(
'
jest_getWindowInfo
'
)
}
}
function
getWaitForTagName
(
pagePath
)
{
if
(
pagePath
===
'
/pages/component/list-view/list-view-multiplex-input
'
)
{
return
'
input
'
}
if
(
pagePath
===
'
/pages/component/list-view/list-view-multiplex-video
'
)
{
return
'
video
'
}
if
(
pagePath
===
'
/pages/component/general-event/transition-event
'
||
pagePath
===
'
/pages/component/list-view/list-view-refresh
'
||
pagePath
===
'
/pages/API/env/env
'
)
{
return
'
text
'
}
if
(
pagePath
===
'
/pages/component/unicloud-db-contacts/edit
'
||
pagePath
===
'
/pages/component/unicloud-db-contacts/detail
'
)
{
return
'
scroll-view
'
}
if
(
pagePath
===
'
/pages/API/get-file-system-manager/get-file-system-manager
'
)
{
return
'
button
'
}
return
'
view
'
}
describe
(
"
page screenshot test
"
,
()
=>
{
describe
(
"
page screenshot test
"
,
()
=>
{
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
console
.
log
(
"
page screenshot test start
"
);
console
.
log
(
"
page screenshot test start
"
);
});
});
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
pages
[
pageIndex
]);
const
currentPagePath
=
pages
[
pageIndex
]
await
page
.
waitFor
(
1000
);
page
=
await
program
.
reLaunch
(
currentPagePath
);
await
page
.
waitFor
(
getWaitForTagName
(
currentPagePath
));
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
pageIndex
++
;
pageIndex
++
;
...
@@ -161,26 +382,27 @@ describe("page screenshot test", () => {
...
@@ -161,26 +382,27 @@ describe("page screenshot test", () => {
console
.
log
(
"
page screenshot test finish
"
);
console
.
log
(
"
page screenshot test finish
"
);
});
});
test
.
each
(
pages
)(
"
%s
"
,
async
()
=>
{
test
.
each
(
pages
)(
"
%s
"
,
async
()
=>
{
console
.
log
(
"
Taking screenshot:
"
,
pageIndex
,
pages
[
pageIndex
]);
const
currentPagePath
=
pages
[
pageIndex
]
console
.
log
(
"
Taking screenshot:
"
,
pageIndex
,
currentPagePath
);
let
fullPage
=
true
;
let
fullPage
=
true
;
if
(
notFullPages
.
includes
(
pages
[
pageIndex
]
))
{
if
(
notFullPages
.
includes
(
currentPagePath
))
{
fullPage
=
false
;
fullPage
=
false
;
}
}
const
screenshotParams
=
{
const
screenshotParams
=
{
fullPage
fullPage
}
}
if
(
!
fullPage
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
if
(
!
fullPage
&&
!
isAppWebview
)
{
if
(
!
windowInfo
)
{
if
(
!
windowInfo
)
{
windowInfo
=
await
getWindowInfo
()
windowInfo
=
await
getWindowInfo
()
page
=
await
program
.
reLaunch
(
pages
[
pageIndex
]
);
page
=
await
program
.
reLaunch
(
currentPagePath
);
await
page
.
waitFor
(
1000
);
await
page
.
waitFor
(
getWaitForTagName
(
currentPagePath
)
);
}
}
let
offsetY
=
'
0
'
let
offsetY
=
'
0
'
if
(
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
().
startsWith
(
'
android
'
)
)
{
if
(
isAndroid
)
{
offsetY
=
`
${
windowInfo
.
statusBarHeight
+
44
}
`
offsetY
=
`
${
windowInfo
.
statusBarHeight
+
44
}
`
}
}
if
(
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
().
startsWith
(
'
ios
'
)
)
{
if
(
isIos
)
{
offsetY
=
`
${
windowInfo
.
safeAreaInsets
.
top
+
44
}
`
offsetY
=
`
${
windowInfo
.
safeAreaInsets
.
top
+
44
}
`
}
}
screenshotParams
.
offsetY
=
offsetY
screenshotParams
.
offsetY
=
offsetY
...
@@ -189,7 +411,7 @@ describe("page screenshot test", () => {
...
@@ -189,7 +411,7 @@ describe("page screenshot test", () => {
const
image
=
await
program
.
screenshot
(
screenshotParams
);
const
image
=
await
program
.
screenshot
(
screenshotParams
);
expect
(
image
).
toSaveImageSnapshot
({
expect
(
image
).
toSaveImageSnapshot
({
customSnapshotIdentifier
()
{
customSnapshotIdentifier
()
{
return
`__pages_test__/
${
pages
[
pageIndex
]
.
replace
(
/
\/
/g
,
"
-
"
).
substring
(
1
)}
`
return
`__pages_test__/
${
currentPagePath
.
replace
(
/
\/
/g
,
"
-
"
).
substring
(
1
)}
`
}
}
})
})
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
500
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录