sticky-section.test.js 1.1 KB
Newer Older
shutao-dc's avatar
shutao-dc 已提交
1
describe('component-native-sticky-section', () => {
DCloud-WZF's avatar
DCloud-WZF 已提交
2 3 4 5 6 7 8 9 10 11 12 13
  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')
    })

    //检测吸顶上推效果
    it('check_sticky_section', async () => {
      await page.callMethod('listViewScrollByY', 1000)
      const image = await program.screenshot();
      expect(image).toMatchImageSnapshot();
shutao-dc's avatar
shutao-dc 已提交
14 15 16 17 18 19
    })

    it('check_goto_sticky_header', async () => {
      //滚动回顶部
      await page.callMethod('toTop')
      page.waitFor(100)
20 21 22
      await page.setData({
          scrolling: 'true'
      })
shutao-dc's avatar
shutao-dc 已提交
23 24
      //跳转到id为C的StickyHeader位置
      await page.callMethod('gotoStickyHeader', 'C')
25 26 27
      await page.waitFor(async () => {
        return await page.data('scrolling') === false;
      });
shutao-dc's avatar
shutao-dc 已提交
28 29
      const image = await program.screenshot();
      expect(image).toMatchImageSnapshot();
DCloud-WZF's avatar
DCloud-WZF 已提交
30 31 32 33 34 35 36
    })
  } else {
    // TODO: web 端暂不支持
    it('web', async () => {
      expect(1).toBe(1)
    })
  }
shutao-dc's avatar
shutao-dc 已提交
37
})