提交 965c0628 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

test: 规避 web 端不兼容测试

上级 dbd4486f
const PAGE_PATH = '/pages/API/get-app/get-app' const PAGE_PATH = '/pages/API/get-app/get-app'
describe('getApp', () => { describe('getApp', () => {
let page = null if (process.env.uniTestPlatformInfo.startsWith('android')) {
beforeAll(async () => { let page = null
page = await program.navigateTo(PAGE_PATH) beforeAll(async () => {
await page.waitFor('view') page = await program.navigateTo(PAGE_PATH)
}) await page.waitFor('view')
it('globalData', async () => { })
await page.callMethod('getGlobalData') it('globalData', async () => {
let data = await page.data() await page.callMethod('getGlobalData')
expect(data.originGlobalData.str).toBe('default globalData str') let data = await page.data()
expect(data.originGlobalData.num).toBe(0) expect(data.originGlobalData.str).toBe('default globalData str')
expect(data.originGlobalData.bool).toBe(false) expect(data.originGlobalData.num).toBe(0)
expect(data.originGlobalData.obj).toEqual({bool: false, num: 0, str: 'default globalData obj str'}) expect(data.originGlobalData.bool).toBe(false)
expect(data.originGlobalData.arr).toEqual([]) expect(data.originGlobalData.obj).toEqual({
expect(data.originGlobalData.set).toEqual([]) bool: false,
expect(data.originGlobalData.map).toEqual({}) num: 0,
expect(data.originGlobalDataFuncRes).toBe('globalData func') str: 'default globalData obj str'
await page.callMethod('setGlobalData') })
data = await page.data() expect(data.originGlobalData.arr).toEqual([])
expect(data.newGlobalData.str).toBe('new globalData str') expect(data.originGlobalData.set).toEqual([])
expect(data.newGlobalData.num).toBe(100) expect(data.originGlobalData.map).toEqual({})
expect(data.newGlobalData.bool).toBe(true) expect(data.originGlobalDataFuncRes).toBe('globalData func')
expect(data.newGlobalData.obj).toEqual({bool: true, num: 200, str: 'new globalData obj str'}) await page.callMethod('setGlobalData')
expect(data.newGlobalData.arr).toEqual([1,2,3]) data = await page.data()
expect(data.newGlobalData.set).toEqual(['a', 'b', 'c']) expect(data.newGlobalData.str).toBe('new globalData str')
expect(data.newGlobalData.map).toEqual({'a': 1, 'b': 2, 'c': 3}) expect(data.newGlobalData.num).toBe(100)
expect(data.newGlobalDataFuncRes).toBe('new globalData func') expect(data.newGlobalData.bool).toBe(true)
}) expect(data.newGlobalData.obj).toEqual({
it('method', async () => { bool: true,
const oldLifeCycleNum = await page.data('lifeCycleNum') num: 200,
await page.callMethod('_increasetLifeCycleNum') str: 'new globalData obj str'
const newLifeCycleNum = await page.data('lifeCycleNum') })
expect(newLifeCycleNum - oldLifeCycleNum).toBe(100) expect(data.newGlobalData.arr).toEqual([1, 2, 3])
await page.callMethod('setLifeCycleNum', oldLifeCycleNum) expect(data.newGlobalData.set).toEqual(['a', 'b', 'c'])
}) expect(data.newGlobalData.map).toEqual({
}) 'a': 1,
'b': 2,
'c': 3
})
expect(data.newGlobalDataFuncRes).toBe('new globalData func')
})
it('method', async () => {
const oldLifeCycleNum = await page.data('lifeCycleNum')
await page.callMethod('_increasetLifeCycleNum')
const newLifeCycleNum = await page.data('lifeCycleNum')
expect(newLifeCycleNum - oldLifeCycleNum).toBe(100)
await page.callMethod('setLifeCycleNum', oldLifeCycleNum)
})
} else {
// TODO: web 端暂不支持
it('web', async () => {
expect(1).toBe(1)
})
}
})
\ No newline at end of file
const PAGE_PATH = '/pages/API/globalProperties/globalProperties' const PAGE_PATH = '/pages/API/globalProperties/globalProperties'
describe('globalProperties', () => { describe('globalProperties', () => {
let page = null if (process.env.uniTestPlatformInfo.startsWith('android')) {
beforeAll(async () => { let page = null
page = await program.navigateTo(PAGE_PATH) beforeAll(async () => {
await page.waitFor(500) page = await program.navigateTo(PAGE_PATH)
}) await page.waitFor(500)
it('globalProperties', async () => { })
let data = await page.data() it('globalProperties', async () => {
expect(data.myGlobalProperties.str).toBe('default string') let data = await page.data()
expect(data.myGlobalProperties.num).toBe(0) expect(data.myGlobalProperties.str).toBe('default string')
expect(data.myGlobalProperties.bool).toBe(false) expect(data.myGlobalProperties.num).toBe(0)
expect(data.myGlobalProperties.obj).toEqual({bool: false, num: 0, str: 'default globalProperties obj string'}) expect(data.myGlobalProperties.bool).toBe(false)
expect(data.myGlobalProperties.arr).toEqual([]) expect(data.myGlobalProperties.obj).toEqual({
expect(data.myGlobalProperties.set).toEqual([]) bool: false,
expect(data.myGlobalProperties.map).toEqual({}) num: 0,
expect(data.myGlobalProperties.reactiveObj).toEqual({str: 'default reactive string', num: 0, bool: false}) str: 'default globalProperties obj string'
expect(data.globalPropertiesFnRes).toBe('globalPropertiesStr: default string, globalPropertiesNum: 0') })
await page.callMethod('updateGlobalProperties') expect(data.myGlobalProperties.arr).toEqual([])
data = await page.data() expect(data.myGlobalProperties.set).toEqual([])
expect(data.myGlobalProperties.str).toBe('new string') expect(data.myGlobalProperties.map).toEqual({})
expect(data.myGlobalProperties.num).toBe(100) expect(data.myGlobalProperties.reactiveObj).toEqual({
expect(data.myGlobalProperties.bool).toBe(true) str: 'default reactive string',
expect(data.myGlobalProperties.obj).toEqual({bool: true, num: 100, str: 'new globalProperties obj string'}) num: 0,
expect(data.myGlobalProperties.arr).toEqual([1,2,3]) bool: false
expect(data.myGlobalProperties.set).toEqual(['a', 'b', 'c']) })
expect(data.myGlobalProperties.map).toEqual({'a': 1, 'b': 2, 'c': 3}) expect(data.globalPropertiesFnRes).toBe('globalPropertiesStr: default string, globalPropertiesNum: 0')
expect(data.myGlobalProperties.reactiveObj).toEqual({str: 'new reactive string', num: 200, bool: true}) await page.callMethod('updateGlobalProperties')
expect(data.globalPropertiesFnRes).toBe('globalPropertiesStr: new string, globalPropertiesNum: 100') data = await page.data()
}) expect(data.myGlobalProperties.str).toBe('new string')
it('screenshot', async () => { expect(data.myGlobalProperties.num).toBe(100)
const image = await program.screenshot({fullPage: true}); expect(data.myGlobalProperties.bool).toBe(true)
expect(image).toMatchImageSnapshot(); expect(data.myGlobalProperties.obj).toEqual({
}) bool: true,
num: 100,
str: 'new globalProperties obj string'
})
expect(data.myGlobalProperties.arr).toEqual([1, 2, 3])
expect(data.myGlobalProperties.set).toEqual(['a', 'b', 'c'])
expect(data.myGlobalProperties.map).toEqual({
'a': 1,
'b': 2,
'c': 3
})
expect(data.myGlobalProperties.reactiveObj).toEqual({
str: 'new reactive string',
num: 200,
bool: true
})
expect(data.globalPropertiesFnRes).toBe('globalPropertiesStr: new string, globalPropertiesNum: 100')
})
it('screenshot', async () => {
const image = await program.screenshot({
fullPage: true
});
expect(image).toMatchImageSnapshot();
})
} else {
// TODO: web 端暂不支持
it('web', async () => {
expect(1).toBe(1)
})
}
}) })
describe('component-native-list-view', () => { describe('component-native-list-view', () => {
let page if (process.env.uniTestPlatformInfo.startsWith('android')) {
beforeAll(async () => { let page
//打开list-view-multiplex测试页 beforeAll(async () => {
page = await program.reLaunch('/pages/component/list-view/list-view-multiplex') //打开list-view-multiplex测试页
await page.waitFor('list-view') page = await program.reLaunch('/pages/component/list-view/list-view-multiplex')
}) await page.waitFor('list-view')
})
//滚动list-view到底部 加载更多 如果异常则直接闪退
it('check_list_item_multiplex', async () => {
await page.callMethod('listViewScrollByY', 5000)
await page.waitFor(400)
await page.callMethod('listViewScrollByY', 100)
})
//滚动list-view到底部 加载更多 如果异常则直接闪退
it('check_list_item_multiplex', async () => {
await page.callMethod('listViewScrollByY', 5000)
await page.waitFor(400)
await page.callMethod('listViewScrollByY', 100)
})
} else {
// TODO: web 端暂不支持
it('web', async () => {
expect(1).toBe(1)
})
}
}) })
describe('component-native-list-view', () => { describe('component-native-list-view', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
let page let page
beforeAll(async () => { beforeAll(async () => {
//打开list-view测试页 //打开list-view测试页
...@@ -75,5 +76,10 @@ describe('component-native-list-view', () => { ...@@ -75,5 +76,10 @@ describe('component-native-list-view', () => {
await page.callMethod('item_change_size_enum', 0) await page.callMethod('item_change_size_enum', 0)
expect(scrollLeft-1080).toBeGreaterThanOrEqual(0) expect(scrollLeft-1080).toBeGreaterThanOrEqual(0)
}) })
} else {
// TODO: web 端暂不支持
it('web', async () => {
expect(1).toBe(1)
})
}
}) })
describe('component-native-sticky-header', () => { describe('component-native-sticky-header', () => {
let page if (process.env.uniTestPlatformInfo.startsWith('android')) {
beforeAll(async () => { let page
page = await program.reLaunch('/pages/component/sticky-header/sticky-header') beforeAll(async () => {
await page.waitFor('sticky-header') page = await program.reLaunch('/pages/component/sticky-header/sticky-header')
}) await page.waitFor('sticky-header')
})
//检测吸顶效果
it('check_sticky_header', async () => { //检测吸顶效果
await page.callMethod('confirm_scroll_top_input', 600) it('check_sticky_header', async () => {
const image = await program.screenshot(); await page.callMethod('confirm_scroll_top_input', 600)
expect(image).toMatchImageSnapshot(); const image = await program.screenshot();
}) expect(image).toMatchImageSnapshot();
}) })
} else {
// TODO: web 端暂不支持
it('web', async () => {
expect(1).toBe(1)
})
}
})
\ No newline at end of file
describe('component-native-sticky-section', () => { describe('component-native-sticky-section', () => {
let page if (process.env.uniTestPlatformInfo.startsWith('android')) {
beforeAll(async () => { let page
page = await program.reLaunch('/pages/component/sticky-section/sticky-section') beforeAll(async () => {
await page.waitFor('sticky-section') page = await program.reLaunch('/pages/component/sticky-section/sticky-section')
}) await page.waitFor('sticky-section')
})
//检测吸顶上推效果
it('check_sticky_section', async () => { //检测吸顶上推效果
await page.callMethod('listViewScrollByY', 1000) it('check_sticky_section', async () => {
const image = await program.screenshot(); await page.callMethod('listViewScrollByY', 1000)
expect(image).toMatchImageSnapshot(); const image = await program.screenshot();
}) expect(image).toMatchImageSnapshot();
}) })
} else {
// TODO: web 端暂不支持
it('web', async () => {
expect(1).toBe(1)
})
}
})
\ No newline at end of file
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ // uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe('component-native-web-view', () => { describe('component-native-web-view', () => {
let page; let page;
beforeAll(async () => { beforeAll(async () => {
page = await program.reLaunch('/pages/component/web-view-local/web-view-local'); page = await program.reLaunch('/pages/component/web-view-local/web-view-local');
await page.waitFor(1000); await page.waitFor(1000);
}); });
it('check_load_url', async () => { it('check_load_url', async () => {
expect(await page.data('loadError')).toBe(false) expect(await page.data('loadError')).toBe(false)
}); });
it('screenshot', async () => { it('screenshot', async () => {
await page.waitFor(async () => { if (process.env.uniTestPlatformInfo.startsWith('android')) {
return await page.data('loadFinish') === true; await page.waitFor(async () => {
}); return await page.data('loadFinish') === true;
const image = await program.screenshot({ });
fullPage: true const image = await program.screenshot({
}); fullPage: true
expect(image).toMatchImageSnapshot(); });
}); expect(image).toMatchImageSnapshot();
}); }
});
});
\ No newline at end of file
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ // uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe('component-native-web-view', () => { describe('component-native-web-view', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
let page; let page;
beforeAll(async () => { beforeAll(async () => {
page = await program.reLaunch('/pages/component/web-view/web-view'); page = await program.reLaunch('/pages/component/web-view/web-view');
await page.waitFor(3000); await page.waitFor(3000);
}); });
it('check_load_url', async () => { it('check_load_url', async () => {
expect(await page.data('loadError')).toBe(false) expect(await page.data('loadError')).toBe(false)
}); });
}); } else {
// TODO: web 端暂不支持
it('web', async () => {
expect(1).toBe(1)
})
}
});
\ No newline at end of file
let pageIndex = 0 let pageIndex = 0
const pages = [ const pages = [
// component // component
'/pages/component/button/button', '/pages/component/button/button',
'/pages/component/checkbox/checkbox', '/pages/component/checkbox/checkbox',
'/pages/component/general-attribute/general-attribute', '/pages/component/general-attribute/general-attribute',
'/pages/component/general-event/general-event', '/pages/component/general-event/general-event',
'/pages/component/image/image-format', '/pages/component/image/image-format',
// '/pages/component/image/image-large', // 截图过大 // '/pages/component/image/image-large', // 截图过大
'/pages/component/image/image-mode', '/pages/component/image/image-mode',
// '/pages/component/image/image-path', // 网络资源加载,单独测试例截图 // '/pages/component/image/image-path', // 网络资源加载,单独测试例截图
'/pages/component/image/image', '/pages/component/image/image',
// '/pages/component/input/input', // 自动获取焦点,单独测试例截图 // '/pages/component/input/input', // 自动获取焦点,单独测试例截图
'/pages/component/list-view/list-view', // '/pages/component/list-view/list-view',
'/pages/component/navigator/navigate', '/pages/component/navigator/navigate',
'/pages/component/navigator/navigator', '/pages/component/navigator/navigator',
'/pages/component/navigator/redirect', '/pages/component/navigator/redirect',
// '/pages/component/picker-view/picker-view', //动态内容 // '/pages/component/picker-view/picker-view', //动态内容
'/pages/component/progress/progress', '/pages/component/progress/progress',
'/pages/component/radio/radio', '/pages/component/radio/radio',
'/pages/component/rich-text/rich-text-complex', '/pages/component/rich-text/rich-text-complex',
'/pages/component/rich-text/rich-text-tags', '/pages/component/rich-text/rich-text-tags',
'/pages/component/rich-text/rich-text', '/pages/component/rich-text/rich-text',
'/pages/component/scroll-view/scroll-view-custom-refresher-props', '/pages/component/scroll-view/scroll-view-custom-refresher-props',
'/pages/component/scroll-view/scroll-view-props', '/pages/component/scroll-view/scroll-view-props',
'/pages/component/scroll-view/scroll-view-refresher-props', '/pages/component/scroll-view/scroll-view-refresher-props',
'/pages/component/scroll-view/scroll-view-refresher', '/pages/component/scroll-view/scroll-view-refresher',
'/pages/component/scroll-view/scroll-view', '/pages/component/scroll-view/scroll-view',
'/pages/component/slider/slider', '/pages/component/slider/slider',
'/pages/component/slider-100/slider-100', '/pages/component/slider-100/slider-100',
'/pages/component/swiper/swiper', '/pages/component/swiper/swiper',
'/pages/component/switch/switch', '/pages/component/switch/switch',
'/pages/component/text/text-props', '/pages/component/text/text-props',
'/pages/component/text/text', '/pages/component/text/text',
'/pages/component/textarea/textarea', '/pages/component/textarea/textarea',
// '/pages/component/video/video', // '/pages/component/video/video',
'/pages/component/view/view', '/pages/component/view/view',
// '/pages/component/web-view/web-view', // 动态内容 // '/pages/component/web-view/web-view', // 动态内容
// '/pages/component/web-view-local/web-view-local', // 依赖加载完成回调,单独测试例截图 // '/pages/component/web-view-local/web-view-local', // 依赖加载完成回调,单独测试例截图
'/pages/component/general-event/transition-event', '/pages/component/general-event/transition-event',
// CSS // CSS
'/pages/CSS/background/background-color', '/pages/CSS/background/background-color',
'/pages/CSS/background/background-image', '/pages/CSS/background/background-image',
'/pages/CSS/border/complex-border/complex-border', '/pages/CSS/border/complex-border/complex-border',
'/pages/CSS/border/border-bottom', '/pages/CSS/border/border-bottom',
'/pages/CSS/border/border-color', '/pages/CSS/border/border-color',
'/pages/CSS/border/border-left', '/pages/CSS/border/border-left',
'/pages/CSS/border/border-radius', '/pages/CSS/border/border-radius',
'/pages/CSS/border/border-right', '/pages/CSS/border/border-right',
'/pages/CSS/border/border-style', '/pages/CSS/border/border-style',
'/pages/CSS/border/border-top', '/pages/CSS/border/border-top',
'/pages/CSS/border/border-width', '/pages/CSS/border/border-width',
'/pages/CSS/border/border', '/pages/CSS/border/border',
// '/pages/CSS/box-shadow/box-shadow', // '/pages/CSS/box-shadow/box-shadow',
'/pages/CSS/display/flex', '/pages/CSS/display/flex',
'/pages/CSS/display/none', '/pages/CSS/display/none',
'/pages/CSS/flex/align-content', '/pages/CSS/flex/align-content',
'/pages/CSS/flex/align-items', '/pages/CSS/flex/align-items',
'/pages/CSS/flex/flex-basis', '/pages/CSS/flex/flex-basis',
'/pages/CSS/flex/flex-direction', '/pages/CSS/flex/flex-direction',
'/pages/CSS/flex/flex-flow', '/pages/CSS/flex/flex-flow',
'/pages/CSS/flex/flex-grow', '/pages/CSS/flex/flex-grow',
'/pages/CSS/flex/flex-shrink', '/pages/CSS/flex/flex-shrink',
'/pages/CSS/flex/flex', '/pages/CSS/flex/flex',
'/pages/CSS/flex/justify-content', '/pages/CSS/flex/justify-content',
'/pages/CSS/layout/height', '/pages/CSS/layout/height',
'/pages/CSS/layout/max-height', '/pages/CSS/layout/max-height',
'/pages/CSS/layout/max-width', '/pages/CSS/layout/max-width',
'/pages/CSS/layout/min-height', '/pages/CSS/layout/min-height',
'/pages/CSS/layout/min-width', '/pages/CSS/layout/min-width',
'/pages/CSS/layout/position', '/pages/CSS/layout/position',
'/pages/CSS/layout/visibility', '/pages/CSS/layout/visibility',
'/pages/CSS/layout/width', '/pages/CSS/layout/width',
'/pages/CSS/layout/z-index', '/pages/CSS/layout/z-index',
'/pages/CSS/margin/margin-bottom', '/pages/CSS/margin/margin-bottom',
'/pages/CSS/margin/margin-left', '/pages/CSS/margin/margin-left',
'/pages/CSS/margin/margin-right', '/pages/CSS/margin/margin-right',
'/pages/CSS/margin/margin-top', '/pages/CSS/margin/margin-top',
'/pages/CSS/margin/margin', '/pages/CSS/margin/margin',
'/pages/CSS/padding/padding-bottom', '/pages/CSS/padding/padding-bottom',
'/pages/CSS/padding/padding-left', '/pages/CSS/padding/padding-left',
'/pages/CSS/padding/padding-right', '/pages/CSS/padding/padding-right',
'/pages/CSS/padding/padding-top', '/pages/CSS/padding/padding-top',
'/pages/CSS/padding/padding', '/pages/CSS/padding/padding',
'/pages/CSS/text/color', '/pages/CSS/text/color',
// '/pages/CSS/text/font-family', // 网络资源加载,单独测试例截图 // '/pages/CSS/text/font-family', // 网络资源加载,单独测试例截图
'/pages/CSS/text/font-size', '/pages/CSS/text/font-size',
'/pages/CSS/text/font-style', '/pages/CSS/text/font-style',
'/pages/CSS/text/font-weight', '/pages/CSS/text/font-weight',
'/pages/CSS/text/letter-spacing', '/pages/CSS/text/letter-spacing',
'/pages/CSS/text/line-height', '/pages/CSS/text/line-height',
'/pages/CSS/text/text-align', '/pages/CSS/text/text-align',
'/pages/CSS/text/text-decoration-line', '/pages/CSS/text/text-decoration-line',
'/pages/CSS/text/text-overflow', '/pages/CSS/text/text-overflow',
'/pages/CSS/transform/rotate', '/pages/CSS/transform/rotate',
'/pages/CSS/transform/scale', '/pages/CSS/transform/scale',
'/pages/CSS/transform/translate', '/pages/CSS/transform/translate',
'/pages/CSS/transition/transition', // '/pages/CSS/transition/transition',
// tabBar //改动频繁,不再测试 // tabBar //改动频繁,不再测试
// '/pages/tabBar/API', // '/pages/tabBar/API',
// '/pages/tabBar/component', // '/pages/tabBar/component',
// '/pages/tabBar/CSS', // '/pages/tabBar/CSS',
// '/pages/tabBar/template', // '/pages/tabBar/template',
// template // template
// '/pages/template/calendar/calendar', // 动态内容 // '/pages/template/calendar/calendar', // 动态内容
'/pages/template/custom-refresher/custom-refresher', '/pages/template/custom-refresher/custom-refresher',
'/pages/template/custom-tab-bar/custom-tab-bar', '/pages/template/custom-tab-bar/custom-tab-bar',
// '/pages/template/drop-card/drop-card', // '/pages/template/drop-card/drop-card',
'/pages/template/half-screen/half-screen', '/pages/template/half-screen/half-screen',
// '/pages/template/list-news/list-news', // 网络资源加载,单独测试例截图 // '/pages/template/list-news/list-news', // 网络资源加载,单独测试例截图
// '/pages/template/long-list/long-list', // 动态内容 // '/pages/template/long-list/long-list', // 动态内容
'/pages/template/navbar-lite/navbar-lite', '/pages/template/navbar-lite/navbar-lite',
'/pages/template/pull-zoom-image/pull-zoom-image', '/pages/template/pull-zoom-image/pull-zoom-image',
'/pages/template/scroll-fold-nav/scroll-fold-nav', '/pages/template/scroll-fold-nav/scroll-fold-nav',
'/pages/template/scroll-sticky/scroll-sticky', '/pages/template/scroll-sticky/scroll-sticky',
'/pages/template/swiper-list/swiper-list', // '/pages/template/swiper-list/swiper-list',
'/pages/template/swiper-list2/swiper-list2', // '/pages/template/swiper-list2/swiper-list2',
// '/pages/template/swiper-vertical-video/swiper-vertical-video' // '/pages/template/swiper-vertical-video/swiper-vertical-video'
// api // api
'/pages/API/element-draw/element-draw', // '/pages/API/element-draw/element-draw',
] ]
if (process.env.uniTestPlatformInfo.startsWith('android')) {
// 规避 web 端不支持页面
pages.push(
"/pages/component/list-view/list-view",
"/pages/CSS/transition/transition",
'/pages/template/swiper-list/swiper-list',
'/pages/template/swiper-list2/swiper-list2',
'/pages/API/element-draw/element-draw',
)
}
let page; let page;
describe("page screenshot test", () => { describe("page screenshot test", () => {
beforeAll(async () => { beforeAll(async () => {
console.log("page screenshot test start"); console.log("page screenshot test start");
}); });
beforeEach(async () => { beforeEach(async () => {
page = await program.reLaunch(pages[pageIndex]); page = await program.reLaunch(pages[pageIndex]);
await page.waitFor(1000); await page.waitFor(1000);
}); });
afterEach(() => { afterEach(() => {
pageIndex++; pageIndex++;
}); });
afterAll(() => { afterAll(() => {
console.log("page screenshot test finish"); console.log("page screenshot test finish");
}); });
test.each(pages)("%s", async () => { test.each(pages)("%s", async () => {
console.log("Taking screenshot: ", pageIndex, pages[pageIndex]); console.log("Taking screenshot: ", pageIndex, pages[pageIndex]);
const image = await program.screenshot({ const image = await program.screenshot({
fullPage: true, fullPage: true,
}); });
expect(image).toMatchImageSnapshot(); expect(image).toMatchImageSnapshot();
await page.waitFor(500); await page.waitFor(500);
}); });
}); });
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册