settings.test.js 965 字节
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
			await page.waitFor(1000)
			uniToken = await page.data('uniToken')
			console.log('uniToken:',uniToken);
study夏羽's avatar
study夏羽 已提交
11 12
		} catch (err) {
			console.log("err: ",err);
study夏羽's avatar
study夏羽 已提交
13
		}
study夏羽's avatar
study夏羽 已提交
14
	})
study夏羽's avatar
study夏羽 已提交
15

study夏羽's avatar
study夏羽 已提交
16
	it('settings', async () => {
17
		if (process.env.UNI_PLATFORM.startsWith("app")) {
study夏羽's avatar
study夏羽 已提交
18
			await page.callMethod('clearTmp')
study夏羽's avatar
study夏羽 已提交
19
			const pushRes = await page.data('pushIsOn')
A
Anne_LXM 已提交
20
			if (pushRes == "wait") {await page.callMethod('pushServer.off')}
study夏羽's avatar
study夏羽 已提交
21 22 23
		}else{
			const el = await page.$('.content')
			expect.assertions(1);
A
Anne_LXM 已提交
24
			expect((await el.$$('.mt10')).length).toBe(2)
study夏羽's avatar
study夏羽 已提交
25
		}
study夏羽's avatar
study夏羽 已提交
26
		
study夏羽's avatar
study夏羽 已提交
27
	})
A
Anne_LXM 已提交
28 29 30 31 32
	it('退出登录', async () => {
		if(uniToken){await page.callMethod('changeLoginState')}
		await page.waitFor(300)
		console.log(await program.currentPage());
	})
study夏羽's avatar
study夏羽 已提交
33 34

});