提交 28149372 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬 提交者: 雪洛

test(getCurrentPages): 补充 toSaveImageSnapshot 自定义文件名示例

上级 2c76acf5
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'
}});
})
})
......@@ -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'
}});
})
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册