diff --git a/pages/API/create-inner-audio-context/create-inner-audio-context.test.js b/pages/API/create-inner-audio-context/create-inner-audio-context.test.js index fd1fbd37c0445bb9628ae3b07797389296e7f6b3..93c55ca9c978994884f540bde04c2a153f2a61a8 100644 --- a/pages/API/create-inner-audio-context/create-inner-audio-context.test.js +++ b/pages/API/create-inner-audio-context/create-inner-audio-context.test.js @@ -20,7 +20,8 @@ describe('inner-audio', () => { it('play-onPlay-onTimeUpdate', async () => { 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() console.log("duration:",await page.data('duration'),"currentTime:",await page.data('currentTime')) expect(await page.data('duration')).toBeCloseTo(175.109, 0); @@ -29,9 +30,14 @@ describe('inner-audio', () => { // expect(await page.data('isPaused')).toBeFalsy(); }); + it('screenshot', async () => { + expect(await program.screenshot()).toSaveImageSnapshot(); + }); + it('seek-onSeeking-onSeeked', async () => { 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()) expect(await page.data('onSeekingTest')).toBeTruthy(); // expect(await page.data('onWaitingTest')).toBeTruthy(); diff --git a/pages/API/create-inner-audio-context/create-inner-audio-context.uvue b/pages/API/create-inner-audio-context/create-inner-audio-context.uvue index 532ff292e75ad3f7d7d68bdf988ab5e5f9994e61..97c1c16362cb0dc96879e122d895a89d6675a3a5 100644 --- a/pages/API/create-inner-audio-context/create-inner-audio-context.uvue +++ b/pages/API/create-inner-audio-context/create-inner-audio-context.uvue @@ -159,6 +159,7 @@ // console.log('onTimeUpdate:音频播放进度更新事件,currentTime',this._audioContext!.currentTime); if (this._isChanging === true) { return; } this.currentTime = this._audioContext!.currentTime || 0; + console.log('currentTime', this.currentTime); if (this.currentTime > this.buffered) { console.log('缓冲不足'); }