diff --git a/src/renderer/lib/cast.js b/src/renderer/lib/cast.js index 59784fda..3d3c7b9d 100644 --- a/src/renderer/lib/cast.js +++ b/src/renderer/lib/cast.js @@ -33,6 +33,15 @@ function init (appState, callback) { state = appState update = callback + // Don't actually cast during integration tests + // (Otherwise you'd need a physical Chromecast + AppleTV + DLNA TV to run them.) + if (config.IS_TEST) { + state.devices.chromecast = testPlayer('chromecast') + state.devices.airplay = testPlayer('airplay') + state.devices.dlna = testPlayer('dlna') + return + } + // Load modules, scan the network for devices airplayer = require('airplayer')() chromecasts = require('chromecasts')() @@ -58,6 +67,32 @@ function init (appState, callback) { }) } +// integration test player implementation +function testPlayer (type) { + return { + getDevices, + open, + play, + pause, + stop, + status, + seek, + volume + } + + function getDevices () { + return [{name: type + '-1'}, {name: type + '-2'}] + } + + function open () {} + function play () {} + function pause () {} + function stop () {} + function status () {} + function seek () {} + function volume () {} +} + // chromecast player implementation function chromecastPlayer () { const ret = { diff --git a/src/renderer/pages/player-page.js b/src/renderer/pages/player-page.js index 9bd0b1d5..23e65ca8 100644 --- a/src/renderer/pages/player-page.js +++ b/src/renderer/pages/player-page.js @@ -6,6 +6,7 @@ const zeroFill = require('zero-fill') const TorrentSummary = require('../lib/torrent-summary') const Playlist = require('../lib/playlist') const {dispatch, dispatcher} = require('../lib/dispatcher') +const config = require('../../config') // Shows a streaming video player. Standard features + Chromecast + Airplay module.exports = class Player extends React.Component { @@ -585,6 +586,8 @@ function renderPlayerControls (state) { // Renders the loading bar. Shows which parts of the torrent are loaded, which // can be 'spongey' / non-contiguous function renderLoadingBar (state) { + if (config.IS_TEST) return // Don't integration test the loading bar. Screenshots won't match. + const torrentSummary = state.getPlayingTorrentSummary() if (!torrentSummary.progress) { return [] diff --git a/test/screenshots/darwin/play-torrent-bbb.png b/test/screenshots/darwin/play-torrent-bbb.png index 5937ccc6..451cb277 100644 Binary files a/test/screenshots/darwin/play-torrent-bbb.png and b/test/screenshots/darwin/play-torrent-bbb.png differ diff --git a/test/screenshots/darwin/play-torrent-wired-2.png b/test/screenshots/darwin/play-torrent-wired-2.png index 97399565..8b704a5d 100644 Binary files a/test/screenshots/darwin/play-torrent-wired-2.png 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 index 5a83844c..8ff51d43 100644 Binary files a/test/screenshots/darwin/play-torrent-wired-3.png 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 index 54ff2f89..f937e62c 100644 Binary files a/test/screenshots/darwin/play-torrent-wired-4.png 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 index c47a5816..f937e62c 100644 Binary files a/test/screenshots/darwin/play-torrent-wired-5.png 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 index 1d8f7952..6e47560a 100644 Binary files a/test/screenshots/darwin/play-torrent-wired-fullscreen.png 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 index 527a0b55..0e92c295 100644 Binary files a/test/screenshots/darwin/play-torrent-wired-list.png 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 index 3a96745c..b028676f 100644 Binary files a/test/screenshots/darwin/play-torrent-wired.png and b/test/screenshots/darwin/play-torrent-wired.png differ