background-image.test.js 1.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
describe('background-image-test', () => {
  let page;
  beforeAll(async () => {
    page = await program.reLaunch('/pages/CSS/background/background-image');
    await page.waitFor(600);
  });


  it('background-image-screenshot', async () => {
    await page.waitFor(300);
11 12 13
    const image = await program.screenshot({
      fullPage: true
    });
14 15 16 17 18 19
    expect(image).toSaveImageSnapshot();
  });

  it('background-image-select', async () => {
    await page.callMethod('updateBackgroundSelect')
    await page.waitFor(300);
20 21 22
    const image = await program.screenshot({
      fullPage: true
    });
23 24
    expect(image).toSaveImageSnapshot();
  });
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

  it('动态切换 background color', async () => {
    await page.callMethod('setBackgroundColor')
    await page.waitFor(300);
    const image = await program.screenshot({
      fullPage: true
    });
    expect(image).toSaveImageSnapshot();

  })
  it('动态切换 background color/image', async () => {
    await page.callMethod('setBackgroundImage')
    await page.waitFor(300);

    const image = await program.screenshot({
      fullPage: true
    });
    expect(image).toSaveImageSnapshot();

  })
45
});