提交 228cce67 编写于 作者: Q qiang

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

上级 fb7daedc
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>
<view>
<text style="text-align: center;">测试页面 1</text>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
<template>
<view>
<text style="text-align: center;">测试页面 1</text>
</view>
</template>
<script>
export default {
data() {
return {
page: 1
}
},
methods: {
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<view>
<text style="text-align: center;">测试页面 2</text>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
<template>
<view>
<text style="text-align: center;">测试页面 2</text>
</view>
</template>
<script>
export default {
data() {
return {
page: 2
}
},
methods: {
}
}
</script>
<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.
先完成此消息的编辑!
想要评论请 注册