Integration test: audio

This commit is contained in:
DC
2016-09-15 06:36:10 -07:00
parent e4e789cc5b
commit f7ab27f9fd
10 changed files with 59 additions and 6 deletions

View File

@@ -17,8 +17,4 @@ test('app runs', function (t) {
require('./test-torrent-list')
require('./test-add-torrent')
require('./test-video')
// TODO:
// require('./test-audio')
// require('./test-cast')
// require('./test-prefs')
require('./test-audio')

Binary file not shown.

After

Width:  |  Height:  |  Size: 694 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 KiB

57
test/test-audio.js Normal file
View File

@@ -0,0 +1,57 @@
const test = require('tape')
const setup = require('./setup')
test('audio-streaming', function (t) {
setup.resetTestDataDir()
t.timeoutAfter(40e3)
const app = setup.createApp()
setup.waitForLoad(app, t, {online: true})
.then(() => app.client.waitUntilTextExists('.torrent-list', 'Big Buck Bunny'))
// Play Wired CD. Wait for it to start streaming.
.then(() => app.client.moveToObject('#torrent-wired'))
.then(() => setup.wait())
.then(() => app.client.click('#torrent-wired .icon.play'))
.then(() => setup.wait(5e3))
// Pause. Skip to two seconds in. Wait another two seconds for it to load.
.then(() => app.webContents.executeJavaScript('dispatch("playPause")'))
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)'))
.then(() => setup.wait())
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired'))
// Click next
.then(() => app.client.click('.skip-next'))
.then(() => setup.wait())
.then(() => app.webContents.executeJavaScript('dispatch("playPause")'))
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)'))
.then(() => setup.wait())
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired-2'))
// Play from end of song, let it advance on its own
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 206)'))
.then(() => app.webContents.executeJavaScript('dispatch("playPause")'))
.then(() => setup.wait(5e3))
.then(() => app.webContents.executeJavaScript('dispatch("playPause")'))
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)'))
.then(() => setup.wait())
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired-3'))
// Fullscreen
.then(() => app.client.click('.fullscreen'))
.then(() => setup.wait())
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired-fullscreen'))
// Back to normal audio view. Give the player controls have had time to disappear.
.then(() => app.webContents.executeJavaScript('dispatch("escapeBack")'))
.then(() => setup.wait(5e3))
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired-4'))
// Back. Return to torrent list
.then(() => app.client.click('.back'))
.then(() => setup.wait())
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired-list'))
// Forward. Should play again where we left off (should not stay paused)
.then(() => app.client.click('.forward'))
.then(() => setup.wait())
.then(() => app.webContents.executeJavaScript('dispatch("playPause")'))
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)'))
.then(() => setup.wait())
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired-5'))
.then(() => setup.endTest(app, t),
(err) => setup.endTest(app, t, err || 'error'))
})

View File

@@ -1,7 +1,7 @@
const test = require('tape')
const setup = require('./setup')
test('basic-streaming', function (t) {
test('video-streaming', function (t) {
setup.resetTestDataDir()
t.timeoutAfter(30e3)