From ef4b31e0dae2120dddd654664f4c47e21822b2a7 Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Fri, 24 May 2024 15:42:32 +0800 Subject: [PATCH] =?UTF-8?q?test(pulldown=20refresh):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E5=88=B7=E6=96=B0=E7=A4=BA=E4=BE=8B=E5=B9=B6?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pull-down-refresh.test.js | 33 ++++ .../pull-down-refresh/pull-down-refresh.uvue | 156 +++++++++--------- 2 files changed, 114 insertions(+), 75 deletions(-) create mode 100644 pages/API/pull-down-refresh/pull-down-refresh.test.js diff --git a/pages/API/pull-down-refresh/pull-down-refresh.test.js b/pages/API/pull-down-refresh/pull-down-refresh.test.js new file mode 100644 index 00000000..0dac9515 --- /dev/null +++ b/pages/API/pull-down-refresh/pull-down-refresh.test.js @@ -0,0 +1,33 @@ +const PAGE_PATH = "/pages/API/pull-down-refresh/pull-down-refresh" + +describe("payment", () => { + if (process.env.uniTestPlatformInfo.indexOf('web') > -1 || process.env.UNI_AUTOMATOR_APP_WEBVIEW === 'true') { + it('web || app-webview', () => { + expect(1).toBe(1) + }) + return + } + + it("trigger pulldown refresh by swipe", async () => { + const page = await program.navigateTo(PAGE_PATH) + await page.waitFor('view') + await page.waitFor(4000) + await page.setData({ + pulldownRefreshTriggered: false + }) + + await program.swipe({ + startPoint: { + x: 100, + y: 400 + }, + endPoint: { + x: 100, + y: 800 + }, + duration: 1000 + }) + await page.waitFor(1500) + expect(await page.data('pulldownRefreshTriggered')).toBe(true) + }); +}); diff --git a/pages/API/pull-down-refresh/pull-down-refresh.uvue b/pages/API/pull-down-refresh/pull-down-refresh.uvue index b2bb6ae5..8b4c83b6 100644 --- a/pages/API/pull-down-refresh/pull-down-refresh.uvue +++ b/pages/API/pull-down-refresh/pull-down-refresh.uvue @@ -1,76 +1,82 @@ - - - - -- GitLab