提交 14cffd74 编写于 作者: 辛宝Otto's avatar 辛宝Otto 🥊

test(api/interceptor): 新增拦截器测试用例

上级 98c14cac
......@@ -13,6 +13,14 @@ describe('interceptor', () => {
const num = (await newPage.data()).page
await program.navigateBack()
expect(num).toBe(1)
// 新增 navigator 元素
const elementNavigatorButton = await page.$('.navigatorButton')
await elementNavigatorButton.tap()
await page.waitFor(300)
const currentPage = await program.currentPage()
expect(currentPage.path).toBe('pages/API/interceptor/page1')
await program.navigateBack()
})
it('addInterceptor', async () => {
......@@ -22,6 +30,14 @@ describe('interceptor', () => {
const num = (await newPage.data()).page
await program.navigateBack()
expect(num).toBe(2)
// 新增 navigator 元素
const elementNavigatorButton = await page.$('.navigatorButton')
await elementNavigatorButton.tap()
await page.waitFor(300)
const currentPage = await program.currentPage()
expect(currentPage.path).toBe('pages/API/interceptor/page2')
await program.navigateBack()
})
it('removeInterceptor', async () => {
......@@ -31,5 +47,13 @@ describe('interceptor', () => {
const num = (await newPage.data()).page
await program.navigateBack()
expect(num).toBe(1)
// 新增 navigator 元素
const elementNavigatorButton = await page.$('.navigatorButton')
await elementNavigatorButton.tap()
await page.waitFor(300)
const currentPage = await program.currentPage()
expect(currentPage.path).toBe('pages/API/interceptor/page1')
await program.navigateBack()
})
})
......@@ -4,7 +4,7 @@
<button @click="removeInterceptor">移除路由拦截器</button>
<text>点击下方按钮{{msg}}</text>
<button @click="navigateTo">navigatorTo API跳转到测试页面</button>
<navigator url="./page1"><button>navigator组件跳转到测试页面</button></navigator>
<navigator url="./page1"><button class="navigatorButton">navigator组件跳转到测试页面</button></navigator>
</view>
</template>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册