diff --git a/test/index.js b/test/index.js index 75fcce36..65856dd7 100644 --- a/test/index.js +++ b/test/index.js @@ -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') diff --git a/test/screenshots/darwin/play-torrent-wired-2.png b/test/screenshots/darwin/play-torrent-wired-2.png new file mode 100644 index 00000000..97399565 Binary files /dev/null and b/test/screenshots/darwin/play-torrent-wired-2.png differ diff --git a/test/screenshots/darwin/play-torrent-wired-3.png b/test/screenshots/darwin/play-torrent-wired-3.png new file mode 100644 index 00000000..5a83844c Binary files /dev/null and b/test/screenshots/darwin/play-torrent-wired-3.png differ diff --git a/test/screenshots/darwin/play-torrent-wired-4.png b/test/screenshots/darwin/play-torrent-wired-4.png new file mode 100644 index 00000000..54ff2f89 Binary files /dev/null and b/test/screenshots/darwin/play-torrent-wired-4.png differ diff --git a/test/screenshots/darwin/play-torrent-wired-5.png b/test/screenshots/darwin/play-torrent-wired-5.png new file mode 100644 index 00000000..c47a5816 Binary files /dev/null and b/test/screenshots/darwin/play-torrent-wired-5.png differ diff --git a/test/screenshots/darwin/play-torrent-wired-fullscreen.png b/test/screenshots/darwin/play-torrent-wired-fullscreen.png new file mode 100644 index 00000000..1d8f7952 Binary files /dev/null and b/test/screenshots/darwin/play-torrent-wired-fullscreen.png differ diff --git a/test/screenshots/darwin/play-torrent-wired-list.png b/test/screenshots/darwin/play-torrent-wired-list.png new file mode 100644 index 00000000..527a0b55 Binary files /dev/null and b/test/screenshots/darwin/play-torrent-wired-list.png differ diff --git a/test/screenshots/darwin/play-torrent-wired.png b/test/screenshots/darwin/play-torrent-wired.png new file mode 100644 index 00000000..3a96745c Binary files /dev/null and b/test/screenshots/darwin/play-torrent-wired.png differ diff --git a/test/test-audio.js b/test/test-audio.js new file mode 100644 index 00000000..558539c5 --- /dev/null +++ b/test/test-audio.js @@ -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')) +}) diff --git a/test/test-video.js b/test/test-video.js index 525eb5e6..47bc6d23 100644 --- a/test/test-video.js +++ b/test/test-video.js @@ -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)