Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
9739c6b3
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6005
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看板
提交
9739c6b3
编写于
6月 12, 2024
作者:
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调整测试例:因事件event参数对象中存在循环引用,在ios端JSON.stringify报错,自动化测试无法page.data获取
上级
3bb18cf9
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
206 addition
and
131 deletion
+206
-131
pages/component/scroll-view/scroll-view-refresher.test.js
pages/component/scroll-view/scroll-view-refresher.test.js
+16
-11
pages/component/scroll-view/scroll-view-refresher.uvue
pages/component/scroll-view/scroll-view-refresher.uvue
+62
-15
pages/component/scroll-view/scroll-view.test.js
pages/component/scroll-view/scroll-view.test.js
+46
-76
pages/component/scroll-view/scroll-view.uvue
pages/component/scroll-view/scroll-view.uvue
+61
-7
pages/component/swiper/swiper.test.js
pages/component/swiper/swiper.test.js
+3
-3
pages/component/swiper/swiper.uvue
pages/component/swiper/swiper.uvue
+18
-19
未找到文件。
pages/component/scroll-view/scroll-view-refresher.test.js
浏览文件 @
9739c6b3
...
@@ -13,14 +13,6 @@ describe('component-native-scroll-view-refresher', () => {
...
@@ -13,14 +13,6 @@ describe('component-native-scroll-view-refresher', () => {
await
page
.
waitFor
(
300
);
await
page
.
waitFor
(
300
);
});
});
async
function
eventCheck
(
dataName
,
typeName
){
const
eventInfo
=
await
page
.
data
(
dataName
)
expect
(
eventInfo
.
type
).
toBe
(
typeName
)
expect
(
eventInfo
.
currentTarget
).
not
.
toBeFalsy
();
expect
(
eventInfo
.
target
).
not
.
toBeFalsy
();
expect
(
eventInfo
.
detail
.
dy
).
toBeGreaterThan
(
0
)
}
it
(
'
scroll-view-refresher-screenshot
'
,
async
()
=>
{
it
(
'
scroll-view-refresher-screenshot
'
,
async
()
=>
{
//禁止滚动条
//禁止滚动条
await
page
.
setData
({
await
page
.
setData
({
...
@@ -39,12 +31,25 @@ describe('component-native-scroll-view-refresher', () => {
...
@@ -39,12 +31,25 @@ describe('component-native-scroll-view-refresher', () => {
expect
(
await
page
.
data
(
'
refresherrefreshTimes
'
)).
toBe
(
1
)
expect
(
await
page
.
data
(
'
refresherrefreshTimes
'
)).
toBe
(
1
)
// 手动设置下拉刷新状态refresher-triggered为true时,在web和iOS不触发@refresherpulling事件
// 手动设置下拉刷新状态refresher-triggered为true时,在web和iOS不触发@refresherpulling事件
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)){
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)){
await
eventCheck
(
'
onRefresherpullingTest
'
,
'
refresherpulling
'
)
expect
(
await
page
.
data
(
'
onRefresherpullingTest
'
)).
toBe
(
'
refresherpulling:Success
'
)
}
}
await
eventCheck
(
'
refresherrefreshTest
'
,
'
refresherrefresh
'
)
expect
(
await
page
.
data
(
'
refresherrefreshTest
'
)).
toBe
(
'
refresherrefresh:Success
'
)
await
page
.
waitFor
(
1000
);
await
page
.
waitFor
(
1000
);
await
eventCheck
(
'
onRefresherrestoreTest
'
,
'
refresherrestore
'
)
expect
(
await
page
.
data
(
'
onRefresherrestoreTest
'
)).
toBe
(
'
refresherrestore:Success
'
)
});
// 仅App端支持手势下拉刷新
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)){
it
(
'
check_refresherabort
'
,
async
()
=>
{
await
program
.
swipe
({
startPoint
:
{
x
:
100
,
y
:
500
},
endPoint
:
{
x
:
100
,
y
:
630
},
duration
:
1000
})
await
page
.
waitFor
(
1500
)
expect
(
await
page
.
data
(
'
onRefresherabortTest
'
)).
toBe
(
'
refresherabort:Success
'
)
});
});
}
it
(
'
check_refresher_snapshot
'
,
async
()
=>
{
it
(
'
check_refresher_snapshot
'
,
async
()
=>
{
await
page
.
setData
({
await
page
.
setData
({
...
...
pages/component/scroll-view/scroll-view-refresher.uvue
浏览文件 @
9739c6b3
...
@@ -13,6 +13,12 @@
...
@@ -13,6 +13,12 @@
</view>
</view>
</template>
</template>
<script>
<script>
type RefresherEventTest = {
type: string;
target: UniElement | null;
currentTarget: UniElement | null;
dy:number;
}
export default {
export default {
data() {
data() {
return {
return {
...
@@ -21,11 +27,11 @@
...
@@ -21,11 +27,11 @@
refresherrefresh: false,
refresherrefresh: false,
refresherrefreshTimes: 0,
refresherrefreshTimes: 0,
showScrollbar: false,
showScrollbar: false,
// 自动化测试
// 自动化测试
使用
refresherrefreshTest:
null as RefresherEvent|null
,
refresherrefreshTest:
""
,
onRefresherabortTest:
null as RefresherEvent|null
,
onRefresherabortTest:
""
,
onRefresherrestoreTest:
null as RefresherEvent|null
,
onRefresherrestoreTest:
""
,
onRefresherpullingTest:
null as RefresherEvent|null
onRefresherpullingTest:
""
};
};
},
},
onLoad() {
onLoad() {
...
@@ -37,31 +43,72 @@
...
@@ -37,31 +43,72 @@
},
},
methods: {
methods: {
onRefresherrefresh(e :
RefresherEvent
) {
onRefresherrefresh(e :
UniRefresherEvent)
) {
this.refresherrefresh = true
this.refresherrefresh = true
console.log("onRefresherrefresh--------------下拉刷新触发")
console.log("onRefresherrefresh------下拉刷新触发")
this.refresherrefreshTest = e
this.checkEventTest({
type:e.type,
target:e.target,
currentTarget:e.currentTarget,
dy:e.detail.dy,
} as RefresherEventTest,'refresherrefresh')
this.refresherTriggered = true
this.refresherTriggered = true
this.refresherrefreshTimes++
this.refresherrefreshTimes++
setTimeout(() => {
setTimeout(() => {
this.refresherTriggered = false
this.refresherTriggered = false
}, 1500)
}, 1500)
},
},
onRefresherabort(e :
RefresherEvent
) {
onRefresherabort(e :
UniRefresherEvent)
) {
console.log("onRefresherabort------下拉刷新被中止")
console.log("onRefresherabort------下拉刷新被中止")
this.onRefresherabortTest = e
this.checkEventTest({
type:e.type,
target:e.target,
currentTarget:e.currentTarget,
dy:e.detail.dy,
} as RefresherEventTest,'refresherabort')
},
},
onRefresherrestore(e :
RefresherEvent
) {
onRefresherrestore(e :
UniRefresherEvent)
) {
this.refresherrefresh = false
this.refresherrefresh = false
console.log("onRefresherrestore------下拉刷新被复位")
console.log("onRefresherrestore------下拉刷新被复位")
this.onRefresherrestoreTest = e
this.checkEventTest({
type:e.type,
target:e.target,
currentTarget:e.currentTarget,
dy:e.detail.dy,
} as RefresherEventTest,'refresherrestore')
},
},
onRefresherpulling(e :
RefresherEvent
) {
onRefresherpulling(e :
UniRefresherEvent)
) {
console.log("onRefresherpulling------拉刷新控件被下拉-dy=" + e.detail.dy)
console.log("onRefresherpulling------拉刷新控件被下拉-dy=" + e.detail.dy)
this.onRefresherpullingTest = e
this.checkEventTest({
type:e.type,
target:e.target,
currentTarget:e.currentTarget,
dy:e.detail.dy,
} as RefresherEventTest,'refresherpulling')
},
},
onScrolltolower(e : ScrollToLowerEvent) {
onScrolltolower(e :
Uni
ScrollToLowerEvent) {
console.log("onScrolltolower 滚动到底部-----" + e.detail.direction)
console.log("onScrolltolower 滚动到底部-----" + e.detail.direction)
},
// 自动化测试专用(由于事件event参数对象中存在循环引用,在ios端JSON.stringify报错,自动化测试无法page.data获取)
checkEventTest(e:RefresherEventTest, eventName:String){
const isPass = e.type === eventName && e.target instanceof UniElement && e.currentTarget instanceof UniElement && e.dy>0;
const result = isPass ? `${eventName}:Success` : `${eventName}:Fail`;
switch (eventName){
case 'refresherrefresh':
this.refresherrefreshTest = result
break;
case 'refresherpulling':
this.onRefresherpullingTest = result
break;
case 'refresherrestore':
this.onRefresherrestoreTest = result
break;
case 'refresherabort':
this.onRefresherabortTest = result
break;
default:
break;
}
}
}
}
}
};
};
...
...
pages/component/scroll-view/scroll-view.test.js
浏览文件 @
9739c6b3
...
@@ -27,98 +27,68 @@ describe('component-native-scroll-view', () => {
...
@@ -27,98 +27,68 @@ describe('component-native-scroll-view', () => {
it
(
'
Event scroll-vertical
'
,
async
()
=>
{
it
(
'
Event scroll-vertical
'
,
async
()
=>
{
// 纵向滚动
// 纵向滚动
await
page
.
setData
({
scrollTop
:
100
})
await
page
.
setData
({
scrollTop
:
100
})
await
page
.
waitFor
(
600
)
await
page
.
waitFor
(
1000
)
//设置top 是否触发scroll 事件
// bug:在web端scroll事件event参数中detail类型报错
const
topScrollInfo
=
await
page
.
data
(
'
scrollTest
'
)
if
(
!
process
.
env
.
UNI_UTS_PLATFORM
.
startsWith
(
'
web
'
)){
// const topScrollResult = {
// 设置top 是否触发scroll 事件
// "scrollLeft": 0,
const
topScrollDetail
=
await
page
.
data
(
'
scrollDetailTest
'
)
// "scrollTop": 100,
expect
(
topScrollDetail
.
scrollLeft
).
toBe
(
0
)
// "scrollHeight": 450,
// "scrollWidth": 345,
// "deltaX": 0,
// "deltaY": -100
// }
const
{
scrollLeft
,
scrollTop
,
scrollHeight
,
scrollWidth
,
deltaX
,
deltaY
}
=
topScrollInfo
.
detail
expect
(
topScrollInfo
.
type
).
toBe
(
'
scroll
'
)
expect
(
scrollLeft
).
toBe
(
0
)
// Android 差异scrollTop:99.809525
// Android 差异scrollTop:99.809525
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)){
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)){
expect
(
scrollTop
).
toBe
(
100
)
expect
(
topScrollDetail
.
scrollTop
).
toBe
(
100
)
}
}
expect
(
scrollHeight
).
toBeGreaterThan
(
0
)
expect
(
topScrollDetail
.
scrollHeight
).
toBeGreaterThan
(
0
)
expect
(
scrollWidth
).
toBeGreaterThan
(
0
)
expect
(
topScrollDetail
.
scrollWidth
).
toBeGreaterThan
(
0
)
expect
(
deltaX
).
toBe
(
0
)
expect
(
topScrollDetail
.
deltaX
).
toBe
(
0
)
expect
(
deltaY
).
toBe
(
-
100
)
expect
(
topScrollDetail
.
deltaY
).
toBe
(
-
100
)
expect
(
topScrollInfo
.
currentTarget
).
not
.
toBeFalsy
();
expect
(
topScrollInfo
.
target
).
not
.
toBeFalsy
();
// expect(topScrollInfo.detail).toEqual(topScrollResult);
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)){
expect
(
topScrollInfo
.
timeStamp
).
toBeGreaterThan
(
0
)
}
}
expect
(
await
page
.
data
(
'
isScrollTest
'
)).
toBe
(
'
scroll:Success
'
)
})
})
it
(
'
Event scroll-horizontal
'
,
async
()
=>
{
it
(
'
Event scroll-horizontal
'
,
async
()
=>
{
// 横向滚动
// 横向滚动
console
.
log
(
'
scrollLeft
'
,
await
page
.
data
(
'
scrollLeft
'
))
await
page
.
setData
({
scrollLeft
:
220
})
await
page
.
setData
({
scrollLeft
:
220
})
await
page
.
waitFor
(
600
)
await
page
.
waitFor
(
600
)
if
(
!
process
.
env
.
UNI_UTS_PLATFORM
.
startsWith
(
'
web
'
)){
//设置left 是否触发scroll 事件
//设置left 是否触发scroll 事件
const
leftScrollInfo
=
await
page
.
data
(
'
scrollTest
'
)
const
leftScrollDetail
=
await
page
.
data
(
'
scrollDetailTest
'
)
// const leftScrollResult = {
// "scrollLeft": 220,
// "scrollTop": 0,
// "scrollHeight": 150,
// "scrollWidth": 1036,
// "deltaX": -100,
// "deltaY": 0
// }
const
{
scrollLeft
,
scrollTop
,
scrollHeight
,
scrollWidth
,
deltaX
,
deltaY
}
=
leftScrollInfo
.
detail
console
.
log
(
'
deltaX
'
,
deltaX
)
expect
(
leftScrollInfo
.
type
).
toBe
(
'
scroll
'
)
// Android 差异scrollLeft:219.80952
// Android 差异scrollLeft:219.80952
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)){
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)){
expect
(
scrollLeft
).
toBe
(
220
)
expect
(
leftScrollDetail
.
scrollLeft
).
toBe
(
220
)
}
}
expect
(
scrollTop
).
toBe
(
0
)
expect
(
leftScrollDetail
.
scrollTop
).
toBe
(
0
)
expect
(
scrollHeight
).
toBeGreaterThan
(
0
)
expect
(
leftScrollDetail
.
scrollHeight
).
toBeGreaterThan
(
0
)
expect
(
scrollWidth
).
toBeGreaterThan
(
0
)
expect
(
leftScrollDetail
.
scrollWidth
).
toBeGreaterThan
(
0
)
expect
(
deltaX
).
toBe
(
-
100
)
expect
(
leftScrollDetail
.
deltaX
).
toBe
(
-
100
)
expect
(
deltaY
).
toBe
(
0
)
expect
(
leftScrollDetail
.
deltaY
).
toBe
(
0
)
expect
(
leftScrollInfo
.
currentTarget
).
not
.
toBeFalsy
();
expect
(
leftScrollInfo
.
target
).
not
.
toBeFalsy
();
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)){
expect
(
leftScrollInfo
.
timeStamp
).
toBeGreaterThan
(
0
)
}
}
expect
(
await
page
.
data
(
'
isScrollTest
'
)).
toBe
(
'
scroll:Success
'
)
})
})
it
(
'
Event scrolltolower-滚动到底部/右边
'
,
async
()
=>
{
it
(
'
Event scrolltolower-滚动到底部/右边
'
,
async
()
=>
{
// 滚动到底部scrollTop:300,
// 滚动到底部scrollTop:300,
是否触发scrolltolower事件
await
page
.
setData
({
scrollTop
:
300
})
await
page
.
setData
({
scrollTop
:
300
})
await
page
.
waitFor
(
600
)
await
page
.
waitFor
(
600
)
//设置top 是否触发scrolltolower事件
expect
(
await
page
.
data
(
'
isScrolltolowerTest
'
)).
toBe
(
'
scrolltolower:Success-bottom
'
)
const
toLowerInfo
=
await
page
.
data
(
'
toLowerTest
'
)
expect
(
toLowerInfo
.
type
).
toBe
(
'
scrolltolower
'
)
expect
(
toLowerInfo
.
detail
.
direction
).
toBe
(
'
bottom
'
)
expect
(
toLowerInfo
.
currentTarget
).
not
.
toBeFalsy
();
expect
(
toLowerInfo
.
target
).
not
.
toBeFalsy
();
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)){
expect
(
toLowerInfo
.
timeStamp
).
toBeGreaterThan
(
0
)
}
})
})
it
(
'
Event scrolltoupper-滚动到顶部/左边
'
,
async
()
=>
{
it
(
'
Event scrolltoupper-滚动到顶部/左边
'
,
async
()
=>
{
// 滚动到顶部scrollTop: 0,
// 滚动到顶部scrollTop: 0,
是否触发scrolltoupper事件
//
await page.setData({scrollTop: 0})
await
page
.
setData
({
scrollTop
:
0
})
await
page
.
callMethod
(
'
goTop
'
)
//
await page.callMethod('goTop')
await
page
.
waitFor
(
600
)
await
page
.
waitFor
(
600
)
//设置top 是否触发scrolltoupper事件
expect
(
await
page
.
data
(
'
isScrolltoupperTest
'
)).
toBe
(
'
scrolltoupper:Success-top
'
)
const
toUpperInfo
=
await
page
.
data
(
'
toUpperTest
'
)
expect
(
toUpperInfo
.
type
).
toBe
(
'
scrolltoupper
'
)
expect
(
toUpperInfo
.
detail
.
direction
).
toBe
(
'
top
'
)
expect
(
toUpperInfo
.
currentTarget
).
not
.
toBeFalsy
();
expect
(
toUpperInfo
.
target
).
not
.
toBeFalsy
();
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)){
expect
(
toUpperInfo
.
timeStamp
).
toBeGreaterThan
(
0
)
}
})
})
if
(
!
process
.
env
.
UNI_UTS_PLATFORM
.
startsWith
(
'
web
'
)){
it
(
'
Event scrollend-滚动结束时触发仅App端支持
'
,
async
()
=>
{
const
endDetail
=
await
page
.
data
(
'
scrollEndDetailTest
'
)
expect
(
endDetail
.
scrollLeft
).
toBe
(
0
)
expect
(
endDetail
.
scrollTop
).
toBe
(
0
)
expect
(
endDetail
.
deltaY
).
toBe
(
0
)
expect
(
endDetail
.
deltaX
).
toBe
(
0
)
expect
(
endDetail
.
scrollHeight
).
toBeGreaterThan
(
0
)
expect
(
endDetail
.
scrollWidth
).
toBeGreaterThan
(
0
)
})
}
});
});
pages/component/scroll-view/scroll-view.uvue
浏览文件 @
9739c6b3
...
@@ -63,6 +63,12 @@
...
@@ -63,6 +63,12 @@
<!-- #endif -->
<!-- #endif -->
</template>
</template>
<script lang="uts">
<script lang="uts">
type ScrollEventTest = {
type: string;
target: UniElement | null;
currentTarget: UniElement | null;
direction?:string
}
export default {
export default {
data() {
data() {
return {
return {
...
@@ -71,26 +77,56 @@
...
@@ -71,26 +77,56 @@
scrollLeft:120,
scrollLeft:120,
showScrollbar: true,
showScrollbar: true,
// 自动化测试
// 自动化测试
scrollTest:null as ScrollEvent|null,
isScrollTest:'',
toUpperTest:null as ScrollToUpperEvent|null,
isScrolltolowerTest:'',
toLowerTest:null as ScrollToLowerEvent|null
isScrolltoupperTest:'',
// 在web端scroll事件event参数中detail类型报错,先条件编译处理
// #ifndef WEB
scrollDetailTest:null as UniScrollEventDetail|null,
scrollEndDetailTest:null as UniScrollEventDetail|null,
// #endif
}
}
},
},
methods: {
methods: {
upper: function (e : UniScrollToUpperEvent) {
upper: function (e : UniScrollToUpperEvent) {
console.log('滚动到顶部/左边',e)
console.log('滚动到顶部/左边',e)
this.toUpperTest = e
this.checkEventTest({
type:e.type,
target:e.target,
currentTarget:e.currentTarget,
direction:e.detail.direction,
} as ScrollEventTest,'scrolltoupper')
},
},
lower: function (e : UniScrollToLowerEvent) {
lower: function (e : UniScrollToLowerEvent) {
console.log('滚动到底部/右边',e)
console.log('滚动到底部/右边',e)
this.toLowerTest = e
this.checkEventTest({
type:e.type,
target:e.target,
currentTarget:e.currentTarget,
direction:e.detail.direction,
} as ScrollEventTest,'scrolltolower')
},
},
scroll: function (e : UniScrollEvent) {
scroll: function (e : UniScrollEvent) {
this.scrollTest = e
// #ifndef WEB
this.scrollDetailTest = e.detail
// #endif
this.checkEventTest({
type:e.type,
target:e.target,
currentTarget:e.currentTarget
} as ScrollEventTest,'scroll')
this.oldScrollTop = e.detail.scrollTop
this.oldScrollTop = e.detail.scrollTop
},
},
end: function (e : UniScrollEvent){
end: function (e : UniScrollEvent){
console.log('滚动结束时触发',e)
console.log('滚动结束时触发',e)
// #ifndef WEB
this.scrollEndDetailTest = e.detail
// #endif
this.checkEventTest({
type:e.type,
target:e.target,
currentTarget:e.currentTarget
} as ScrollEventTest,'scrollend')
},
},
goTop: function () {
goTop: function () {
// 解决view层不同步的问题
// 解决view层不同步的问题
...
@@ -102,8 +138,26 @@
...
@@ -102,8 +138,26 @@
icon: 'none',
icon: 'none',
title: '纵向滚动 scrollTop 值已被修改为 0',
title: '纵向滚动 scrollTop 值已被修改为 0',
})
})
},
// 自动化测试专用(由于事件event参数对象中存在循环引用,在ios端JSON.stringify报错,自动化测试无法page.data获取)
checkEventTest(e:ScrollEventTest, eventName:String){
const isPass = e.type === eventName && e.target instanceof UniElement && e.currentTarget instanceof UniElement;
const result = isPass ? `${eventName}:Success` : `${eventName}:Fail`;
switch (eventName){
case 'scroll':
this.isScrollTest = result
break;
case 'scrolltolower':
this.isScrolltolowerTest = result + `-${e.direction}`
break;
case 'scrolltoupper':
this.isScrolltoupperTest = result + `-${e.direction}`
break;
default:
break;
}
}
},
},
},
}
}
</script>
</script>
...
...
pages/component/swiper/swiper.test.js
浏览文件 @
9739c6b3
...
@@ -98,7 +98,7 @@ describe('test swiper', () => {
...
@@ -98,7 +98,7 @@ describe('test swiper', () => {
expect
(
transitionDetailInfo
.
dy
).
toBe
(
0
)
expect
(
transitionDetailInfo
.
dy
).
toBe
(
0
)
}
}
expect
(
transitionDetailInfo
.
dx
).
not
.
toBe
(
0
)
expect
(
transitionDetailInfo
.
dx
).
not
.
toBe
(
0
)
expect
(
await
page
.
data
(
'
isTransitionTest
'
)).
toBe
(
'
transition:
Pa
ss
'
)
expect
(
await
page
.
data
(
'
isTransitionTest
'
)).
toBe
(
'
transition:
Succe
ss
'
)
}
}
});
});
...
@@ -110,7 +110,7 @@ describe('test swiper', () => {
...
@@ -110,7 +110,7 @@ describe('test swiper', () => {
}
else
{
}
else
{
expect
(
changeDetailInfo
).
toEqual
(
appDetailRes
)
expect
(
changeDetailInfo
).
toEqual
(
appDetailRes
)
}
}
expect
(
await
page
.
data
(
'
isChangeTest
'
)).
toBe
(
'
change:
Pa
ss
'
)
expect
(
await
page
.
data
(
'
isChangeTest
'
)).
toBe
(
'
change:
Succe
ss
'
)
}
}
});
});
...
@@ -124,7 +124,7 @@ describe('test swiper', () => {
...
@@ -124,7 +124,7 @@ describe('test swiper', () => {
}
else
{
}
else
{
expect
(
animationfinishDetailInfo
).
toEqual
(
appDetailRes
)
expect
(
animationfinishDetailInfo
).
toEqual
(
appDetailRes
)
}
}
expect
(
await
page
.
data
(
'
isAnimationfinishTest
'
)).
toBe
(
'
animationfinish:
Pa
ss
'
)
expect
(
await
page
.
data
(
'
isAnimationfinishTest
'
)).
toBe
(
'
animationfinish:
Succe
ss
'
)
}
}
});
});
});
});
pages/component/swiper/swiper.uvue
浏览文件 @
9739c6b3
...
@@ -129,24 +129,6 @@
...
@@ -129,24 +129,6 @@
}
}
},
},
methods: {
methods: {
// 自动化测试专用(由于事件event参数对象中存在循环引用,在ios端JSON.stringify报错,自动化测试无法page.data获取)
checkEventTest(e:SwiperEventTest, eventName:String){
const isPass = e.type === eventName && e.target instanceof UniElement && e.currentTarget instanceof UniElement;
const result = isPass ? `${eventName}:Pass` : `${eventName}:NoPass`;
switch (eventName){
case 'change':
this.isChangeTest = result
break;
case 'transition':
this.isTransitionTest = result
break;
case 'animationfinish':
this.isAnimationfinishTest = result
break;
default:
break;
}
},
swiperChange: function (e : UniSwiperChangeEvent) {
swiperChange: function (e : UniSwiperChangeEvent) {
// #ifndef APP-ANDROID
// #ifndef APP-ANDROID
this.changeDetailTest = e.detail
this.changeDetailTest = e.detail
...
@@ -191,7 +173,24 @@
...
@@ -191,7 +173,24 @@
console.log(e)
console.log(e)
}
}
},
},
// 自动化测试专用(由于事件event参数对象中存在循环引用,在ios端JSON.stringify报错,自动化测试无法page.data获取)
checkEventTest(e:SwiperEventTest, eventName:String){
const isPass = e.type === eventName && e.target instanceof UniElement && e.currentTarget instanceof UniElement;
const result = isPass ? `${eventName}:Success` : `${eventName}:Fail`;
switch (eventName){
case 'change':
this.isChangeTest = result
break;
case 'transition':
this.isTransitionTest = result
break;
case 'animationfinish':
this.isAnimationfinishTest = result
break;
default:
break;
}
},
dotsChange: function (e : UniSwitchChangeEvent) {
dotsChange: function (e : UniSwitchChangeEvent) {
this.dotsSelect = e.detail.value
this.dotsSelect = e.detail.value
},
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录