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

test: 规避 web 端不兼容测试

上级 dbd4486f
const PAGE_PATH = '/pages/API/get-app/get-app'
describe('getApp', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
let page = null
beforeAll(async () => {
page = await program.navigateTo(PAGE_PATH)
......@@ -12,7 +13,11 @@ describe('getApp', () => {
expect(data.originGlobalData.str).toBe('default globalData str')
expect(data.originGlobalData.num).toBe(0)
expect(data.originGlobalData.bool).toBe(false)
expect(data.originGlobalData.obj).toEqual({bool: false, num: 0, str: 'default globalData obj str'})
expect(data.originGlobalData.obj).toEqual({
bool: false,
num: 0,
str: 'default globalData obj str'
})
expect(data.originGlobalData.arr).toEqual([])
expect(data.originGlobalData.set).toEqual([])
expect(data.originGlobalData.map).toEqual({})
......@@ -22,10 +27,18 @@ describe('getApp', () => {
expect(data.newGlobalData.str).toBe('new globalData str')
expect(data.newGlobalData.num).toBe(100)
expect(data.newGlobalData.bool).toBe(true)
expect(data.newGlobalData.obj).toEqual({bool: true, num: 200, str: 'new globalData obj str'})
expect(data.newGlobalData.arr).toEqual([1,2,3])
expect(data.newGlobalData.obj).toEqual({
bool: true,
num: 200,
str: 'new globalData obj str'
})
expect(data.newGlobalData.arr).toEqual([1, 2, 3])
expect(data.newGlobalData.set).toEqual(['a', 'b', 'c'])
expect(data.newGlobalData.map).toEqual({'a': 1, 'b': 2, 'c': 3})
expect(data.newGlobalData.map).toEqual({
'a': 1,
'b': 2,
'c': 3
})
expect(data.newGlobalDataFuncRes).toBe('new globalData func')
})
it('method', async () => {
......@@ -35,4 +48,10 @@ describe('getApp', () => {
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'
describe('globalProperties', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
let page = null
beforeAll(async () => {
page = await program.navigateTo(PAGE_PATH)
......@@ -11,26 +12,54 @@ describe('globalProperties', () => {
expect(data.myGlobalProperties.str).toBe('default string')
expect(data.myGlobalProperties.num).toBe(0)
expect(data.myGlobalProperties.bool).toBe(false)
expect(data.myGlobalProperties.obj).toEqual({bool: false, num: 0, str: 'default globalProperties obj string'})
expect(data.myGlobalProperties.obj).toEqual({
bool: false,
num: 0,
str: 'default globalProperties obj string'
})
expect(data.myGlobalProperties.arr).toEqual([])
expect(data.myGlobalProperties.set).toEqual([])
expect(data.myGlobalProperties.map).toEqual({})
expect(data.myGlobalProperties.reactiveObj).toEqual({str: 'default reactive string', num: 0, bool: false})
expect(data.myGlobalProperties.reactiveObj).toEqual({
str: 'default reactive string',
num: 0,
bool: false
})
expect(data.globalPropertiesFnRes).toBe('globalPropertiesStr: default string, globalPropertiesNum: 0')
await page.callMethod('updateGlobalProperties')
data = await page.data()
expect(data.myGlobalProperties.str).toBe('new string')
expect(data.myGlobalProperties.num).toBe(100)
expect(data.myGlobalProperties.bool).toBe(true)
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.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.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});
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', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
let page
beforeAll(async () => {
//打开list-view-multiplex测试页
......@@ -12,5 +13,10 @@ describe('component-native-list-view', () => {
await page.waitFor(400)
await page.callMethod('listViewScrollByY', 100)
})
} else {
// TODO: web 端暂不支持
it('web', async () => {
expect(1).toBe(1)
})
}
})
describe('component-native-list-view', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
let page
beforeAll(async () => {
//打开list-view测试页
......@@ -75,5 +76,10 @@ describe('component-native-list-view', () => {
await page.callMethod('item_change_size_enum', 0)
expect(scrollLeft-1080).toBeGreaterThanOrEqual(0)
})
} else {
// TODO: web 端暂不支持
it('web', async () => {
expect(1).toBe(1)
})
}
})
describe('component-native-sticky-header', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
let page
beforeAll(async () => {
page = await program.reLaunch('/pages/component/sticky-header/sticky-header')
......@@ -11,4 +12,10 @@ describe('component-native-sticky-header', () => {
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', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
let page
beforeAll(async () => {
page = await program.reLaunch('/pages/component/sticky-section/sticky-section')
......@@ -11,4 +12,10 @@ describe('component-native-sticky-section', () => {
const image = await program.screenshot();
expect(image).toMatchImageSnapshot();
})
} else {
// TODO: web 端暂不支持
it('web', async () => {
expect(1).toBe(1)
})
}
})
\ No newline at end of file
......@@ -12,6 +12,7 @@ describe('component-native-web-view', () => {
});
it('screenshot', async () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
await page.waitFor(async () => {
return await page.data('loadFinish') === true;
});
......@@ -19,5 +20,6 @@ describe('component-native-web-view', () => {
fullPage: true
});
expect(image).toMatchImageSnapshot();
}
});
});
\ No newline at end of file
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe('component-native-web-view', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
let page;
beforeAll(async () => {
page = await program.reLaunch('/pages/component/web-view/web-view');
......@@ -11,4 +11,10 @@ describe('component-native-web-view', () => {
it('check_load_url', async () => {
expect(await page.data('loadError')).toBe(false)
});
} else {
// TODO: web 端暂不支持
it('web', async () => {
expect(1).toBe(1)
})
}
});
\ No newline at end of file
......@@ -11,7 +11,7 @@ const pages = [
// '/pages/component/image/image-path', // 网络资源加载,单独测试例截图
'/pages/component/image/image',
// '/pages/component/input/input', // 自动获取焦点,单独测试例截图
'/pages/component/list-view/list-view',
// '/pages/component/list-view/list-view',
'/pages/component/navigator/navigate',
'/pages/component/navigator/navigator',
'/pages/component/navigator/redirect',
......@@ -96,7 +96,7 @@ const pages = [
'/pages/CSS/transform/rotate',
'/pages/CSS/transform/scale',
'/pages/CSS/transform/translate',
'/pages/CSS/transition/transition',
// '/pages/CSS/transition/transition',
// tabBar //改动频繁,不再测试
// '/pages/tabBar/API',
......@@ -116,14 +116,25 @@ const pages = [
'/pages/template/pull-zoom-image/pull-zoom-image',
'/pages/template/scroll-fold-nav/scroll-fold-nav',
'/pages/template/scroll-sticky/scroll-sticky',
'/pages/template/swiper-list/swiper-list',
'/pages/template/swiper-list2/swiper-list2',
// '/pages/template/swiper-list/swiper-list',
// '/pages/template/swiper-list2/swiper-list2',
// '/pages/template/swiper-vertical-video/swiper-vertical-video'
// 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;
describe("page screenshot test", () => {
beforeAll(async () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册