ucenter.test.js 1.7 KB
Newer Older
study夏羽's avatar
study夏羽 已提交
1 2 3 4 5 6
describe('pages/ucenter/ucenter.vue', () => {

	let page
	beforeAll(async () => {
		page = await program.switchTab('/pages/ucenter/ucenter')
		await page.waitFor(300)
study夏羽's avatar
study夏羽 已提交
7
		console.log("page:2 ",page);
study夏羽's avatar
study夏羽 已提交
8
	})
study夏羽's avatar
update  
study夏羽 已提交
9
	
study夏羽's avatar
study夏羽 已提交
10 11
	it('宫格', async () => {
		const getGrid = await page.data('gridList')
study夏羽's avatar
study夏羽 已提交
12 13
		console.log("getGrid: ",getGrid);
		// expect(getGrid.length).toBe(4)
study夏羽's avatar
study夏羽 已提交
14 15 16 17
	})

	it('列表', async () => {
		const getUcenterList = await page.data('ucenterList')
study夏羽's avatar
study夏羽 已提交
18 19
		console.log("getUcenterList: ",getUcenterList);
		// expect(getUcenterList.length).toBe(3)
study夏羽's avatar
study夏羽 已提交
20
	})
study夏羽's avatar
study夏羽 已提交
21 22
	

study夏羽's avatar
study夏羽 已提交
23 24 25
	it('普通签到', async () => {
		// const uniToken = await page.data('uniToken')
		// console.log("uniToken: ",uniToken);
study夏羽's avatar
update  
study夏羽 已提交
26
		console.log("process.env.UNI_PLATFORM: ",process.env.UNI_PLATFORM);
study夏羽's avatar
study夏羽 已提交
27
		if (process.env.UNI_PLATFORM == "mp-weixin" || process.env.UNI_PLATFORM == "h5"){
study夏羽's avatar
study夏羽 已提交
28
			await page.callMethod('signIn')
study夏羽's avatar
study夏羽 已提交
29
			await page.waitFor(3000)
study夏羽's avatar
update  
study夏羽 已提交
30
			await program.screenshot({
study夏羽's avatar
study夏羽 已提交
31
				path: "static/screenshot/sign-weixin-h5.png" 
study夏羽's avatar
study夏羽 已提交
32 33
			})
		}
study夏羽's avatar
study夏羽 已提交
34 35 36 37 38 39 40 41 42 43
		if(process.env.UNI_PLATFORM === "app-plus"){
				console.log('app-plus');
				const signInByAdRes = await page.callMethod('signInByAd')
				// await page.waitFor(300)
				const shareRes = await page.callMethod('share')
				// await page.waitFor(300)
				
				await program.screenshot({
					path: "static/screenshot/sign-app.png" 
				})
study夏羽's avatar
study夏羽 已提交
44
		}
study夏羽's avatar
study夏羽 已提交
45 46

	})
study夏羽's avatar
study夏羽 已提交
47 48 49

	it('我的积分', async () => {
		// expect.assertions(1);
study夏羽's avatar
study夏羽 已提交
50
		await page.waitFor(300)
study夏羽's avatar
study夏羽 已提交
51

study夏羽's avatar
study夏羽 已提交
52 53
		const getScoreRes = await page.callMethod('getScore')
		console.log("getScoreRes: ", getScoreRes);
study夏羽's avatar
study夏羽 已提交
54 55
		if (getScoreRes) {
			console.log("今日已签到");
study夏羽's avatar
update  
study夏羽 已提交
56 57
			// expect(getScoreRes.score).not.toBeUndefined();
			// expect(getScoreRes.balance).toBeGreaterThanOrEqual(getScoreRes.score);
study夏羽's avatar
study夏羽 已提交
58 59 60
		} else {
			console.log("签到失败");
		}
study夏羽's avatar
study夏羽 已提交
61 62 63
	})

})