Integration test: simplify offline mode
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 704 KiB After Width: | Height: | Size: 701 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
@@ -35,17 +35,13 @@ function waitForLoad (app, t, opts) {
|
||||
return app.start().then(function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
}).then(function () {
|
||||
// Offline mode? Disable internet in the webtorrent window
|
||||
// TODO. For now, just run integration tests with internet turned off.
|
||||
// Spectron is poorly documented, and contrary to the docs, webContents.session is missing
|
||||
// That is the correct API (in theory) to put the app in offline mode
|
||||
// Offline mode
|
||||
if (opts.offline) app.webContents.executeJavaScript('testOfflineMode()')
|
||||
}).then(function () {
|
||||
// Switch to the main window. Index 0 is apparently the hidden webtorrent window...
|
||||
return app.client.windowByIndex(1)
|
||||
}).then(function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
}).then(function () {
|
||||
if (!opts.online) app.electron.ipcRenderer.send('testOffline', true)
|
||||
}).then(function () {
|
||||
return app.webContents.getTitle()
|
||||
}).then(function (title) {
|
||||
|
||||
@@ -36,8 +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', 'peer'))
|
||||
.then(() => setup.wait(100e3))
|
||||
.then(() => app.client.waitUntilTextExists('.torrent-list', '0%'))
|
||||
.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