From c902f1f885bf5c0f722b1e3990fd2296d6393c51 Mon Sep 17 00:00:00 2001 From: wangyaqi Date: Wed, 6 Mar 2024 11:18:35 +0800 Subject: [PATCH] =?UTF-8?q?test:=20web=E7=AB=AF=E5=90=AF=E7=94=A8=E5=90=B8?= =?UTF-8?q?=E9=A1=B6=E6=B5=8B=E8=AF=95=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sticky-header/sticky-header.test.js | 31 ++++------ .../sticky-section/sticky-section.test.js | 61 +++++++++---------- 2 files changed, 40 insertions(+), 52 deletions(-) diff --git a/pages/component/sticky-header/sticky-header.test.js b/pages/component/sticky-header/sticky-header.test.js index ba8674e4..17e3d41a 100644 --- a/pages/component/sticky-header/sticky-header.test.js +++ b/pages/component/sticky-header/sticky-header.test.js @@ -1,21 +1,14 @@ describe('component-native-sticky-header', () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { - let page - beforeAll(async () => { - page = await program.reLaunch('/pages/component/sticky-header/sticky-header') - await page.waitFor('sticky-header') - }) + let page + beforeAll(async () => { + page = await program.reLaunch('/pages/component/sticky-header/sticky-header') + await page.waitFor('sticky-header') + }) - //检测吸顶效果 - it('check_sticky_header', async () => { - await page.callMethod('confirm_scroll_top_input', 600) - const image = await program.screenshot(); - expect(image).toMatchImageSnapshot(); - }) - } else { - // TODO: web 端暂不支持 - it('web', async () => { - expect(1).toBe(1) - }) - } -}) \ No newline at end of file + //检测吸顶效果 + it('check_sticky_header', async () => { + await page.callMethod('confirm_scroll_top_input', 600) + const image = await program.screenshot(); + expect(image).toMatchImageSnapshot(); + }) +}) diff --git a/pages/component/sticky-section/sticky-section.test.js b/pages/component/sticky-section/sticky-section.test.js index 6487cb14..378af0a4 100644 --- a/pages/component/sticky-section/sticky-section.test.js +++ b/pages/component/sticky-section/sticky-section.test.js @@ -1,37 +1,32 @@ describe('component-native-sticky-section', () => { - if (process.env.uniTestPlatformInfo.startsWith('android')) { - let page - beforeAll(async () => { - page = await program.reLaunch('/pages/component/sticky-section/sticky-section') - await page.waitFor('sticky-section') - }) + let page + beforeAll(async () => { + page = await program.reLaunch('/pages/component/sticky-section/sticky-section') + await page.waitFor('sticky-section') + }) - //检测吸顶上推效果 - it('check_sticky_section', async () => { - await page.callMethod('listViewScrollByY', 1000) - const image = await program.screenshot(); - expect(image).toMatchImageSnapshot(); - }) - - it('check_goto_sticky_header', async () => { - //滚动回顶部 - await page.callMethod('toTop') - page.waitFor(100) - await page.setData({ - scrolling: 'true' - }) - //跳转到id为C的StickyHeader位置 - await page.callMethod('gotoStickyHeader', 'C') - await page.waitFor(async () => { - return await page.data('scrolling') === false; - }); - const image = await program.screenshot(); - expect(image).toMatchImageSnapshot(); - }) - } else { - // TODO: web 端暂不支持 - it('web', async () => { - expect(1).toBe(1) + //检测吸顶上推效果 + it('check_sticky_section', async () => { + await page.callMethod('listViewScrollByY', 1000) + const image = await program.screenshot(); + expect(image).toMatchImageSnapshot(); + }) + + it('check_goto_sticky_header', async () => { + //滚动回顶部 + await page.callMethod('toTop') + page.waitFor(100) + await page.setData({ + scrolling: 'true' }) - } + if (process.env.uniTestPlatformInfo.startsWith('android')) { + //跳转到id为C的StickyHeader位置 + await page.callMethod('gotoStickyHeader', 'C') + } + await page.waitFor(async () => { + return await page.data('scrolling') === false; + }); + const image = await program.screenshot(); + expect(image).toMatchImageSnapshot(); + }) }) -- GitLab