diff --git a/pages/API/interceptor/interceptor.test.js b/pages/API/interceptor/interceptor.test.js index 5006a8a6b31e53d9a3a9fae9d6ec28e6860f13c3..1c47518612ca83897f2c2dd477f780b512dfa921 100644 --- a/pages/API/interceptor/interceptor.test.js +++ b/pages/API/interceptor/interceptor.test.js @@ -12,7 +12,15 @@ describe('interceptor', () => { await newPage.waitFor('text') const num = (await newPage.data()).page await program.navigateBack() - expect(num).toBe(1) + 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() }) -}) \ No newline at end of file +}) diff --git a/pages/API/interceptor/interceptor.uvue b/pages/API/interceptor/interceptor.uvue index aea6a613dbb871127b253338ece29bce8f4f2fa5..78d0b2288673db50012bfc20dc85ff5218169935 100644 --- a/pages/API/interceptor/interceptor.uvue +++ b/pages/API/interceptor/interceptor.uvue @@ -4,7 +4,7 @@ 点击下方按钮{{msg}} - +