sticky-section.test.js 1.2 KB
Newer Older
shutao-dc's avatar
shutao-dc 已提交
1
describe('component-native-sticky-section', () => {
雪洛's avatar
雪洛 已提交
2 3 4 5 6
  let page
  beforeAll(async () => {
    page = await program.reLaunch('/pages/component/sticky-section/sticky-section')
    await page.waitFor('sticky-section')
  })
DCloud-WZF's avatar
DCloud-WZF 已提交
7

雪洛's avatar
雪洛 已提交
8
  //检测吸顶上推效果
9 10
  it('check_sticky_section', async () => {
    page.waitFor(300)
雪洛's avatar
雪洛 已提交
11
    await page.callMethod('listViewScrollByY', 1000)
12
    const image = await program.screenshot({fullPage: true});
13 14 15
    expect(image).toSaveImageSnapshot();
  })

16
  if (process.env.uniTestPlatformInfo.startsWith('web') || process.env.UNI_AUTOMATOR_APP_WEBVIEW === 'true') {
17
    return
18
  }
雪洛's avatar
雪洛 已提交
19 20 21 22 23 24 25

  it('check_goto_sticky_header', async () => {
    //滚动回顶部
    await page.callMethod('toTop')
    page.waitFor(100)
    await page.setData({
      scrolling: 'true'
DCloud-WZF's avatar
DCloud-WZF 已提交
26
    })
27
    if (!process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
雪洛's avatar
雪洛 已提交
28 29 30 31 32 33
      //跳转到id为C的StickyHeader位置
      await page.callMethod('gotoStickyHeader', 'C')
    }
    await page.waitFor(async () => {
      return await page.data('scrolling') === false;
    });
34
    const image = await program.screenshot({fullPage: true});
35
    expect(image).toSaveImageSnapshot();
雪洛's avatar
雪洛 已提交
36
  })
37
})