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