You need to sign in or sign up before continuing.
提交 c250c8be 编写于 作者: D DCloud_LXH

chore(test): video

上级 7bdc0eea
...@@ -29,12 +29,14 @@ describe('component-native-video', () => { ...@@ -29,12 +29,14 @@ describe('component-native-video', () => {
expect(await page.data('isError')).toBe(false); expect(await page.data('isError')).toBe(false);
// play // play
await page.callMethod('play'); await page.callMethod('play');
await page.waitFor(100); await page.waitFor(async () => {
expect(await page.data('isPlaying')).toBe(true); return await page.data('isPlaying');
});
// pause // pause
await page.callMethod('pause'); await page.callMethod('pause');
await page.waitFor(100); await page.waitFor(async () => {
expect(await page.data('isPause')).toBe(true); return await page.data('isPause');
});
}); });
if (!isMP) { if (!isMP) {
...@@ -102,12 +104,16 @@ describe('component-native-video', () => { ...@@ -102,12 +104,16 @@ describe('component-native-video', () => {
} }
} }
it('test event play pause controlstoggle', async () => { it('test event play pause controlstoggle', async () => {
await page.setData({ await page.setData({
isPause: false,
isPlaying: false,
autoTest: true, autoTest: true,
}); });
await page.callMethod('play'); await page.callMethod('play');
start = Date.now(); start = Date.now();
await page.waitFor(1000); await page.waitFor(async () => {
return await page.data('isPlaying');
});
await page.waitFor(async () => { await page.waitFor(async () => {
return (await page.data('eventPlay')) || (Date.now() - start > 500); return (await page.data('eventPlay')) || (Date.now() - start > 500);
}); });
...@@ -122,7 +128,10 @@ describe('component-native-video', () => { ...@@ -122,7 +128,10 @@ describe('component-native-video', () => {
}); });
} }
await page.callMethod('pause'); await page.callMethod('pause');
start = Date.now(); start = Date.now();
await page.waitFor(async () => {
return await page.data('isPause');
});
await page.waitFor(async () => { await page.waitFor(async () => {
return (await page.data('eventPause')) || (Date.now() - start > 1000); return (await page.data('eventPause')) || (Date.now() - start > 1000);
}); });
...@@ -235,7 +244,7 @@ describe('component-native-video', () => { ...@@ -235,7 +244,7 @@ describe('component-native-video', () => {
type: 'ended' type: 'ended'
}); });
} }
await page.waitFor(1000); await page.waitFor(3000);
const infos = process.env.uniTestPlatformInfo.split(' '); const infos = process.env.uniTestPlatformInfo.split(' ');
const version = parseInt(infos[infos.length - 1]); const version = parseInt(infos[infos.length - 1]);
if ((isAndroid && version > 5) || isHarmony) { if ((isAndroid && version > 5) || isHarmony) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册