userinfo.test.js 1.2 KB
Newer Older
study夏羽's avatar
study夏羽 已提交
1 2 3 4 5 6
// jest官方文档: https://www.jestjs.cn/
// uniapp自动化测试教程: https://uniapp.dcloud.io/collocation/auto/quick-start
describe('pages/ucenter/userinfo/userinfo.vue', () => {

	let page
	beforeAll(async () => {
study夏羽's avatar
study夏羽 已提交
7
		page = await program.navigateTo('/pages/ucenter/userinfo/userinfo')
study夏羽's avatar
study夏羽 已提交
8 9 10 11
		await page.waitFor(500)
	})

	
study夏羽's avatar
study夏羽 已提交
12
	it('设置昵称', async () => {
study夏羽's avatar
study夏羽 已提交
13 14 15
		const getTokenRes =  await page.waitFor(async()=>{
			return await page.data('uniToken')
		})
study夏羽's avatar
study夏羽 已提交
16
		console.log("getTokenRes:---------------------- ",getTokenRes);
study夏羽's avatar
study夏羽 已提交
17
		
study夏羽's avatar
study夏羽 已提交
18 19 20 21 22 23 24 25
		var name = "数字天堂DCloud" +  Math.round(Math.random()*10);
		console.log("name: ",name);
		if(getTokenRes){
			const nicknameRes = await page.callMethod("setNickname",name)
			await page.waitFor(300)
			console.log("nicknameRes: ",nicknameRes);
			expect(nicknameRes.updated).toBe(1)
		}
study夏羽's avatar
测试  
study夏羽 已提交
26
		
study夏羽's avatar
study夏羽 已提交
27
	})
study夏羽's avatar
study夏羽 已提交
28 29 30 31
	
	it('绑定手机号', async () => {
		await page.callMethod('bindMobileBySmsCode')
		await page.waitFor(300)
study夏羽's avatar
study夏羽 已提交
32 33
		// expect((await program.currentPage()).path).toBe('pages/ucenter/userinfo/bind-mobile/bind-mobile')
		// await page.waitFor(300)
study夏羽's avatar
测试  
study夏羽 已提交
34 35
		console.log("---------------- ",await program.navigateBack());
		// expect((await program.navigateBack()).path).toBe('pages/ucenter/userinfo/userinfo')
study夏羽's avatar
study夏羽 已提交
36 37 38
	})
	
})