pages.test.js 897 字节
Newer Older
A
Anne_LXM 已提交
1 2
let pageIndex = 0
const pages = [
A
Anne_LXM 已提交
3
	'/uni_modules/uni-id-pages/pages/login/login-withpwd'
A
Anne_LXM 已提交
4 5 6 7
]

let page;
describe('page screenshot test', () => {
Anne_LXM's avatar
Anne_LXM 已提交
8 9 10
  if(process.env.uniTestPlatformInfo == 'ios_simulator 13.7'){
    it('ios', async () => {
    	expect(1).toBe(1)
Anne_LXM's avatar
Anne_LXM 已提交
11
    })
Anne_LXM's avatar
Anne_LXM 已提交
12
    return
Anne_LXM's avatar
Anne_LXM 已提交
13
  }
Anne_LXM's avatar
Anne_LXM 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
  beforeAll(async () => {
  	console.log("page screenshot test start");
  });
  beforeEach(async () => {
  	page = await program.reLaunch(pages[pageIndex]);
  	await page.waitFor(1000);
  });
  afterEach(() => {
  	pageIndex++;
  });
  afterAll(() => {
  	console.log("page screenshot test finish");
  });
  test.each(pages)('%s', async () => {
  	// const image = await program.screenshot();
  	// expect(image).toMatchImageSnapshot();
  	// await page.waitFor(500);
    const image = await program.screenshot({
    	fullPage: true
    });
    expect(image).toSaveImageSnapshot();
    await page.waitFor(500);
  })
A
Anne_LXM 已提交
37
})