diff --git a/pages.json b/pages.json index d6db00db43c80561451a8ad6519eb1342a06efa0..72e3e0c58e2fc4f83bd701958f0f77e0e543394e 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 0000000000000000000000000000000000000000..70a538fc3a7d447d1a71598b86a665fcc76f09d9 --- /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 0000000000000000000000000000000000000000..b4fc1691f87b069d6929105dfae82b049cf52893 --- /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 fbc65dfdcb6cd8a8accbee73e43a3c346fa87040..0000000000000000000000000000000000000000 --- 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 0000000000000000000000000000000000000000..41e88485b44fbc7dded66176e8134bc9697152f1 --- /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 c73baeaf982f2e143ccad60542c2d7e29f2e5117..46f4ce742cb64b05311cc179dd90d96be966c1b6 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 0000000000000000000000000000000000000000..cdad0445dec96285f4345a4a6a810d790cc2da29 --- /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