grid.test.js 772 字节
Newer Older
study夏羽's avatar
study夏羽 已提交
1 2
// jest官方文档: https://www.jestjs.cn/
// uniapp自动化测试教程: https://uniapp.dcloud.io/collocation/auto/quick-start
A
Anne_LXM 已提交
3 4
const PAGE_PATH = '/pages/grid/grid'
describe('grid', () => {
A
Anne_LXM 已提交
5
	let page, hasLogin;
study夏羽's avatar
study夏羽 已提交
6
	beforeAll(async () => {
A
Anne_LXM 已提交
7
		page = await program.switchTab(PAGE_PATH)
A
Anne_LXM 已提交
8
		await page.waitFor('view')
study夏羽's avatar
study夏羽 已提交
9 10
	})
	it('检测宫格', async () => {
A
Anne_LXM 已提交
11 12 13 14 15
		hasLogin = await page.data('hasLogin')
		console.log("hasLogin", hasLogin)
		let gridList = await page.data('gridList')
		console.log("gridList", gridList)
		expect(gridList.length).toBe(9)
study夏羽's avatar
study夏羽 已提交
16 17
	})
	it('点击宫格', async () => {
A
Anne_LXM 已提交
18
		const perPage = await page.$$('.grid-item-box')
A
Anne_LXM 已提交
19
		console.log("perPage", perPage)
A
Anne_LXM 已提交
20 21 22
		for (var i = 0; i < perPage.length; i++) {
			await perPage[i].tap()
			await page.waitFor(300)
study夏羽's avatar
测试  
study夏羽 已提交
23
		}
study夏羽's avatar
study夏羽 已提交
24 25
	})
});