提交 b9e3c0cd 编写于 作者: Anne_LXM's avatar Anne_LXM

test(create-inner-audio-context.test.js):调整waitFor时间

上级 031a07d9
...@@ -20,7 +20,8 @@ describe('inner-audio', () => { ...@@ -20,7 +20,8 @@ describe('inner-audio', () => {
it('play-onPlay-onTimeUpdate', async () => { it('play-onPlay-onTimeUpdate', async () => {
await page.callMethod('play') await page.callMethod('play')
await page.waitFor(3000); const waitTime = process.env.uniTestPlatformInfo.includes('chrome') ? 5000:3000
await page.waitFor(waitTime)
expect(await page.data('isPlaying')).toBeTruthy() expect(await page.data('isPlaying')).toBeTruthy()
console.log("duration:",await page.data('duration'),"currentTime:",await page.data('currentTime')) console.log("duration:",await page.data('duration'),"currentTime:",await page.data('currentTime'))
expect(await page.data('duration')).toBeCloseTo(175.109, 0); expect(await page.data('duration')).toBeCloseTo(175.109, 0);
...@@ -29,9 +30,14 @@ describe('inner-audio', () => { ...@@ -29,9 +30,14 @@ describe('inner-audio', () => {
// expect(await page.data('isPaused')).toBeFalsy(); // expect(await page.data('isPaused')).toBeFalsy();
}); });
it('screenshot', async () => {
expect(await program.screenshot()).toSaveImageSnapshot();
});
it('seek-onSeeking-onSeeked', async () => { it('seek-onSeeking-onSeeked', async () => {
await page.callMethod('onchange',20) await page.callMethod('onchange',20)
await page.waitFor(500); const waitTime = process.env.uniTestPlatformInfo.includes('chrome') ? 1500:500
await page.waitFor(waitTime)
console.log("seek-onSeeking-onSeeked:",await page.data()) console.log("seek-onSeeking-onSeeked:",await page.data())
expect(await page.data('onSeekingTest')).toBeTruthy(); expect(await page.data('onSeekingTest')).toBeTruthy();
// expect(await page.data('onWaitingTest')).toBeTruthy(); // expect(await page.data('onWaitingTest')).toBeTruthy();
......
...@@ -58,9 +58,9 @@ ...@@ -58,9 +58,9 @@
_isChanging: false, _isChanging: false,
_audioContext: null as InnerAudioContext | null, _audioContext: null as InnerAudioContext | null,
// 自动化测试 // 自动化测试
onSeekingTest:false, onSeekingTest: false,
onSeekedTest:false, onSeekedTest: false,
onWaitingTest:false onWaitingTest: false
} }
}, },
computed: { computed: {
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
} }
this._audioContext!.onPlay(() => { this._audioContext!.onPlay(() => {
this.isPaused = false; this.isPaused = false;
console.log('开始播放',this.isPaused); console.log('开始播放', this.isPaused);
}); });
this.onTimeUpdate() this.onTimeUpdate()
this.onWaiting() this.onWaiting()
...@@ -159,6 +159,7 @@ ...@@ -159,6 +159,7 @@
// console.log('onTimeUpdate:音频播放进度更新事件,currentTime',this._audioContext!.currentTime); // console.log('onTimeUpdate:音频播放进度更新事件,currentTime',this._audioContext!.currentTime);
if (this._isChanging === true) { return; } if (this._isChanging === true) { return; }
this.currentTime = this._audioContext!.currentTime || 0; this.currentTime = this._audioContext!.currentTime || 0;
console.log('currentTime', this.currentTime);
if (this.currentTime > this.buffered) { if (this.currentTime > this.buffered) {
console.log('缓冲不足'); console.log('缓冲不足');
} }
...@@ -208,7 +209,7 @@ ...@@ -208,7 +209,7 @@
console.log('音频停止事件'); console.log('音频停止事件');
}); });
this.isPlaying = false; this.isPlaying = false;
console.log('stop',this.isPaused); console.log('stop', this.isPaused);
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册