pull-down-refresh.test.js 1.1 KB
Newer Older
1
const PAGE_PATH = "/pages/API/pull-down-refresh/pull-down-refresh"
2 3 4
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isIos = platformInfo.startsWith('ios')
const isWeb = platformInfo.startsWith('web')
5 6

describe("payment", () => {
7
  if (isWeb || process.env.UNI_AUTOMATOR_APP_WEBVIEW === 'true') {
8 9 10 11 12 13 14 15 16 17 18 19 20 21
    it('web || app-webview', () => {
      expect(1).toBe(1)
    })
    return
  }

  it("trigger pulldown refresh by swipe", async () => {
    const page = await program.navigateTo(PAGE_PATH)
    await page.waitFor('view')
    await page.waitFor(4000)
    await page.setData({
      pulldownRefreshTriggered: false
    })

22 23 24 25 26
    if (isIos) {
      // 暂时通过点击关闭授权弹框,避免影响 swipe 测试
      await program.tap({x: 100, y: 500})
    }

27 28 29 30 31 32 33 34 35 36 37 38 39 40
    await program.swipe({
      startPoint: {
        x: 100,
        y: 400
      },
      endPoint: {
        x: 100,
        y: 800
      },
      duration: 1000
    })
    await page.waitFor(1500)
    expect(await page.data('pulldownRefreshTriggered')).toBe(true)
  });
41
});