提交 1d719c64 编写于 作者: 雪洛's avatar 雪洛

test: 测试与示例适配微信小程序

上级 6871defc
...@@ -82,7 +82,7 @@ describe('component-native-image', () => { ...@@ -82,7 +82,7 @@ describe('component-native-image', () => {
return (await page.data('eventLoad')) || (Date.now() - start > 1000); return (await page.data('eventLoad')) || (Date.now() - start > 1000);
}); });
expect(await page.data('eventLoad')).toEqual({ expect(await page.data('eventLoad')).toEqual({
tagName: isMP ? undefined : 'IMAGE', tagName: isMP ? '' : 'IMAGE',
type: 'load', type: 'load',
width: 10, width: 10,
height: 10 height: 10
...@@ -98,7 +98,7 @@ describe('component-native-image', () => { ...@@ -98,7 +98,7 @@ describe('component-native-image', () => {
return (await page.data('eventError')) || (Date.now() - start > 1000); return (await page.data('eventError')) || (Date.now() - start > 1000);
}); });
expect(await page.data('eventError')).toEqual({ expect(await page.data('eventError')).toEqual({
tagName: isMP ? undefined : 'IMAGE', tagName: isMP ? '' : 'IMAGE',
type: 'error' type: 'error'
}); });
......
const PAGE_PATH = '/pages/component/text/text-props' const PAGE_PATH = '/pages/component/text/text-props'
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isMP = platformInfo.startsWith('mp')
const isWeb = platformInfo.startsWith('web')
describe('text-props', () => { describe('text-props', () => {
let page let page
beforeAll(async () => { beforeAll(async () => {
...@@ -47,7 +51,8 @@ describe('text-props', () => { ...@@ -47,7 +51,8 @@ describe('text-props', () => {
await page.callMethod("setNestedText") await page.callMethod("setNestedText")
await page.waitFor(100) await page.waitFor(100)
const element = await page.$('#nested-text') const element = await page.$('#nested-text')
if (element != null) { if (!isMP && element != null) {
// TODO 微信小程序端疑似自动化测试框架Bug,此处text方法会返回`"修改三级节点文本修改三级节点文本"`,手动测试未发现问题
expect(await element.text()).toBe("修改三级节点文本") expect(await element.text()).toBe("修改三级节点文本")
} }
await page.setData({ await page.setData({
......
...@@ -85,7 +85,7 @@ describe('component-native-video', () => { ...@@ -85,7 +85,7 @@ describe('component-native-video', () => {
// }); // });
} else { } else {
expect(await page.data('eventPlay')).toEqual({ expect(await page.data('eventPlay')).toEqual({
tagName: isMP ? undefined : 'VIDEO', tagName: 'VIDEO',
type: 'play' type: 'play'
}); });
} }
...@@ -100,7 +100,7 @@ describe('component-native-video', () => { ...@@ -100,7 +100,7 @@ describe('component-native-video', () => {
// }); // });
} else { } else {
expect(await page.data('eventPause')).toEqual({ expect(await page.data('eventPause')).toEqual({
tagName: isMP ? undefined : 'VIDEO', tagName: 'VIDEO',
type: 'pause' type: 'pause'
}); });
} }
...@@ -122,7 +122,7 @@ describe('component-native-video', () => { ...@@ -122,7 +122,7 @@ describe('component-native-video', () => {
// }); // });
} else { } else {
expect(await page.data('eventControlstoggle')).toEqual({ expect(await page.data('eventControlstoggle')).toEqual({
tagName: isMP ? undefined : 'VIDEO', tagName: 'VIDEO',
type: 'controlstoggle', type: 'controlstoggle',
show: true show: true
}); });
...@@ -141,11 +141,11 @@ describe('component-native-video', () => { ...@@ -141,11 +141,11 @@ describe('component-native-video', () => {
start > 1000); start > 1000);
}); });
expect(await page.data('eventWaiting')).toEqual({ expect(await page.data('eventWaiting')).toEqual({
tagName: isMP ? undefined : 'VIDEO', tagName: 'VIDEO',
type: 'waiting' type: 'waiting'
}); });
expect(await page.data('eventProgress')).toEqual({ expect(await page.data('eventProgress')).toEqual({
tagName: isMP ? undefined : 'VIDEO', tagName: 'VIDEO',
type: 'progress', type: 'progress',
isBufferedValid: true isBufferedValid: true
}); });
...@@ -158,7 +158,7 @@ describe('component-native-video', () => { ...@@ -158,7 +158,7 @@ describe('component-native-video', () => {
return (await page.data('eventFullscreenchange')) || (Date.now() - start > 1000); return (await page.data('eventFullscreenchange')) || (Date.now() - start > 1000);
}); });
expect(await page.data('eventFullscreenchange')).toEqual({ expect(await page.data('eventFullscreenchange')).toEqual({
tagName: isMP ? undefined : 'VIDEO', tagName: 'VIDEO',
type: 'fullscreenchange', type: 'fullscreenchange',
fullScreen: true, fullScreen: true,
direction: 'horizontal' direction: 'horizontal'
...@@ -179,7 +179,7 @@ describe('component-native-video', () => { ...@@ -179,7 +179,7 @@ describe('component-native-video', () => {
const res2 = await program.adbCommand('wm density'); const res2 = await program.adbCommand('wm density');
const scale = res2.data.split(' ').at(-1) / 160; const scale = res2.data.split(' ').at(-1) / 160;
expect(await page.data('eventFullscreenclick')).toEqual({ expect(await page.data('eventFullscreenclick')).toEqual({
tagName: isMP ? undefined : 'VIDEO', tagName: 'VIDEO',
type: 'fullscreenclick', type: 'fullscreenclick',
screenX: parseInt(10 / scale), screenX: parseInt(10 / scale),
screenY: parseInt(10 / scale), screenY: parseInt(10 / scale),
...@@ -197,7 +197,7 @@ describe('component-native-video', () => { ...@@ -197,7 +197,7 @@ describe('component-native-video', () => {
return (await page.data('eventEnded')) || (Date.now() - start > 30000); return (await page.data('eventEnded')) || (Date.now() - start > 30000);
}); });
expect(await page.data('eventEnded')).toEqual({ expect(await page.data('eventEnded')).toEqual({
tagName: isMP ? undefined : 'VIDEO', tagName: 'VIDEO',
type: 'ended' type: 'ended'
}); });
const infos = process.env.uniTestPlatformInfo.split(' '); const infos = process.env.uniTestPlatformInfo.split(' ');
...@@ -208,7 +208,7 @@ describe('component-native-video', () => { ...@@ -208,7 +208,7 @@ describe('component-native-video', () => {
return (await page.data('eventTimeupdate')) || (Date.now() - start > 500); return (await page.data('eventTimeupdate')) || (Date.now() - start > 500);
}); });
expect(await page.data('eventTimeupdate')).toEqual({ expect(await page.data('eventTimeupdate')).toEqual({
tagName: isMP ? undefined : 'VIDEO', tagName: 'VIDEO',
type: 'timeupdate', type: 'timeupdate',
currentTime: 121, currentTime: 121,
duration: 121 duration: 121
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册