detail.test.js 1.2 KB
Newer Older
Anne_LXM's avatar
Anne_LXM 已提交
1 2 3 4 5 6 7 8 9 10 11 12
describe('pages/user-info/detail.vue', () => {
	let page,getQuery;
	if (process.env.uniTestPlatformInfo == 'ios_simulator 13.7') {
		it('ios', async () => {
			expect(1).toBe(1)
		})
		return
	}
	beforeAll(async () => {
		// 重新reLaunch至首页,并获取首页page对象(其中 program 是uni-automator自动注入的全局对象)
		// page = await program.navigateTo('/pages/user-info/detail')
		page = await program.currentPage()
A
Anne_LXM 已提交
13
		await page.waitFor('view')
Anne_LXM's avatar
Anne_LXM 已提交
14
		getQuery = await page.query
Anne_LXM's avatar
Anne_LXM 已提交
15 16 17 18 19 20 21 22 23 24 25 26 27
		console.log('getQuery: ', getQuery);
		if (Object.keys(getQuery).length === 0 || getQuery === undefined) {
		  console.log('err query')
		  return
		}
	})
	it('打开修改页面', async () => {
		// expect.assertions(1);
		await page.callMethod('handleUpdate')
		await page.waitFor(1000)
		console.log('currentPage', await program.currentPage())
		expect((await program.currentPage()).path).toBe('pages/user-info/edit')
	})
Anne_LXM's avatar
Anne_LXM 已提交
28 29 30 31 32 33 34
  // it('删除当前数据', async () => {
  // 	await page.callMethod('handleDelete')
  // 	await page.waitFor(1000)
  //   const testRes = await page.data('testRes')
  // 	console.log('testRes', testRes)
  //   console.log('currentPage', await program.currentPage())
  // })
A
Anne_LXM 已提交
35
})