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

let page;
describe('page screenshot test', () => {
Anne_LXM's avatar
Anne_LXM 已提交
9 10 11
  if(process.env.uniTestPlatformInfo == 'ios_simulator 13.7'){
    it('ios', async () => {
    	expect(1).toBe(1)
Anne_LXM's avatar
Anne_LXM 已提交
12
    })
Anne_LXM's avatar
Anne_LXM 已提交
13
    return
Anne_LXM's avatar
Anne_LXM 已提交
14
  }
Anne_LXM's avatar
Anne_LXM 已提交
15 16 17 18 19 20 21 22 23 24 25 26 27 28
  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 () => {
Anne_LXM's avatar
Anne_LXM 已提交
29 30 31
  	const image = await program.screenshot({deviceShot:true,fullPage:true});
  	expect(image).toSaveImageSnapshot();
  	await page.waitFor(500);
Anne_LXM's avatar
Anne_LXM 已提交
32
  })
A
Anne_LXM 已提交
33
})