提交 da6e1527 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

test: 调整组件生命周期测试例兼容 web 端

上级 871f8d66
......@@ -16,12 +16,12 @@ describe('component-lifecycle', () => {
page = await program.navigateTo(PAGE_PATH)
await page.waitFor(700)
})
// afterAll(async () => {
// const resetLifecycleNum = 1100
// await page.callMethod('setLifeCycleNum', resetLifecycleNum)
// lifeCycleNum = await page.callMethod('getLifeCycleNum')
// expect(lifeCycleNum).toBe(resetLifecycleNum)
// })
afterAll(async () => {
const resetLifecycleNum = 1100
await page.callMethod('setLifeCycleNum', resetLifecycleNum)
lifeCycleNum = await page.callMethod('getLifeCycleNum')
expect(lifeCycleNum).toBe(resetLifecycleNum)
})
it('onLoad onPageShow onReady onBeforeMount onMounted', async () => {
lifeCycleNum = await page.callMethod('getLifeCycleNum')
......@@ -44,13 +44,13 @@ describe('component-lifecycle', () => {
})
it('onPageScroll onReachBottom', async () => {
await program.pageScrollTo(2000)
// 测试 web 端组件内监听 onPageScroll 不触发
// web 端组件内监听 onPageScroll onReachBottom 不触发
if (process.env.uniTestPlatformInfo.startsWith('android')) {
const isScrolled = await page.callMethod('getIsScrolled')
expect(isScrolled).toBe(true)
}
lifeCycleNum = await page.callMethod('getLifeCycleNum')
expect(lifeCycleNum).toBe(10)
}
await page.callMethod('pageSetlifeCycleNum', 0)
})
it('onHide', async () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册