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

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

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