grid.test.js 809 字节
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
const PAGE_PATH = '/pages/grid/grid'
Anne_LXM's avatar
Anne_LXM 已提交
4
jest.setTimeout(15000)
A
Anne_LXM 已提交
5
describe('grid', () => {
A
Anne_LXM 已提交
6
	let page, hasLogin;
study夏羽's avatar
study夏羽 已提交
7
	beforeAll(async () => {
A
Anne_LXM 已提交
8
		page = await program.switchTab(PAGE_PATH)
A
Anne_LXM 已提交
9
		await page.waitFor('view')
study夏羽's avatar
study夏羽 已提交
10 11
	})
	it('检测宫格', async () => {
Anne_LXM's avatar
Anne_LXM 已提交
12
		await page.waitFor(2000)
A
Anne_LXM 已提交
13 14
		hasLogin = await page.data('hasLogin')
		let gridList = await page.data('gridList')
Anne_LXM's avatar
Anne_LXM 已提交
15
		console.log("gridList", gridList.length,hasLogin)
A
Anne_LXM 已提交
16
		expect(gridList.length).toBe(9)
study夏羽's avatar
study夏羽 已提交
17 18
	})
	it('点击宫格', async () => {
A
Anne_LXM 已提交
19
		const perPage = await page.$$('.grid-item-box')
A
Anne_LXM 已提交
20
		console.log("perPage", perPage.length)
A
Anne_LXM 已提交
21 22 23
		for (var i = 0; i < perPage.length; i++) {
			await perPage[i].tap()
			await page.waitFor(300)
study夏羽's avatar
测试  
study夏羽 已提交
24
		}
study夏羽's avatar
study夏羽 已提交
25 26
	})
});