grid.test.js 899 字节
Newer Older
study夏羽's avatar
study夏羽 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
// jest官方文档: https://www.jestjs.cn/
// uniapp自动化测试教程: https://uniapp.dcloud.io/collocation/auto/quick-start

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