render.test.js 1.0 KB
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1
describe('/pages/rendering/render/render', () => {
雪洛's avatar
雪洛 已提交
2
	if (process.env.uniTestPlatformInfo.startsWith('web')) {
DCloud-WZF's avatar
DCloud-WZF 已提交
3 4 5 6 7
		// TODO: web 端暂不支持
		it('web', async () => {
			expect(1).toBe(1)
		})
	}
雪洛's avatar
雪洛 已提交
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
	let page
	beforeAll(async () => {
		page = await program.reLaunch('/pages/rendering/render/render')
		await page.waitFor('view')
	})
	it('component', async () => {
		const ComForRenderFunction = await page.$('.component-for-render-function')
		expect(await ComForRenderFunction.text()).toEqual(
			'component for render function'
		)
		const compSlot = await page.$('.comp-slot')
		console.log('compSlot', compSlot)
		expect(await compSlot.text()).toEqual('component slot')
	})
	it('text', async () => {
		const msgEl = await page.$('.msg')
		expect(await msgEl.text()).toEqual('default msg')
	})
	it('button', async () => {
		const btnEl = await page.$('.btn')
		expect(await btnEl.property('type')).toBe('primary')
		await btnEl.tap()
		const msgEl = await page.$('.msg')
		expect(await msgEl.text()).toEqual('new msg')
	})
DCloud-WZF's avatar
DCloud-WZF 已提交
33
})