diff --git a/pages/API/get-current-pages/get-current-pages.test.js b/pages/API/get-current-pages/get-current-pages.test.js index 7c0564fe6059f06956002d0bea5f78348ae9d151..7e377cb849f66e5350198efd2492d5df997bd4be 100644 --- a/pages/API/get-current-pages/get-current-pages.test.js +++ b/pages/API/get-current-pages/get-current-pages.test.js @@ -1,28 +1,28 @@ -const HOME_PAGE_PATH = '/pages/tabBar/component' -const PAGE_PATH = '/pages/API/get-current-pages/get-current-pages' - -describe('getCurrentPages', () => { - let page - it('getCurrentPages', async () => { - // web 端等待应用首页加载完成 - if (process.env.uniTestPlatformInfo.startsWith('web')) { - const waitTime = process.env.uniTestPlatformInfo.includes('safari') ? - 5000 : - 3000 - await new Promise((resolve) => { - setTimeout(() => { - resolve() - }, waitTime) - }) - } - page = await program.switchTab(HOME_PAGE_PATH) - await page.waitFor(1000) - page = await program.navigateTo(PAGE_PATH) - await page.waitFor(1000) - await page.callMethod('_getCurrentPages') - await page.waitFor(200) - const data = await page.data() - expect(data.checked).toBe(true) +const HOME_PAGE_PATH = '/pages/tabBar/component' +const PAGE_PATH = '/pages/API/get-current-pages/get-current-pages' + +describe('getCurrentPages', () => { + let page + it('getCurrentPages', async () => { + // web 端等待应用首页加载完成 + if (process.env.uniTestPlatformInfo.startsWith('web')) { + const waitTime = process.env.uniTestPlatformInfo.includes('safari') ? + 5000 : + 3000 + await new Promise((resolve) => { + setTimeout(() => { + resolve() + }, waitTime) + }) + } + page = await program.switchTab(HOME_PAGE_PATH) + await page.waitFor(1000) + page = await program.navigateTo(PAGE_PATH) + await page.waitFor(1000) + await page.callMethod('_getCurrentPages') + await page.waitFor(200) + const data = await page.data() + expect(data.checked).toBe(true) }) it('page-style', async () => { page = await program.navigateTo(PAGE_PATH) @@ -47,7 +47,9 @@ describe('getCurrentPages', () => { await page.callMethod('startPullDownRefresh') await page.waitFor(500) const image2 = await program.screenshot({fullPage: true}); - expect(image2).toSaveImageSnapshot(); + expect(image2).toSaveImageSnapshot({customSnapshotIdentifier() { + return 'get-current-pages-test-js-get-current-pages-page-style-before-set-page-style' + }}); await page.waitFor(3500) await page.callMethod('setPageStyle', { @@ -57,6 +59,8 @@ describe('getCurrentPages', () => { await page.callMethod('startPullDownRefresh') await page.waitFor(500) const image3 = await program.screenshot({fullPage: true}); - expect(image3).toSaveImageSnapshot(); - }) + expect(image3).toSaveImageSnapshot({customSnapshotIdentifier() { + return 'get-current-pages-test-js-get-current-pages-page-style-after-set-page-style' + }}); + }) }) diff --git a/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js b/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js index 22f5f225e651fc2eb2f2b52a604ce40d58707afe..a440c56c75171157b61f2b614a42719873bef282 100644 --- a/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js +++ b/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh.test.js @@ -27,7 +27,9 @@ describe('getCurrentPages', () => { const image3 = await program.screenshot({ fullPage: true }); - expect(image3).toSaveImageSnapshot(); + expect(image3).toSaveImageSnapshot({customSnapshotIdentifier() { + return 'set-page-style-disable-pull-down-refresh-test-js-get-current-pages-page-style-before-set-page-style' + }}); await page.waitFor(3500) @@ -39,7 +41,9 @@ describe('getCurrentPages', () => { const image2 = await program.screenshot({ fullPage: true }); - expect(image2).toSaveImageSnapshot(); + expect(image2).toSaveImageSnapshot({customSnapshotIdentifier() { + return 'set-page-style-disable-pull-down-refresh-test-js-get-current-pages-page-style-after-set-page-style' + }}); }) })