pwd-retrieve.test.js 1.1 KB
Newer Older
study夏羽's avatar
study夏羽 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
// jest官方文档: https://www.jestjs.cn/
// uniapp自动化测试教程: https://uniapp.dcloud.io/collocation/auto/quick-start
describe('pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue', () => {

	let page
	beforeAll(async () => {
		page = await program.navigateTo('/pages/ucenter/login-page/pwd-retrieve/pwd-retrieve?phoneNumber=17769516019')
		await page.waitFor(500)
	})

	it('重置密码', async () => {
		await page.setData({
			formData: {
				"phone": "17769516019",
				'pwd': '222222',
				'pwd2': '222222',
				'code':'123456'
			}
		})
		
study夏羽's avatar
study夏羽 已提交
21 22 23
		// if (process.env.UNI_PLATFORM === "h5") {
			
		// }
study夏羽's avatar
study夏羽 已提交
24 25 26 27
		
		console.log(await program.currentPage());
		// expect((await program.currentPage()).path).toBe('/pages/ucenter/settings/settings')
		
study夏羽's avatar
study夏羽 已提交
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
		
		const submitRes = await page.callMethod('submit')
		console.log("submitRes: ",submitRes);
		if(submitRes){
			switch (submitRes.code){
				case 0:
					expect(submitRes.msg).toBe('密码重置成功')
					break;
				case 10202:
					expect(submitRes.msg).toBe('此手机号尚未注册')
					break;
				default:
					break;
			}
		}		
study夏羽's avatar
study夏羽 已提交
43 44
	})
})