From b97f342ec27e24fc28e423370eab2bf6fc53d79b Mon Sep 17 00:00:00 2001 From: yinjiacheng Date: Wed, 6 Dec 2023 20:25:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0video=E7=A4=BA=E4=BE=8B?= =?UTF-8?q?=E5=92=8C=E8=87=AA=E5=8A=A8=E5=8C=96=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 12 + pages/component/video/video-all.uvue | 408 +++++++++++++++++++++++ pages/component/video/video-format.uvue | 93 ++++++ pages/component/video/video.js | 47 --- pages/component/video/video.test.js | 48 +++ pages/component/video/video.uvue | 423 +----------------------- static/test-video/2minute-demo.m3u8 | 31 ++ 7 files changed, 607 insertions(+), 455 deletions(-) create mode 100644 pages/component/video/video-all.uvue create mode 100644 pages/component/video/video-format.uvue delete mode 100644 pages/component/video/video.js create mode 100644 pages/component/video/video.test.js create mode 100644 static/test-video/2minute-demo.m3u8 diff --git a/pages.json b/pages.json index d6db00db..72e3e0c5 100644 --- a/pages.json +++ b/pages.json @@ -157,6 +157,18 @@ "style": { "navigationBarTitleText": "video" } + }, + { + "path": "pages/component/video/video-all", + "style": { + "navigationBarTitleText": "video-all" + } + }, + { + "path": "pages/component/video/video-format", + "style": { + "navigationBarTitleText": "video-format" + } }, { "path": "pages/component/web-view/web-view", diff --git a/pages/component/video/video-all.uvue b/pages/component/video/video-all.uvue new file mode 100644 index 00000000..70a538fc --- /dev/null +++ b/pages/component/video/video-all.uvue @@ -0,0 +1,408 @@ + + + + + diff --git a/pages/component/video/video-format.uvue b/pages/component/video/video-format.uvue new file mode 100644 index 00000000..b4fc1691 --- /dev/null +++ b/pages/component/video/video-format.uvue @@ -0,0 +1,93 @@ + + + + + diff --git a/pages/component/video/video.js b/pages/component/video/video.js deleted file mode 100644 index fbc65dfd..00000000 --- a/pages/component/video/video.js +++ /dev/null @@ -1,47 +0,0 @@ -// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ - -describe('component-native-video', () => { - - let page; - beforeAll(async () => { - page = await program.reLaunch('/pages/component/video/video'); - await page.waitFor(1000); - }); - - it('check API play', async () => { - await page.callMethod('playTest'); - await page.waitFor(500); - expect(await page.data('isPlaying')).toBe(true); - expect(await page.data('isPause')).toBe(false); - }); - - it('check API requestFullScreen', async () => { - await page.callMethod('requestFullScreenTest'); - await page.waitFor(1000); - expect(await page.data('isFullScreen')).toBe(true); - }); - - it('check API exitFullScreen', async () => { - await page.callMethod('exitFullScreenTest'); - await page.waitFor(1000); - expect(await page.data('isFullScreen')).toBe(false); - }); - - it('check API pause', async () => { - await page.callMethod('pauseTest'); - await page.waitFor(500); - expect(await page.data('isPause')).toBe(true); - expect(await page.data('isPlaying')).toBe(false); - await page.callMethod('playTest'); - await page.waitFor(500); - expect(await page.data('isPlaying')).toBe(true); - expect(await page.data('isPause')).toBe(false); - }); - - it('check API stop', async () => { - await page.callMethod('stopTest'); - await page.waitFor(500); - expect(await page.data('isPause')).toBe(true); - expect(await page.data('isPlaying')).toBe(false); - }); -}); \ No newline at end of file diff --git a/pages/component/video/video.test.js b/pages/component/video/video.test.js new file mode 100644 index 00000000..41e88485 --- /dev/null +++ b/pages/component/video/video.test.js @@ -0,0 +1,48 @@ +// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/ +jest.setTimeout(10000); +describe('component-native-video', () => { + let page; + + beforeAll(async () => { + page = await program.reLaunch('/pages/component/video/video-all'); + await page.waitFor('video'); + }); + + it('test API', async () => { + // play + await page.callMethod('play'); + await page.waitFor(async () => { + return (await page.data('isPlaying')) == true; + }); + // requestFullScreen + await page.callMethod('requestFullScreen', null); + await page.waitFor(async () => { + return (await page.data('isFullScreen')) == true; + }); + // exitFullScreen + await page.callMethod('exitFullScreen'); + await page.waitFor(async () => { + return (await page.data('isFullScreen')) == false; + }); + // pause + await page.callMethod('pause'); + await page.waitFor(async () => { + return (await page.data('isPause')) == true; + }); + await page.callMethod('play'); + await page.waitFor(async () => { + return (await page.data('isPlaying')) == true; + }); + // stop + await page.callMethod('stop'); + await page.waitFor(async () => { + return (await page.data('isPause')) == true; + }); + }); + + it('test format', async () => { + page = await program.reLaunch('/pages/component/video/video-format'); + await page.waitFor(1000); + expect(await page.data('isError')).toBe(false); + }); +}); diff --git a/pages/component/video/video.uvue b/pages/component/video/video.uvue index c73baeaf..46f4ce74 100644 --- a/pages/component/video/video.uvue +++ b/pages/component/video/video.uvue @@ -1,427 +1,34 @@ - \ No newline at end of file + + diff --git a/static/test-video/2minute-demo.m3u8 b/static/test-video/2minute-demo.m3u8 new file mode 100644 index 00000000..cdad0445 --- /dev/null +++ b/static/test-video/2minute-demo.m3u8 @@ -0,0 +1,31 @@ +#EXTM3U +#EXT-X-VERSION:3 +#EXT-X-TARGETDURATION:10 +#EXT-X-MEDIA-SEQUENCE:0 +#EXTINF:10.000000, +https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo0.ts +#EXTINF:10.000000, +https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo1.ts +#EXTINF:10.000000, +https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo2.ts +#EXTINF:10.000000, +https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo3.ts +#EXTINF:10.000000, +https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo4.ts +#EXTINF:10.000000, +https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo5.ts +#EXTINF:10.000000, +https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo6.ts +#EXTINF:10.000000, +https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo7.ts +#EXTINF:10.000000, +https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo8.ts +#EXTINF:10.000000, +https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo9.ts +#EXTINF:10.000000, +https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo10.ts +#EXTINF:10.000000, +https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo11.ts +#EXTINF:1.773667, +https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo12.ts +#EXT-X-ENDLIST -- GitLab