settings.test.js 1.2 KB
Newer Older
study夏羽's avatar
study夏羽 已提交
1 2 3
// uniapp自动化测试教程: https://uniapp-test.dcloud.net.cn/docs/testcase/start

describe('pages/ucenter/settings/settings', () => {
study夏羽's avatar
study夏羽 已提交
4
	let page,uniToken;
study夏羽's avatar
study夏羽 已提交
5
	beforeAll(async () => {
study夏羽's avatar
study夏羽 已提交
6 7
		try {
			page = await program.navigateTo('/pages/ucenter/settings/settings')
study夏羽's avatar
study夏羽 已提交
8 9 10 11
			await page.waitFor(1000)
			console.log("pageStack: ",await program.pageStack());
			uniToken = await page.data('uniToken')
			console.log('uniToken:',uniToken);
study夏羽's avatar
study夏羽 已提交
12 13 14
		} catch (e) {
			console.log("e: ",e);
		}
study夏羽's avatar
study夏羽 已提交
15
	})
study夏羽's avatar
study夏羽 已提交
16

study夏羽's avatar
study夏羽 已提交
17 18
	it('settings', async () => {
		if (process.env.UNI_PLATFORM == "app-plus") {
study夏羽's avatar
study夏羽 已提交
19
			await page.callMethod('clearTmp')
study夏羽's avatar
study夏羽 已提交
20
			// console.log(await page.data('pushIsOn'), "pushIsOn-------------");
study夏羽's avatar
study夏羽 已提交
21 22
			const pushRes = await page.data('pushIsOn')
			if (pushRes == "wait") {
study夏羽's avatar
study夏羽 已提交
23 24
				await page.callMethod('pushServer.off')
			}
study夏羽's avatar
study夏羽 已提交
25 26 27 28 29 30 31
		}else{
			const el = await page.$('.content')
			const elList = await el.$$('.mt10')
			console.log("elList: ",elList.length);
			
			expect.assertions(1);
			expect(elList.length).toBe(2)
study夏羽's avatar
study夏羽 已提交
32
		}
study夏羽's avatar
study夏羽 已提交
33
		await page.waitFor(300)
study夏羽's avatar
study夏羽 已提交
34
		
study夏羽's avatar
study夏羽 已提交
35
	})
study夏羽's avatar
study夏羽 已提交
36

study夏羽's avatar
study夏羽 已提交
37
	// it('退出登录', async () => {
study夏羽's avatar
study夏羽 已提交
38
		
study夏羽's avatar
study夏羽 已提交
39 40 41 42 43
	// 	if(uniToken){
	// 		await page.callMethod('clickLogout')
	// 	}
	// 	console.log(await program.currentPage(),"333333");
	// })
study夏羽's avatar
study夏羽 已提交
44 45

});