From 491b99fd088ce11ff692dc0d6c3934c4120da35b Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Tue, 4 Dec 2018 01:50:27 +0300 Subject: [PATCH] test(downloading): add downloading tab & some buttons tests --- src/app/download-page.js | 2 +- src/app/header.js | 1 + src/app/search-page.js | 2 +- src/app/search.js | 1 + src/app/torrent.js | 2 +- tests/download.test.js | 49 ++++++++++++++++++++++++++++++++++++---- 6 files changed, 49 insertions(+), 8 deletions(-) diff --git a/src/app/download-page.js b/src/app/download-page.js index 17d64e6..c21bf99 100644 --- a/src/app/download-page.js +++ b/src/app/download-page.js @@ -43,7 +43,7 @@ export default class TopPage extends Page { { window.router('/') }} /> - + { this.downloads.map((torrentDownload, index) => { const {torrentObject: torrent, ...download} = torrentDownload diff --git a/src/app/header.js b/src/app/header.js index 10aad06..427a8cb 100644 --- a/src/app/header.js +++ b/src/app/header.js @@ -216,6 +216,7 @@ class Header extends React.Component { /> { window.router('/downloads') }} diff --git a/src/app/search-page.js b/src/app/search-page.js index a70627c..0814d68 100644 --- a/src/app/search-page.js +++ b/src/app/search-page.js @@ -32,7 +32,7 @@ export default class SearchPage extends Page { return (
-
+
diff --git a/src/app/torrent.js b/src/app/torrent.js index 3ac8f44..a98e8c9 100644 --- a/src/app/torrent.js +++ b/src/app/torrent.js @@ -392,7 +392,7 @@ export default class Torrent extends Component { && - { return (await app.client.getText('.torrentRow .progressDownloading')) === '100.0%' - }, 60000, 'expected that download will be finished', 200) + }, 60000, 'expected that download will be finished', 200) + + // Check Buttons After finish + assert(!(await app.client.isExisting('.torrentRow .deleteDownloadBeforeFinish'))); }) it("check file after download", async function() { @@ -38,16 +63,30 @@ describe("download", function() { }) it("delete download from manager (after finish)", async function() { - this.timeout(10000); + this.timeout(8000); const { app } = this await app.client.waitForExist('.torrentRow .deleteDownloadAfterFinish') + assert(await app.client.isExisting('.torrentRow .deleteDownloadAfterFinish')); + assert.equal(await app.client.getText('.search-list .torrentRow .progressDownloading'), '100.0%') + // Click cancel of download await app.client.click('.torrentRow .deleteDownloadAfterFinish') + assert(!(await app.client.isExisting('.torrentRow .deleteDownloadAfterFinish'))); + // Download deleted, but must be keeped in search + const value = await app.client.$('.search-list .torrentRow .torrentName').getText() + assert.equal(value, 'Roblox_setup.exe') + }) + + it("there must be no download on download tab", async function() { + this.timeout(8000); + const { app } = this + await app.client.click('#downloadTab') + await app.client.waitForExist('.downloads-list') + assert(!(await app.client.isExisting('.torrentRow'))); }) it("file must still exists after delete from manager", async function() { this.timeout(10000); - const file = config.client.downloadPath + "/Roblox_setup.exe" - assert(fs.existsSync(file)); - assert.equal(await md5(file), '7df171da63e2013c9b17e1857615b192'); + assert(fs.existsSync(fileTest)); + assert.equal(await md5(fileTest), '7df171da63e2013c9b17e1857615b192'); }) });