grid.test.js 831 字节
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 () => {
A
Anne_LXM 已提交
7 8
		page = await program.switchTab('/pages/grid/grid')
		await page.waitFor('view')
study夏羽's avatar
study夏羽 已提交
9 10 11
	})
	
	it('检测宫格', async () => {
study夏羽's avatar
study夏羽 已提交
12 13
		expect.assertions(1);
		expect((await page.data('gridList')).length).toBe(9)
study夏羽's avatar
study夏羽 已提交
14 15 16
	})
	
	it('点击宫格', async () => {
17
		if (process.env.UNI_PLATFORM === "h5" || process.env.UNI_PLATFORM.startsWith("app")) {
study夏羽's avatar
测试  
study夏羽 已提交
18 19 20 21
			const perPage = await page.$('.uni-grid-wrap')
			await perPage.callMethod('change')
		}
		if (process.env.UNI_PLATFORM === "mp-weixin") {
A
Anne_LXM 已提交
22
			await page.waitFor('uni-grid')
A
Anne_LXM 已提交
23
			const uniGrid = await page.$('uni-grid')
study夏羽's avatar
测试  
study夏羽 已提交
24 25
			await uniGrid.callMethod('change')
		}
A
Anne_LXM 已提交
26
		await page.waitFor(500)
study夏羽's avatar
study夏羽 已提交
27 28
	})
});