search.test.js 1.2 KB
Newer Older
study夏羽's avatar
study夏羽 已提交
1 2 3 4 5 6 7 8 9 10
// jest官方文档: https://www.jestjs.cn/
// uniapp自动化测试教程: https://uniapp.dcloud.io/collocation/auto/quick-start

describe('pages/list/search/search.vue', () => {
	let page
	beforeAll(async () => {
		page = await program.navigateTo('/pages/list/search/search')
		await page.waitFor(500)
	})
	it('搜索发现-显示-影藏', async () => {
study夏羽's avatar
study夏羽 已提交
11
		// expect.assertions(2);
study夏羽's avatar
study夏羽 已提交
12 13 14
		await page.callMethod('searchHotRefresh')
		await page.waitFor(300)
		const getShow = await page.data('netHotListIsHide')
study夏羽's avatar
study夏羽 已提交
15
		console.log(getShow,"0000000000000");
study夏羽's avatar
study夏羽 已提交
16 17 18
		expect(getShow).toBeFalsy()
		if(!getShow){
			await page.setData({netHotListIsHide: true})
study夏羽's avatar
study夏羽 已提交
19
			console.log(await page.data('netHotListIsHide'),"1111111111");
study夏羽's avatar
study夏羽 已提交
20 21 22 23 24
			expect(await page.data('netHotListIsHide')).toBeTruthy()
		}
	})

	it('搜索内容', async () => {
study夏羽's avatar
study夏羽 已提交
25
		// expect.assertions(1);
study夏羽's avatar
study夏羽 已提交
26 27 28
		const setSearchTest = await page.setData({
			searchText: '小程序',
		})
study夏羽's avatar
study夏羽 已提交
29
		console.log(await page.data('searchText'));
study夏羽's avatar
study夏羽 已提交
30 31
		await page.callMethod('search', '小程序')
		await page.waitFor(300)
study夏羽's avatar
study夏羽 已提交
32
		console.log(await program.currentPage(),"-----------------------");
study夏羽's avatar
study夏羽 已提交
33 34 35
		expect((await program.currentPage()).path).toBe('pages/list/list')
	})
});