Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
37630842
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6007
Star
91
Fork
164
代码
文件
提交
分支
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看板
提交
37630842
编写于
11月 18, 2023
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: 测试例兼容低分辨率设备
上级
74436c54
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
76 addition
and
69 deletion
+76
-69
pages/API/nodes-info/nodes-info.test.js
pages/API/nodes-info/nodes-info.test.js
+44
-40
pages/API/page-scroll-to/page-scroll-to.test.js
pages/API/page-scroll-to/page-scroll-to.test.js
+32
-29
未找到文件。
pages/API/nodes-info/nodes-info.test.js
浏览文件 @
37630842
const
PAGE_PATH
=
'
/pages/API/nodes-info/nodes-info
'
describe
(
'
nodes-info
'
,
()
=>
{
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
500
)
})
it
(
'
get-node-info
'
,
async
()
=>
{
const
btnGetNodeInfo
=
await
page
.
$
(
'
.btn-get-node-info
'
)
await
btnGetNodeInfo
.
tap
()
await
page
.
waitFor
(
50
)
const
PAGE_PATH
=
'
/pages/API/nodes-info/nodes-info
'
describe
(
'
nodes-info
'
,
()
=>
{
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
500
)
})
it
(
'
get-node-info
'
,
async
()
=>
{
const
btnGetNodeInfo
=
await
page
.
$
(
'
.btn-get-node-info
'
)
await
btnGetNodeInfo
.
tap
()
await
page
.
waitFor
(
50
)
const
data
=
await
page
.
data
()
const
nodeInfo
=
data
.
nodeInfoList
[
0
]
expect
(
nodeInfo
.
left
>
15
).
toBe
(
true
)
expect
(
nodeInfo
.
width
==
150
).
toBe
(
true
)
expect
(
nodeInfo
.
height
==
100
).
toBe
(
true
)
})
it
(
'
get-all-node-info
'
,
async
()
=>
{
const
btnGetAllNodeInfo
=
await
page
.
$
(
'
.btn-get-all-node-info
'
)
await
btnGetAllNodeInfo
.
tap
()
await
page
.
waitFor
(
50
)
const
data
=
await
page
.
data
()
const
nodeInfo1
=
data
.
nodeInfoList
[
0
]
expect
(
nodeInfo1
.
left
>
15
).
toBe
(
true
)
expect
(
nodeInfo1
.
top
>
220
).
toBe
(
true
)
expect
(
nodeInfo1
.
width
==
150
).
toBe
(
true
)
expect
(
nodeInfo1
.
height
==
100
).
toBe
(
true
)
const
nodeInfo2
=
data
.
nodeInfoList
[
1
]
expect
(
nodeInfo2
.
left
>
200
).
toBe
(
true
)
expect
(
nodeInfo2
.
top
>
220
).
toBe
(
true
)
expect
(
nodeInfo2
.
width
==
150
).
toBe
(
true
)
expect
(
nodeInfo2
.
height
==
100
).
toBe
(
true
)
})
// android 6 分辨率为 720*1280,需要调整期望数值
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android 6
'
))
{
const
nodeInfo
=
data
.
nodeInfoList
[
0
]
expect
(
nodeInfo
.
left
>
15
).
toBe
(
true
)
expect
(
nodeInfo
.
width
==
150
).
toBe
(
true
)
expect
(
nodeInfo
.
height
==
100
).
toBe
(
true
)
}
})
it
(
'
get-all-node-info
'
,
async
()
=>
{
const
btnGetAllNodeInfo
=
await
page
.
$
(
'
.btn-get-all-node-info
'
)
await
btnGetAllNodeInfo
.
tap
()
await
page
.
waitFor
(
50
)
const
data
=
await
page
.
data
()
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android 6
'
))
{
const
nodeInfo1
=
data
.
nodeInfoList
[
0
]
expect
(
nodeInfo1
.
left
>
15
).
toBe
(
true
)
expect
(
nodeInfo1
.
top
>
220
).
toBe
(
true
)
expect
(
nodeInfo1
.
width
==
150
).
toBe
(
true
)
expect
(
nodeInfo1
.
height
==
100
).
toBe
(
true
)
const
nodeInfo2
=
data
.
nodeInfoList
[
1
]
expect
(
nodeInfo2
.
left
>
200
).
toBe
(
true
)
expect
(
nodeInfo2
.
top
>
220
).
toBe
(
true
)
expect
(
nodeInfo2
.
width
==
150
).
toBe
(
true
)
expect
(
nodeInfo2
.
height
==
100
).
toBe
(
true
)
}
})
})
\ No newline at end of file
pages/API/page-scroll-to/page-scroll-to.test.js
浏览文件 @
37630842
const
PAGE_PATH
=
'
/pages/API/page-scroll-to/page-scroll-to
'
describe
(
'
page-scroll-to
'
,
()
=>
{
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
500
)
})
it
(
'
scroll-to
'
,
async
()
=>
{
const
btnScrollTo
=
await
page
.
$
(
'
.btn-scrollTo
'
)
await
btnScrollTo
.
tap
()
await
page
.
waitFor
(
300
)
const
scrollTop
=
await
page
.
scrollTop
()
// 设备精度问题,允许上下浮动 1px
expect
(
scrollTop
>
99
&&
scrollTop
<
101
).
toBe
(
true
)
})
it
(
'
scroll-to-element
'
,
async
()
=>
{
const
btnScrollTo
=
await
page
.
$
(
'
.btn-scrollToElement
'
)
const
scrollToElement
=
await
page
.
$
(
'
.custom-element
'
)
await
btnScrollTo
.
tap
()
await
page
.
waitFor
(
300
)
const
offset
=
await
scrollToElement
.
offset
()
expect
(
offset
.
top
>=
1188
).
toBe
(
true
)
})
const
PAGE_PATH
=
'
/pages/API/page-scroll-to/page-scroll-to
'
describe
(
'
page-scroll-to
'
,
()
=>
{
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
500
)
})
it
(
'
scroll-to
'
,
async
()
=>
{
const
btnScrollTo
=
await
page
.
$
(
'
.btn-scrollTo
'
)
await
btnScrollTo
.
tap
()
await
page
.
waitFor
(
300
)
const
scrollTop
=
await
page
.
scrollTop
()
// 设备精度问题,允许上下浮动 1px
expect
(
scrollTop
>
99
&&
scrollTop
<
101
).
toBe
(
true
)
})
it
(
'
scroll-to-element
'
,
async
()
=>
{
const
btnScrollTo
=
await
page
.
$
(
'
.btn-scrollToElement
'
)
const
scrollToElement
=
await
page
.
$
(
'
.custom-element
'
)
await
btnScrollTo
.
tap
()
await
page
.
waitFor
(
300
)
const
offset
=
await
scrollToElement
.
offset
()
// android 6 分辨率为 720*1280,需要调整期望数值
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android 6
'
))
{
expect
(
offset
.
top
>=
1188
).
toBe
(
true
)
}
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录