element-get-attribute.test.js 996 字节
Newer Older
Anne_LXM's avatar
Anne_LXM 已提交
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
jest.setTimeout(30000);
describe('/pages/API/element-get-attribute/element-get-attribute', () => {
  let page;
  if (!process.env.uniTestPlatformInfo.startsWith('mp')) {
    it('skip', () => {
      expect(1).toBe(1)
    })
    return
  }
  beforeAll(async () => {
    page = await program.reLaunch('/pages/API/element-get-attribute/element-get-attribute')
    await page.waitFor(3000);
  });
  it('check getAttributeId', async () => {
    await page.callMethod('getAttributeId')
    expect(await page.data('attrId')).toEqual('box');
  });
  it('check setStyle getAttributeStyle', async () => {
    await page.callMethod('setStyle')
    await page.callMethod('getAttributeStyle')
    expect(await page.data('attrStyle')).toEqual('background-color:#FFF000');
  });
  it('check scrollTo', async () => {
    await page.callMethod('scrollTo')
    await page.waitFor(100);
    const scrollView =  await page.$('.scroll-view_H')
    expect(await scrollView.property('scrollLeft')).toBe(200);
  });
});