Integration test: default announce list changed
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 138 KiB |
@@ -11,6 +11,7 @@ module.exports = {
|
|||||||
screenshotCreateOrCompare,
|
screenshotCreateOrCompare,
|
||||||
compareDownloadFolder,
|
compareDownloadFolder,
|
||||||
compareFiles,
|
compareFiles,
|
||||||
|
compareTorrentFile,
|
||||||
compareTorrentFiles,
|
compareTorrentFiles,
|
||||||
waitForLoad,
|
waitForLoad,
|
||||||
wait,
|
wait,
|
||||||
@@ -185,6 +186,13 @@ function compareTorrentFiles (t, pathActual, pathExpected) {
|
|||||||
t.deepEqual(fieldsActual, fieldsExpected, 'torrent contents: ' + pathActual)
|
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) {
|
function extractImportantFields (parsedTorrent) {
|
||||||
const { infoHash, name, announce, urlList, comment } = parsedTorrent
|
const { infoHash, name, announce, urlList, comment } = parsedTorrent
|
||||||
const priv = parsedTorrent.private // private is a reserved word in JS
|
const priv = parsedTorrent.private // private is a reserved word in JS
|
||||||
|
|||||||
@@ -36,6 +36,24 @@ test('add-torrent', function (t) {
|
|||||||
test('create-torrent', function (t) {
|
test('create-torrent', function (t) {
|
||||||
setup.resetTestDataDir()
|
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
|
// Set up the files to seed
|
||||||
setup.copy(path.join(__dirname, 'resources', 'm3.jpg'), config.SEED_FILES[0])
|
setup.copy(path.join(__dirname, 'resources', 'm3.jpg'), config.SEED_FILES[0])
|
||||||
|
|
||||||
@@ -61,9 +79,9 @@ test('create-torrent', function (t) {
|
|||||||
'dispatch("saveTorrentFileAs", 6)'))
|
'dispatch("saveTorrentFileAs", 6)'))
|
||||||
.then(() => setup.wait())
|
.then(() => setup.wait())
|
||||||
// Mock saves to <temp folder>/Desktop/saved.torrent
|
// Mock saves to <temp folder>/Desktop/saved.torrent
|
||||||
.then(() => setup.compareTorrentFiles(t,
|
.then(() => setup.compareTorrentFile(t,
|
||||||
config.SAVED_TORRENT_FILE,
|
config.SAVED_TORRENT_FILE,
|
||||||
path.join(__dirname, 'resources', 'expected-single-file.torrent')))
|
expectedTorrent))
|
||||||
.then(() => setup.endTest(app, t),
|
.then(() => setup.endTest(app, t),
|
||||||
(err) => setup.endTest(app, t, err || 'error'))
|
(err) => setup.endTest(app, t, err || 'error'))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -16,12 +16,13 @@ test('audio-streaming', function (t) {
|
|||||||
// Pause. Skip to two seconds in. Wait another two seconds for it to load.
|
// 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("playPause")'))
|
||||||
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)'))
|
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)'))
|
||||||
.then(() => setup.wait())
|
.then(() => app.client.waitUntilTextExists('.player', 'Beastie Boys', 10e3))
|
||||||
.then(() => app.client.waitUntilTextExists('.player', 'Beastie Boys'))
|
.then(() => setup.wait(5e3))
|
||||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired'))
|
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired'))
|
||||||
// Click next
|
// Click next
|
||||||
.then(() => app.client.click('.skip-next'))
|
.then(() => app.client.click('.skip-next'))
|
||||||
.then(() => app.client.waitUntilTextExists('.player', 'David Byrne'))
|
.then(() => app.client.waitUntilTextExists('.player', 'David Byrne'))
|
||||||
|
.then(() => setup.wait(5e3))
|
||||||
.then(() => app.client.moveToObject('.letterbox'))
|
.then(() => app.client.moveToObject('.letterbox'))
|
||||||
.then(() => app.webContents.executeJavaScript('dispatch("playPause")'))
|
.then(() => app.webContents.executeJavaScript('dispatch("playPause")'))
|
||||||
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)'))
|
.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("skipTo", 206)'))
|
||||||
.then(() => app.webContents.executeJavaScript('dispatch("playPause")'))
|
.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
|
// 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("playPause")'))
|
||||||
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)'))
|
.then(() => app.webContents.executeJavaScript('dispatch("skipTo", 2)'))
|
||||||
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired-3'))
|
.then(() => setup.screenshotCreateOrCompare(app, t, 'play-torrent-wired-3'))
|
||||||
|
|||||||
Reference in New Issue
Block a user