From c8da4d63f28d1c8fda67c4f2b6a9f83a4888b739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=BA=9A=E7=90=AA?= Date: Tue, 30 Apr 2024 17:13:09 +0800 Subject: [PATCH] =?UTF-8?q?test:=20web=E7=AB=AF=E6=94=BE=E5=BC=80=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E5=88=B7=E6=96=B0=E6=B5=8B=E8=AF=95=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scroll-view/scroll-view-refresher.test.js | 61 +++++++++++-------- .../scroll-view/scroll-view-refresher.uvue | 6 ++ pages/component/scroll-view/scroll-view.uvue | 2 - 3 files changed, 41 insertions(+), 28 deletions(-) diff --git a/pages/component/scroll-view/scroll-view-refresher.test.js b/pages/component/scroll-view/scroll-view-refresher.test.js index ee54b2e6..2c4993cc 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 0b7000c6..0450e5bd 100644 --- a/pages/component/scroll-view/scroll-view-refresher.uvue +++ b/pages/component/scroll-view/scroll-view-refresher.uvue @@ -1,5 +1,6 @@