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