diff --git a/pages/component/scroll-view/scroll-view-props.test.js b/pages/component/scroll-view/scroll-view-props.test.js index 9506178bc0c3fa554b87fa184b7c1324f50fb159..e4066d0f0af568e58598474e5aeedec85b462cd3 100644 --- a/pages/component/scroll-view/scroll-view-props.test.js +++ b/pages/component/scroll-view/scroll-view-props.test.js @@ -1,6 +1,6 @@ // uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ -describe('component-native-scroll-view', () => { +describe('component-native-scroll-view-props', () => { let page; beforeAll(async () => { @@ -82,4 +82,15 @@ describe('component-native-scroll-view', () => { expect(scrollLeft-930).toBeGreaterThanOrEqual(0) }) + //截图对比 + it('scroll-view-props-screenshot', async () => { + //禁止滚动条 + await page.setData({ + showScrollbar: false + }) + await page.waitFor(300); + const image = await program.screenshot(); + expect(image).toMatchImageSnapshot(); + }) + }); diff --git a/pages/component/scroll-view/scroll-view-refresher.test.js b/pages/component/scroll-view/scroll-view-refresher.test.js index 27e8473e70df2355bac08427bf5f1754d65fb6b9..99c34fea64d0834c93afc7271aedd0ad65b78696 100644 --- a/pages/component/scroll-view/scroll-view-refresher.test.js +++ b/pages/component/scroll-view/scroll-view-refresher.test.js @@ -1,13 +1,22 @@ // uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ -describe('test title', () => { +describe('component-native-scroll-view-refresher', () => { if (process.env.uniTestPlatformInfo.startsWith('android')) { let page; beforeAll(async () => { page = await program.reLaunch('/pages/component/scroll-view/scroll-view-refresher'); await page.waitFor(300); }); - + + it('scroll-view-refresher-screenshot', async () => { + //禁止滚动条 + await page.setData({ + showScrollbar: false + }) + await page.waitFor(300); + const image = await program.screenshot(); + expect(image).toMatchImageSnapshot(); + }) it('check_refresher', async () => { await page.setData({ diff --git a/pages/component/scroll-view/scroll-view-refresher.uvue b/pages/component/scroll-view/scroll-view-refresher.uvue index ee42cb325aa775811a21b88414f385b2f9d07bd7..d92f76d9681b4f2a74a9ba0c4542d722c3ac3cba 100644 --- a/pages/component/scroll-view/scroll-view-refresher.uvue +++ b/pages/component/scroll-view/scroll-view-refresher.uvue @@ -3,7 +3,7 @@ + @refresherpulling="onRefresherpulling" @scrolltolower="onScrolltolower" :show-scrollbar="showScrollbar"> {{key}} @@ -18,7 +18,8 @@ return { scrollData: [] as Array, refresherTriggered: false, - refresherrefresh: false + refresherrefresh: false, + showScrollbar: true }; }, onLoad() { diff --git a/pages/component/scroll-view/scroll-view.test.js b/pages/component/scroll-view/scroll-view.test.js new file mode 100644 index 0000000000000000000000000000000000000000..cc85304be14e4360d22e9f7f533a1254b1c4d57a --- /dev/null +++ b/pages/component/scroll-view/scroll-view.test.js @@ -0,0 +1,18 @@ +describe('component-native-scroll-view', () => { + let page; + beforeAll(async () => { + page = await program.reLaunch('/pages/component/scroll-view/scroll-view'); + await page.waitFor(300); + }); + + + it('scroll-view-screenshot', async () => { + //禁止滚动条 + await page.setData({ + showScrollbar: false + }) + await page.waitFor(300); + const image = await program.screenshot(); + expect(image).toMatchImageSnapshot(); + }); +}); diff --git a/pages/component/scroll-view/scroll-view.uvue b/pages/component/scroll-view/scroll-view.uvue index ce6670c9e87ef164d0d61223b7738b7bd47bb6ca..4a24f6f13d4918c194754fc67ba225e2a02c83db 100644 --- a/pages/component/scroll-view/scroll-view.uvue +++ b/pages/component/scroll-view/scroll-view.uvue @@ -11,7 +11,7 @@ + @scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll" :show-scrollbar="showScrollbar"> A B C @@ -26,7 +26,7 @@ 横向滚动 - + A B C @@ -70,6 +70,7 @@ return { scrollTop: 0, oldScrollTop: 0, + showScrollbar: true } }, methods: { diff --git a/pages/pages.test.js b/pages/pages.test.js index e5b35a336a016bd5b1b092f748a8915de0975710..a90a6d9f938b607360e7f1ef095b559b75c45b8a 100755 --- a/pages/pages.test.js +++ b/pages/pages.test.js @@ -22,10 +22,7 @@ const pages = [ '/pages/component/rich-text/rich-text-tags', '/pages/component/rich-text/rich-text', '/pages/component/scroll-view/scroll-view-custom-refresher-props', - '/pages/component/scroll-view/scroll-view-props', '/pages/component/scroll-view/scroll-view-refresher-props', - '/pages/component/scroll-view/scroll-view-refresher', - '/pages/component/scroll-view/scroll-view', '/pages/component/slider/slider', '/pages/component/slider-100/slider-100', '/pages/component/swiper/swiper',