提交 c8da4d63 编写于 作者: 雪洛's avatar 雪洛

test: web端放开下拉刷新测试例

上级 2a608aed
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ // uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe('component-native-scroll-view-refresher', () => { describe('component-native-scroll-view-refresher', () => {
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) { if (!process.env.uniTestPlatformInfo.startsWith('android') && !process.env.uniTestPlatformInfo.startsWith('web') || process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
it('other platform', () => {
expect(1).toBe(1)
})
return
}
let page; let page;
beforeAll(async () => { beforeAll(async () => {
page = await program.reLaunch('/pages/component/scroll-view/scroll-view-refresher'); page = await program.reLaunch('/pages/component/scroll-view/scroll-view-refresher');
...@@ -22,12 +27,16 @@ describe('component-native-scroll-view-refresher', () => { ...@@ -22,12 +27,16 @@ describe('component-native-scroll-view-refresher', () => {
await page.setData({ await page.setData({
refresherTriggered: true refresherTriggered: true
}) })
await page.waitFor(2000); await page.waitFor(1000);
expect(await page.data('refresherrefresh')).toBe(true) expect(await page.data('refresherrefreshTimes')).toBe(1)
}); });
} else {
it('other platform', () => { it('check_refresher_snapshot', async () => {
expect(1).toBe(1) await page.setData({
refresherTriggered: true
}) })
} await page.waitFor(300);
const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot();
});
}); });
<template> <template>
<view class="container"> <view class="container">
<button @click="test">test</button>
<page-head title="scroll-view 下拉刷新"></page-head> <page-head title="scroll-view 下拉刷新"></page-head>
<scroll-view class="scroll" refresher-enabled=true :refresher-triggered="refresherTriggered" <scroll-view class="scroll" refresher-enabled=true :refresher-triggered="refresherTriggered"
@refresherrefresh="onRefresherrefresh" @refresherabort="onRefresherabort" @refresherrestore="onRefresherrestore" @refresherrefresh="onRefresherrefresh" @refresherabort="onRefresherabort" @refresherrestore="onRefresherrestore"
...@@ -19,6 +20,7 @@ ...@@ -19,6 +20,7 @@
scrollData: [] as Array<string>, scrollData: [] as Array<string>,
refresherTriggered: false, refresherTriggered: false,
refresherrefresh: false, refresherrefresh: false,
refresherrefreshTimes: 0,
showScrollbar: false showScrollbar: false
}; };
}, },
...@@ -31,10 +33,14 @@ ...@@ -31,10 +33,14 @@
}, },
methods: { methods: {
test() {
this.refresherTriggered = true
},
onRefresherrefresh(_ : RefresherEvent) { onRefresherrefresh(_ : RefresherEvent) {
this.refresherrefresh = true this.refresherrefresh = true
console.log("onRefresherrefresh--------------下拉刷新触发") console.log("onRefresherrefresh--------------下拉刷新触发")
this.refresherTriggered = true this.refresherTriggered = true
this.refresherrefreshTimes++
setTimeout(() => { setTimeout(() => {
this.refresherTriggered = false this.refresherTriggered = false
}, 1500) }, 1500)
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
</navigator> </navigator>
<view class="uni-common-pb"></view> <view class="uni-common-pb"></view>
<!-- #ifdef APP -->
<navigator url="/pages/component/scroll-view/scroll-view-refresher-props" hover-class="none"> <navigator url="/pages/component/scroll-view/scroll-view-refresher-props" hover-class="none">
<button type="primary" class="button"> <button type="primary" class="button">
下拉刷新的属性示例 下拉刷新的属性示例
...@@ -57,7 +56,6 @@ ...@@ -57,7 +56,6 @@
</button> </button>
</navigator> </navigator>
<view class="uni-common-pb"></view> <view class="uni-common-pb"></view>
<!-- #endif -->
</view> </view>
</view> </view>
<!-- #ifdef APP --> <!-- #ifdef APP -->
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册