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

test(navigator): relative path

上级 d9e52b99
......@@ -51,6 +51,36 @@ describe('navigator', () => {
await page.waitFor(1000)
})
it('navigateTo relative path', async () => {
await page.callMethod('setLifeCycleNum', 0)
await page.callMethod('navigateToRelativePath1')
page = await program.navigateBack()
await page.waitFor(1000)
lifeCycleNum = await page.callMethod('getLifeCycleNum')
expect(lifeCycleNum).toBe(2)
await page.waitFor(1000)
})
it('navigateTo relative path ./', async () => {
await page.callMethod('setLifeCycleNum', 0)
await page.callMethod('navigateToRelativePath2')
page = await program.navigateBack()
await page.waitFor(1000)
lifeCycleNum = await page.callMethod('getLifeCycleNum')
expect(lifeCycleNum).toBe(2)
await page.waitFor(1000)
})
it('navigateTo relative path ../', async () => {
await page.callMethod('setLifeCycleNum', 0)
await page.callMethod('navigateToRelativePath3')
page = await program.navigateBack()
await page.waitFor(1000)
lifeCycleNum = await page.callMethod('getLifeCycleNum')
expect(lifeCycleNum).toBe(2)
await page.waitFor(1000)
})
it('navigateBack', async () => {
await page.callMethod('setLifeCycleNum', 0)
await page.callMethod('navigateBack')
......
......@@ -175,6 +175,51 @@ export default {
},
})
},
// 自动化测试
navigateToRelativePath1() {
uni.navigateTo({
url: 'new-page/new-page-1?data=new-page/new-page-1',
success() {
setLifeCycleNum(state.lifeCycleNum + 1)
},
fail() {
setLifeCycleNum(state.lifeCycleNum - 1)
},
complete() {
setLifeCycleNum(state.lifeCycleNum + 1)
},
})
},
// 自动化测试
navigateToRelativePath2() {
uni.navigateTo({
url: './new-page/new-page-1?data=./new-page/new-page-1',
success() {
setLifeCycleNum(state.lifeCycleNum + 1)
},
fail() {
setLifeCycleNum(state.lifeCycleNum - 1)
},
complete() {
setLifeCycleNum(state.lifeCycleNum + 1)
},
})
},
// 自动化测试
navigateToRelativePath3() {
uni.navigateTo({
url: '../navigator/new-page/new-page-1?data=../navigator/new-page/new-page-1',
success() {
setLifeCycleNum(state.lifeCycleNum + 1)
},
fail() {
setLifeCycleNum(state.lifeCycleNum - 1)
},
complete() {
setLifeCycleNum(state.lifeCycleNum + 1)
},
})
},
navigateBack() {
uni.navigateBack({
success(result) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册