movable-view.test.js 891 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
let page;
describe('movable-view.uvue', () => {
  console.log(process.env.uniTestPlatformInfo,process.env.uniTestPlatformInfo.startsWith('web'))
  if (!process.env.uniTestPlatformInfo.startsWith('web')) {
    it('app', () => {
      expect(1).toBe(1)
    })
    return
  }
  beforeAll(async () => {
    page = await program.reLaunch('/pages/component/movable-view/movable-view')
    await page.waitFor('view');
  });

  it('移动至 (30px, 30px)', async () => {
    expect(await page.data('x')).toBe(0)
    expect(await page.data('y')).toBe(0)
    await page.callMethod('tap')
    await page.waitFor(500);
    expect(await page.data('x')).toBe(30)
    expect(await page.data('y')).toBe(30)
  })
  it('放大3倍', async () => {
    expect(await page.data('scale')).toBe(2)
    await page.callMethod('tap2')
    await page.waitFor(500);
    expect(await page.data('scale')).toBe(3)
  })

})