Integration test: address PR comments
This commit is contained in:
@@ -56,8 +56,10 @@ const VERSION_PREFIX = '-WD' + VERSION_STR + '-'
|
||||
|
||||
/**
|
||||
* Generate an ephemeral peer ID each time.
|
||||
* TODO: once there are around 2^24 = ~8 million WebTorrent Desktops online at the same time,
|
||||
* ID collisions will start happening. Birthday paradox. Can we use more than six bytes?
|
||||
* Once there are around 2^24 = ~8 million WebTorrent Desktops online at the same time,
|
||||
* ID collisions will start happening. Birthday paradox.
|
||||
* This is fine, though. Bad peers can already clone someone else's peer ID.
|
||||
* The network is robust to occasional collisions.
|
||||
*/
|
||||
const PEER_ID = Buffer.from(VERSION_PREFIX + crypto.randomBytes(6).toString('hex'))
|
||||
|
||||
@@ -166,7 +168,7 @@ function addTorrentEvents (torrent) {
|
||||
function torrentReady () {
|
||||
const info = getTorrentInfo(torrent)
|
||||
ipc.send('wt-ready', torrent.key, info)
|
||||
ipc.send('wt-ready-' + torrent.infoHash, torrent.key, info) // TODO: hack
|
||||
ipc.send('wt-ready-' + torrent.infoHash, torrent.key, info)
|
||||
|
||||
updateTorrentProgress()
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 478 KiB After Width: | Height: | Size: 478 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 480 KiB After Width: | Height: | Size: 480 KiB |
@@ -165,6 +165,6 @@ function compareTorrentFiles (t, pathActual, pathExpected) {
|
||||
|
||||
function extractImportantFields (parsedTorrent) {
|
||||
const { infoHash, name, announce, urlList, comment } = parsedTorrent
|
||||
const priv = parsedTorrent.private
|
||||
const priv = parsedTorrent.private // private is a reserved word in JS
|
||||
return { infoHash, name, announce, urlList, comment, 'private': priv }
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ const setup = require('./setup')
|
||||
test('audio-streaming', function (t) {
|
||||
setup.resetTestDataDir()
|
||||
|
||||
t.timeoutAfter(40e3)
|
||||
t.timeoutAfter(60e3)
|
||||
const app = setup.createApp()
|
||||
setup.waitForLoad(app, t, {online: true})
|
||||
.then(() => app.client.waitUntilTextExists('.torrent-list', 'Big Buck Bunny'))
|
||||
@@ -12,15 +12,17 @@ test('audio-streaming', function (t) {
|
||||
.then(() => app.client.moveToObject('#torrent-wired'))
|
||||
.then(() => setup.wait())
|
||||
.then(() => app.client.click('#torrent-wired .icon.play'))
|
||||
.then(() => setup.wait(5e3))
|
||||
.then(() => app.client.waitUntilTextExists('The Wired CD'))
|
||||
// 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(() => app.client.waitUntilTextExists('Artist'))
|
||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired'))
|
||||
// Click next
|
||||
.then(() => app.client.click('.skip-next'))
|
||||
.then(() => setup.wait())
|
||||
.then(() => app.client.waitUntilTextExists('The Wired CD'))
|
||||
.then(() => app.client.moveToObject('.letterbox'))
|
||||
.then(() => app.webContents.executeJavaScript('dispatch("playPause")'))
|
||||
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)'))
|
||||
.then(() => setup.wait())
|
||||
@@ -28,7 +30,7 @@ test('audio-streaming', function (t) {
|
||||
// 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(() => setup.wait(5e3)) // Let it play a few seconds, past the end of the song
|
||||
.then(() => app.webContents.executeJavaScript('dispatch("playPause")'))
|
||||
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)'))
|
||||
.then(() => setup.wait())
|
||||
@@ -39,11 +41,11 @@ test('audio-streaming', function (t) {
|
||||
.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.wait())
|
||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired-4'))
|
||||
// Back. Return to torrent list
|
||||
.then(() => app.client.click('.back'))
|
||||
.then(() => setup.wait())
|
||||
.then(() => app.client.waitUntilTextExists('Big Buck Bunny'))
|
||||
.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'))
|
||||
|
||||
@@ -3,7 +3,7 @@ const fs = require('fs-extra')
|
||||
const setup = require('./setup')
|
||||
const config = require('./config')
|
||||
|
||||
test.skip('torrent-list: show download path missing', function (t) {
|
||||
test('torrent-list: show download path missing', function (t) {
|
||||
setup.resetTestDataDir()
|
||||
fs.removeSync(config.TEST_DIR_DOWNLOAD)
|
||||
|
||||
@@ -36,7 +36,7 @@ test('torrent-list: start, stop, and delete torrents', function (t) {
|
||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'torrent-list-hover'))
|
||||
// Click download on the first torrent, start downloading
|
||||
.then(() => app.client.click('.icon.download'))
|
||||
.then(() => app.client.waitUntilTextExists('.torrent-list', '0%'))
|
||||
.then(() => app.client.waitUntilTextExists('.torrent-list', '276MB'))
|
||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'torrent-list-start-download'))
|
||||
// Click download on the first torrent again, stop downloading
|
||||
.then(() => app.client.click('.icon.download'))
|
||||
|
||||
Reference in New Issue
Block a user