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