提交 a60cdc8f 编写于 作者: H hdx

test(拦截器):增加switchTab按钮点击,调整自动化测试

上级 d72762e4
......@@ -60,6 +60,7 @@ describe('interceptor', () => {
it('addSwitchTabInterceptor', async () => {
await page.callMethod('addSwitchTabInterceptor')
await page.callMethod('switchTab')
await page.waitFor(300)
const currentPage = await program.currentPage()
expect(currentPage.path).toBe('pages/tabBar/API')
})
......@@ -69,6 +70,7 @@ describe('interceptor', () => {
await currentPage1.callMethod('addSwitchTabInterceptor')
await currentPage1.callMethod('removeSwitchTabInterceptor')
await currentPage1.callMethod('switchTab')
await page.waitFor(300)
const currentPage2 = await program.currentPage()
expect(currentPage2.path).toBe('pages/tabBar/component')
})
......
......@@ -6,7 +6,9 @@
<button @click="navigateTo">navigatorTo API跳转到测试页面</button>
<navigator url="./page1">
<button class="navigatorButton">navigator组件跳转到测试页面</button>
</navigator>
</navigator>
<button @click="addSwitchTabInterceptor">添加switchTab拦截器</button>
<button @click="removeSwitchTabInterceptor">移除switchTab拦截器</button>
<button class="navigatorButton" @click="switchTab">switchTab API</button>
</view>
</template>
......@@ -35,7 +37,7 @@
const switchTabInterceptor = {
invoke: function (options : SwitchTabOptions) {
console.log('拦截 switchTab 接口传入参数为:', options)
options.url = 'pages/tabBar/API'
options.url = '/pages/tabBar/API'
},
success: function (res : SwitchTabSuccess) {
console.log('拦截 switchTab 接口 success 返回参数为:', res)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册