scroll-view-refresher.test.js 1.3 KB
Newer Older
1 2
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/

雪洛's avatar
雪洛 已提交
3 4 5 6 7 8 9 10 11 12 13 14
describe('component-native-scroll-view-refresher', () => {
  if (!process.env.uniTestPlatformInfo.startsWith('android') && !process.env.uniTestPlatformInfo.startsWith('web') || process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
    it('other platform', () => {
      expect(1).toBe(1)
    })
    return
  }
  let page;
  beforeAll(async () => {
    page = await program.reLaunch('/pages/component/scroll-view/scroll-view-refresher');
    await page.waitFor(300);
  });
15

雪洛's avatar
雪洛 已提交
16 17 18 19
  it('scroll-view-refresher-screenshot', async () => {
    //禁止滚动条
    await page.setData({
        showScrollbar: false
20
    })
雪洛's avatar
雪洛 已提交
21 22 23 24
    await page.waitFor(300);
    const image = await program.screenshot({fullPage: true});
    expect(image).toSaveImageSnapshot();
  })
25

雪洛's avatar
雪洛 已提交
26 27 28
  it('check_refresher', async () => {
    await page.setData({
      refresherTriggered: true
29
    })
雪洛's avatar
雪洛 已提交
30 31 32 33 34 35 36 37 38 39 40 41
    await page.waitFor(1000);
    expect(await page.data('refresherrefreshTimes')).toBe(1)
  });

  it('check_refresher_snapshot', async () => {
    await page.setData({
      refresherTriggered: true
    })
    await page.waitFor(300);
    const image = await program.screenshot({fullPage: true});
    expect(image).toSaveImageSnapshot();
  });
42
});