settings.test.js 929 字节
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')
A
Anne_LXM 已提交
8
			await page.waitFor('view')
study夏羽's avatar
study夏羽 已提交
9
			uniToken = await page.data('uniToken')
study夏羽's avatar
study夏羽 已提交
10 11
		} catch (err) {
			console.log("err: ",err);
study夏羽's avatar
study夏羽 已提交
12
		}
study夏羽's avatar
study夏羽 已提交
13
	})
study夏羽's avatar
study夏羽 已提交
14
	it('settings', async () => {
15
		if (process.env.UNI_PLATFORM.startsWith("app")) {
study夏羽's avatar
study夏羽 已提交
16
			await page.callMethod('clearTmp')
study夏羽's avatar
study夏羽 已提交
17
			const pushRes = await page.data('pushIsOn')
A
Anne_LXM 已提交
18
			if (pushRes == "wait") {await page.callMethod('pushServer.off')}
study夏羽's avatar
study夏羽 已提交
19 20
		}else{
			const el = await page.$('.content')
A
Anne_LXM 已提交
21
			await page.waitFor('view')
study夏羽's avatar
study夏羽 已提交
22
			expect.assertions(1);
A
Anne_LXM 已提交
23
			expect((await el.$$('.mt10')).length).toBe(2)
study夏羽's avatar
study夏羽 已提交
24 25
		}
	})
A
Anne_LXM 已提交
26 27 28 29
	it('退出登录', async () => {
		if(uniToken){await page.callMethod('changeLoginState')}
		console.log(await program.currentPage());
	})
study夏羽's avatar
study夏羽 已提交
30 31

});