diff --git a/pages/component/sticky-header/sticky-header.test.js b/pages/component/sticky-header/sticky-header.test.js index ba8674e46415574292be58f432722802caea86cc..17e3d41a3e8b9d48fb3143388f530c977f22bd47 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 6487cb140375f7c49f4614ab084f74ae147b2882..378af0a434fdd1daf821df5ed41c61d3bca8049c 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(); + }) })