grid.test.js 913 字节
Newer Older
study夏羽's avatar
study夏羽 已提交
1 2 3 4 5 6
// jest官方文档: https://www.jestjs.cn/
// uniapp自动化测试教程: https://uniapp.dcloud.io/collocation/auto/quick-start

describe('pages/grid/grid.vue', () => {
	let page
	beforeAll(async () => {
study夏羽's avatar
study夏羽 已提交
7 8 9 10 11 12 13
		try{
			page = await program.switchTab('/pages/grid/grid')
			await page.waitFor(500)
			console.log("page: ",page);
		}catch(e){
			console.log("e: ",e);
		}
study夏羽's avatar
study夏羽 已提交
14 15 16
	})
	
	it('检测宫格', async () => {
study夏羽's avatar
study夏羽 已提交
17
		// expect.assertions(1);
study夏羽's avatar
study夏羽 已提交
18 19
		const getData = await page.data('gridList')
		console.log("getData: ",getData);
study夏羽's avatar
study夏羽 已提交
20
		// expect(getData.length).toBe(9)
study夏羽's avatar
study夏羽 已提交
21 22 23
	})
	
	it('点击宫格', async () => {
study夏羽's avatar
测试  
study夏羽 已提交
24 25 26 27 28 29 30 31
		if (process.env.UNI_PLATFORM === "h5" || process.env.UNI_PLATFORM === "app-plus") {
			const perPage = await page.$('.uni-grid-wrap')
			await perPage.callMethod('change')
		}
		if (process.env.UNI_PLATFORM === "mp-weixin") {
			const uniGrid = await page.$('uni-grid')
			await uniGrid.callMethod('change')
		}
study夏羽's avatar
study夏羽 已提交
32 33
	})
});