提交 41d97af0 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

test(scroll-view): 调整测试例适配 android program.swipe 调整

上级 1b69fc33
// 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/
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase() const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isAndroid = platformInfo.startsWith('android') const isAndroid = platformInfo.startsWith('android')
const isIos = platformInfo.startsWith('ios') const isIos = platformInfo.startsWith('ios')
const isMP = platformInfo.startsWith('mp') const isMP = platformInfo.startsWith('mp')
describe('component-native-scroll-view-refresher', () => { describe('component-native-scroll-view-refresher', () => {
if (process.env.UNI_AUTOMATOR_APP_WEBVIEW) { if (process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
it('other platform', () => { it('other platform', () => {
...@@ -17,28 +17,28 @@ describe('component-native-scroll-view-refresher', () => { ...@@ -17,28 +17,28 @@ describe('component-native-scroll-view-refresher', () => {
}) })
return 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');
await page.waitFor(300); await page.waitFor(300);
}); });
it('scroll-view-refresher-screenshot', async () => { it('scroll-view-refresher-screenshot', async () => {
//禁止滚动条 //禁止滚动条
await page.setData({ await page.setData({
showScrollbar: false showScrollbar: false
}) })
await page.waitFor(300); await page.waitFor(300);
const image = await program.screenshot({fullPage: true}); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}) })
it('check_refresher_refresh_event', async () => { it('check_refresher_refresh_event', async () => {
await page.setData({ await page.setData({
refresherTriggered: true refresherTriggered: true
}) })
await page.waitFor(2000); await page.waitFor(2000);
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(isAndroid){ if(isAndroid){
...@@ -46,7 +46,7 @@ describe('component-native-scroll-view-refresher', () => { ...@@ -46,7 +46,7 @@ describe('component-native-scroll-view-refresher', () => {
expect(await page.data('refresherrefreshTest')).toBe('refresherrefresh:Success') expect(await page.data('refresherrefreshTest')).toBe('refresherrefresh:Success')
} }
await page.waitFor(2000); await page.waitFor(2000);
expect(await page.data('onRefresherrestoreTest')).toBe('refresherrestore:Success') expect(await page.data('onRefresherrestoreTest')).toBe('refresherrestore:Success')
}); });
// 仅App端支持手势下拉刷新,在不同设备上位置有差异可能导致不触发中止事件 // 仅App端支持手势下拉刷新,在不同设备上位置有差异可能导致不触发中止事件
...@@ -62,7 +62,7 @@ describe('component-native-scroll-view-refresher', () => { ...@@ -62,7 +62,7 @@ describe('component-native-scroll-view-refresher', () => {
}else if(isAndroid){ }else if(isAndroid){
await program.swipe({ await program.swipe({
startPoint: {x: 100,y: 400}, startPoint: {x: 100,y: 400},
endPoint: {x: 100,y: 500}, endPoint: {x: 100,y: 450},
duration: 1000 duration: 1000
}) })
} }
...@@ -74,13 +74,13 @@ describe('component-native-scroll-view-refresher', () => { ...@@ -74,13 +74,13 @@ describe('component-native-scroll-view-refresher', () => {
} }
}); });
} }
it('check_refresher_snapshot', async () => { it('check_refresher_snapshot', async () => {
await page.setData({ await page.setData({
refresherTriggered: true refresherTriggered: true
}) })
await page.waitFor(300); await page.waitFor(300);
const image = await program.screenshot({fullPage: true}); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}); });
}); });
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册