Integration test: default announce list changed

This commit is contained in:
DC
2016-09-21 13:06:35 -07:00
parent 82c49b5fc5
commit 8e66f641ce
4 changed files with 33 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 138 KiB

View File

@@ -11,6 +11,7 @@ module.exports = {
screenshotCreateOrCompare,
compareDownloadFolder,
compareFiles,
compareTorrentFile,
compareTorrentFiles,
waitForLoad,
wait,
@@ -185,6 +186,13 @@ function compareTorrentFiles (t, pathActual, pathExpected) {
t.deepEqual(fieldsActual, fieldsExpected, 'torrent contents: ' + pathActual)
}
// Makes sure two torrents have the same infohash and flags
function compareTorrentFile (t, pathActual, fieldsExpected) {
const bufActual = fs.readFileSync(pathActual)
const fieldsActual = extractImportantFields(parseTorrent(bufActual))
t.deepEqual(fieldsActual, fieldsExpected, 'torrent contents: ' + pathActual)
}
function extractImportantFields (parsedTorrent) {
const { infoHash, name, announce, urlList, comment } = parsedTorrent
const priv = parsedTorrent.private // private is a reserved word in JS

View File

@@ -36,6 +36,24 @@ test('add-torrent', function (t) {
test('create-torrent', function (t) {
setup.resetTestDataDir()
const expectedTorrent = {
announce: [
'udp://exodus.desync.com:6969',
'udp://tracker.coppersurfer.tk:6969',
'udp://tracker.internetwarriors.net:1337',
'udp://tracker.leechers-paradise.org:6969',
'udp://tracker.openbittorrent.com:80',
'wss://tracker.btorrent.xyz',
'wss://tracker.fastcast.nz',
'wss://tracker.openwebtorrent.com'
],
comment: undefined,
infoHash: '4b087858a32e31a0d313b5f9e0a2e13c08c5403f',
name: 'tmp.jpg',
private: false,
urlList: []
}
// Set up the files to seed
setup.copy(path.join(__dirname, 'resources', 'm3.jpg'), config.SEED_FILES[0])
@@ -61,9 +79,9 @@ test('create-torrent', function (t) {
'dispatch("saveTorrentFileAs", 6)'))
.then(() => setup.wait())
// Mock saves to <temp folder>/Desktop/saved.torrent
.then(() => setup.compareTorrentFiles(t,
.then(() => setup.compareTorrentFile(t,
config.SAVED_TORRENT_FILE,
path.join(__dirname, 'resources', 'expected-single-file.torrent')))
expectedTorrent))
.then(() => setup.endTest(app, t),
(err) => setup.endTest(app, t, err || 'error'))
})

View File

@@ -16,12 +16,13 @@ test('audio-streaming', function (t) {
// 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('.player', 'Beastie Boys'))
.then(() => app.client.waitUntilTextExists('.player', 'Beastie Boys', 10e3))
.then(() => setup.wait(5e3))
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired'))
// Click next
.then(() => app.client.click('.skip-next'))
.then(() => app.client.waitUntilTextExists('.player', 'David Byrne'))
.then(() => setup.wait(5e3))
.then(() => app.client.moveToObject('.letterbox'))
.then(() => app.webContents.executeJavaScript('dispatch("playPause")'))
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)'))
@@ -30,7 +31,8 @@ test('audio-streaming', function (t) {
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 206)'))
.then(() => app.webContents.executeJavaScript('dispatch("playPause")'))
// Play past the end of the song, then pause after the start of the next song by Zap Mama
.then(() => app.client.waitUntilTextExists('.player', 'Zap Mama', 15e3))
.then(() => app.client.waitUntilTextExists('.player', 'Zap Mama'), 15e3)
.then(() => setup.wait(5e3))
.then(() => app.webContents.executeJavaScript('dispatch("playPause")'))
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)'))
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired-3'))