From 25ff84e706c335a2d8287eb84817a126f8add86b Mon Sep 17 00:00:00 2001 From: Anne_LXM Date: Thu, 19 Sep 2024 20:40:10 +0800 Subject: [PATCH] =?UTF-8?q?test(create-inner-audio-context.test.js):?= =?UTF-8?q?=E8=B0=83=E6=95=B4waitFor=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../create-inner-audio-context.test.js | 10 ++++++++-- .../create-inner-audio-context.uvue | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) 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 fd1fbd37..93c55ca9 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 532ff292..97c1c163 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('缓冲不足'); } -- GitLab