From d20a28c224207b458bba9684582014979d4b5872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=BA=9A=E7=90=AA?= Date: Thu, 25 Apr 2024 15:04:12 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E6=8B=89=E5=88=B7=E6=96=B0=E5=B9=B6?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E4=B8=8B=E6=8B=89=E5=88=B7=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 7 ++ .../get-current-pages.test.js | 13 +++ .../get-current-pages/get-current-pages.uvue | 5 +- ...ge-style-disable-pull-down-refresh.test.js | 35 +++++++ ...-page-style-disable-pull-down-refresh.uvue | 95 +++++++++++++++++++ 5 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js create mode 100644 pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.uvue diff --git a/pages.json b/pages.json index bf9311b2..213b2e91 100644 --- a/pages.json +++ b/pages.json @@ -365,6 +365,13 @@ "enablePullDownRefresh": true } }, + { + "path": "pages/API/get-current-pages/set-page-style-disable-pull-down-refresh", + "style": { + "navigationBarTitleText": "setPageStyle pull default false", + "enablePullDownRefresh": false + } + }, { "path": "pages/API/get-launch-options-sync/get-launch-options-sync", "style": { diff --git a/pages/API/get-current-pages/get-current-pages.test.js b/pages/API/get-current-pages/get-current-pages.test.js index 7825d152..31a6c0a3 100644 --- a/pages/API/get-current-pages/get-current-pages.test.js +++ b/pages/API/get-current-pages/get-current-pages.test.js @@ -40,5 +40,18 @@ describe('getCurrentPages', () => { await page.waitFor(200) const isEnablePullDownRefresh2 = (await page.data()).currentPageStyle.enablePullDownRefresh expect(isEnablePullDownRefresh2).toBe(false) + + await page.callMethod('startPullDownRefresh') + await page.waitFor(500) + const image2 = await program.screenshot({fullPage: true}); + expect(image2).toSaveImageSnapshot(); + + await page.waitFor(3500) + await page.callMethod('setPageStyle', true) + await page.waitFor(200) + await page.callMethod('startPullDownRefresh') + await page.waitFor(500) + const image3 = await program.screenshot({fullPage: true}); + expect(image3).toSaveImageSnapshot(); }) }) diff --git a/pages/API/get-current-pages/get-current-pages.uvue b/pages/API/get-current-pages/get-current-pages.uvue index faced3e1..34e3c924 100644 --- a/pages/API/get-current-pages/get-current-pages.uvue +++ b/pages/API/get-current-pages/get-current-pages.uvue @@ -75,7 +75,10 @@ enablePullDownRefresh: enable }); this.enablePullDownRefreshStatus = enable - }, + }, + startPullDownRefresh() { + uni.startPullDownRefresh() + } // getCurrentPage(): Page { // const pages = getCurrentPages(); // const currentPage = pages[pages.length - 1]; diff --git a/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js b/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js new file mode 100644 index 00000000..bf0ba6e3 --- /dev/null +++ b/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js @@ -0,0 +1,35 @@ +const PAGE_PATH = '/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh' + +describe('getCurrentPages', () => { + let page + it('page-style', async () => { + page = await program.navigateTo(PAGE_PATH) + + await page.callMethod('getPageStyle') + await page.waitFor(200) + const isEnablePullDownRefresh1 = (await page.data()).currentPageStyle.enablePullDownRefresh + expect(isEnablePullDownRefresh1).toBe(false) + + await page.callMethod('setPageStyle', true) + await page.waitFor(200) + await page.callMethod('getPageStyle') + await page.waitFor(200) + const isEnablePullDownRefresh2 = (await page.data()).currentPageStyle.enablePullDownRefresh + expect(isEnablePullDownRefresh2).toBe(true) + await page.callMethod('startPullDownRefresh') + await page.waitFor(500) + const image3 = await program.screenshot({fullPage: true}); + expect(image3).toSaveImageSnapshot(); + + await page.waitFor(3500) + + // setPageStyle + await page.callMethod('setPageStyle', false) + await page.waitFor(200) + await page.callMethod('startPullDownRefresh') + await page.waitFor(500) + const image2 = await program.screenshot({fullPage: true}); + expect(image2).toSaveImageSnapshot(); + + }) +}) diff --git a/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.uvue b/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.uvue new file mode 100644 index 00000000..84a18c03 --- /dev/null +++ b/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.uvue @@ -0,0 +1,95 @@ + + + + + + -- GitLab