diff --git a/pages/component/scroll-view/scroll-view-refresher.test.js b/pages/component/scroll-view/scroll-view-refresher.test.js index ee54b2e6399648983aa02e994cc40944f1791ca8..2c4993cca795de1ffae0e9994b69e7f8070970f2 100644 --- a/pages/component/scroll-view/scroll-view-refresher.test.js +++ b/pages/component/scroll-view/scroll-view-refresher.test.js @@ -1,33 +1,42 @@ // 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) { - let page; - beforeAll(async () => { - page = await program.reLaunch('/pages/component/scroll-view/scroll-view-refresher'); - await page.waitFor(300); - }); +describe('component-native-scroll-view-refresher', () => { + 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'); + await page.waitFor(300); + }); - it('scroll-view-refresher-screenshot', async () => { - //禁止滚动条 - await page.setData({ - showScrollbar: false - }) - await page.waitFor(300); - const image = await program.screenshot({fullPage: true}); - expect(image).toSaveImageSnapshot(); + it('scroll-view-refresher-screenshot', async () => { + //禁止滚动条 + await page.setData({ + showScrollbar: false }) + await page.waitFor(300); + const image = await program.screenshot({fullPage: true}); + expect(image).toSaveImageSnapshot(); + }) - it('check_refresher', async () => { - await page.setData({ - refresherTriggered: true - }) - await page.waitFor(2000); - expect(await page.data('refresherrefresh')).toBe(true) - }); - } else { - it('other platform', () => { - expect(1).toBe(1) + it('check_refresher', async () => { + await page.setData({ + refresherTriggered: true }) - } + await page.waitFor(1000); + expect(await page.data('refresherrefreshTimes')).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(); + }); }); diff --git a/pages/component/scroll-view/scroll-view-refresher.uvue b/pages/component/scroll-view/scroll-view-refresher.uvue index 0b7000c66c33d11d2e8c736fe5bd1adcc32135b8..0450e5bd74749b658315d06652a92243c3477538 100644 --- a/pages/component/scroll-view/scroll-view-refresher.uvue +++ b/pages/component/scroll-view/scroll-view-refresher.uvue @@ -1,5 +1,6 @@