settings.test.js 1.3 KB
Newer Older
Anne_LXM's avatar
Anne_LXM 已提交
1 2
jest.setTimeout(30000);
describe('settings', () => {
Anne_LXM's avatar
Anne_LXM 已提交
3 4 5 6 7 8 9
	let page, hasLogin;
	if (process.env.uniTestPlatformInfo == 'ios_simulator 13.7') {
		it('ucenter-ios13.7', async () => {
			expect(1).toBe(1)
		})
		return
	}
Anne_LXM's avatar
Anne_LXM 已提交
10
	beforeAll(async () => {
Anne_LXM's avatar
Anne_LXM 已提交
11
		page = await program.navigateTo('/pages/ucenter/settings/settings')
Anne_LXM's avatar
Anne_LXM 已提交
12 13 14 15 16 17
		await page.waitFor('view')
		hasLogin = await page.callMethod('hasLoginTest')
		console.log("登录状态", hasLogin)
		if (!hasLogin) {
			console.log("未登录测试失败")
			return
Anne_LXM's avatar
Anne_LXM 已提交
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
		}
	})
	it('settings', async () => {
		if (process.env.UNI_PLATFORM.startsWith("app")) {
			await page.callMethod('clearTmp')
			const pushRes = await page.data('pushIsOn')
			if (pushRes == "wait") {
				await page.callMethod('pushServer.off')
			}
		} else {
			const el = await page.$('.content')
			await page.waitFor('view')
			expect.assertions(1);
			expect((await el.$$('.mt10')).length).toBe(2)
		}
	})
Anne_LXM's avatar
Anne_LXM 已提交
34 35 36 37 38
  it('screenshot', async () => {
    const image = await program.screenshot({deviceShot:true,fullPage:true});
    expect(image).toSaveImageSnapshot();
    await page.waitFor(500);
  })
Anne_LXM's avatar
Anne_LXM 已提交
39 40 41 42 43 44 45
	it('退出登录', async () => {
		const bottomEl = await page.$('.bottom-back-text')
		expect(await bottomEl.text()).toBe('退出登录')
		await page.callMethod('changeLoginState')
		await page.waitFor(1000)
	})
});