提交 d7bb3e1c 编写于 作者: Q qiang

test: 拦截器示例增加自动化测试

上级 e3d63090
const PAGE_PATH = '/pages/API/interceptor/interceptor'
describe('interceptor', () => {
let page
beforeAll(async () => {
page = await program.reLaunch(PAGE_PATH)
await page.waitFor('view')
})
it('no Interceptor', async () => {
const newPage = await program.navigateTo('./page1')
await newPage.waitFor('text')
const num = (await newPage.data()).page
await program.navigateBack()
expect(num).toBe(1)
})
it('addInterceptor', async () => {
await page.callMethod('addInterceptor')
const newPage = await program.navigateTo('./page1')
await newPage.waitFor('text')
const num = (await newPage.data()).page
await program.navigateBack()
expect(num).toBe(2)
})
it('removeInterceptor', async () => {
await page.callMethod('removeInterceptor')
const newPage = await program.navigateTo('./page1')
await newPage.waitFor('text')
const num = (await newPage.data()).page
await program.navigateBack()
expect(num).toBe(1)
})
})
\ No newline at end of file
<template> <template>
<view> <view>
<text style="text-align: center;">测试页面 1</text> <text style="text-align: center;">测试页面 1</text>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
page: 1
} }
}, },
methods: { methods: {
} }
} }
</script> </script>
<style> <style>
</style> </style>
\ No newline at end of file
<template> <template>
<view> <view>
<text style="text-align: center;">测试页面 2</text> <text style="text-align: center;">测试页面 2</text>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
page: 2
} }
}, },
methods: { methods: {
} }
} }
</script> </script>
<style> <style>
</style> </style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册