提交 5ba01433 编写于 作者: Anne_LXM's avatar Anne_LXM

test(scroll-view.test.js): 调整测试用例顺序,避免横向滚动deltaX受影响

上级 390f4d73
...@@ -3,17 +3,7 @@ describe('component-native-scroll-view', () => { ...@@ -3,17 +3,7 @@ describe('component-native-scroll-view', () => {
let page; let page;
beforeAll(async () => { beforeAll(async () => {
page = await program.reLaunch('/pages/component/scroll-view/scroll-view'); page = await program.reLaunch('/pages/component/scroll-view/scroll-view');
await page.waitFor(300); await page.waitFor("view");
});
it('scroll-view-screenshot', async () => {
//禁止滚动条
await page.setData({
showScrollbar: false
})
await page.waitFor(300);
const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot();
}); });
it('Event scroll-vertical',async()=>{ it('Event scroll-vertical',async()=>{
...@@ -34,12 +24,9 @@ describe('component-native-scroll-view', () => { ...@@ -34,12 +24,9 @@ describe('component-native-scroll-view', () => {
}) })
it('Event scroll-horizontal',async()=>{ it('Event scroll-horizontal',async()=>{
console.log('data-1:', await page.data())
// 横向滚动 // 横向滚动
await page.setData({scrollLeft:220}) await page.setData({scrollLeft:220})
const waitTime = process.env.uniTestPlatformInfo.includes('chrome') ? 4000:1000 await page.waitFor(1000)
await page.waitFor(waitTime)
console.log('data-2:', await page.data())
//设置left 是否触发scroll 事件 //设置left 是否触发scroll 事件
const leftScrollDetail = await page.data('scrollDetailTest') const leftScrollDetail = await page.data('scrollDetailTest')
console.log('leftScrollDetail:', leftScrollDetail) console.log('leftScrollDetail:', leftScrollDetail)
...@@ -54,6 +41,17 @@ describe('component-native-scroll-view', () => { ...@@ -54,6 +41,17 @@ describe('component-native-scroll-view', () => {
expect(await page.data('isScrollTest')).toBe('scroll:Success') expect(await page.data('isScrollTest')).toBe('scroll:Success')
}) })
// 移后:此测试用例在某些mac-chrome会影响scroll-horizontal的deltaX结果
it('scroll-view-screenshot', async () => {
//禁止滚动条
await page.setData({
showScrollbar: false
})
await page.waitFor(300);
const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot();
});
it('Event scrolltolower-滚动到底部/右边',async()=>{ it('Event scrolltolower-滚动到底部/右边',async()=>{
// 滚动到底部scrollTop:300,是否触发scrolltolower事件 // 滚动到底部scrollTop:300,是否触发scrolltolower事件
await page.setData({scrollTop: 300}) await page.setData({scrollTop: 300})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册