Integration test: torrent list

This commit is contained in:
DC
2016-09-08 16:40:43 -07:00
parent 1ad8a5313b
commit 785c44cd2a
22 changed files with 161 additions and 37 deletions

View File

@@ -1,15 +1,13 @@
const test = require('tape')
const fs = require('fs-extra')
const path = require('path')
const setup = require('./setup')
console.log('Creating test dir: ' + setup.TEST_DATA_DIR)
const DOWNLOAD_DIR = path.join(setup.TEST_DATA_DIR, 'Downloads')
fs.mkdirpSync(DOWNLOAD_DIR)
console.log('Creating download dir: ' + setup.TEST_DOWNLOAD_DIR)
fs.mkdirpSync(setup.TEST_DOWNLOAD_DIR)
test.onFinish(function () {
console.log('Removing test dir...')
fs.removeSync(setup.TEST_DATA_DIR)
console.log('Removing test dir: ' + setup.TEST_DATA_DIR)
fs.removeSync(setup.TEST_DATA_DIR) // includes download dir
})
test('app runs', function (t) {
@@ -22,28 +20,11 @@ test('app runs', function (t) {
(err) => setup.endTest(app, t, err || 'error'))
})
test('show download path missing', function (t) {
fs.removeSync(DOWNLOAD_DIR)
t.timeoutAfter(10e3)
const app = setup.createApp()
setup.waitForLoad(app, t)
.then(() => app.client.getTitle())
.then((text) => console.log('Title ' + text))
.then(() => app.client.waitUntilTextExists('.torrent-list', 'Download path missing'))
.then((err) => t.notOk(err))
.then(() => setup.screenshotCreateOrCompare(app, t, 'torrent-list-download-path-missing'))
.then(() => app.client.click('a'))
.then(() => setup.wait())
.then(() => app.browserWindow.getTitle())
.then((windowTitle) => t.equal(windowTitle, 'Preferences', 'window title'))
.then(() => setup.screenshotCreateOrCompare(app, t, 'prefs-basic'))
.then(() => setup.endTest(app, t),
(err) => setup.endTest(app, t, err || 'error'))
})
console.log('Testing the torrent list (home page)...')
setup.wipeTestDataDir()
require('./test-torrent-list')
// TODO:
// require('./test-torrent-list')
// require('./test-add-torrent')
// require('./test-create-torrent')
// require('./test-prefs')