test(downloading): add downloading tab & some buttons tests
This commit is contained in:
parent
7277ffba8f
commit
491b99fd08
@ -43,7 +43,7 @@ export default class TopPage extends Page {
|
|||||||
<RaisedButton label={__('Back to main page')} primary={true} onClick={() => {
|
<RaisedButton label={__('Back to main page')} primary={true} onClick={() => {
|
||||||
window.router('/')
|
window.router('/')
|
||||||
}} />
|
}} />
|
||||||
<List style={{paddingBottom: '70px', minWidth: '60%'}} className='animated recent-torrents'>
|
<List style={{paddingBottom: '70px', minWidth: '60%'}} className='animated recent-torrents downloads-list'>
|
||||||
{
|
{
|
||||||
this.downloads.map((torrentDownload, index) => {
|
this.downloads.map((torrentDownload, index) => {
|
||||||
const {torrentObject: torrent, ...download} = torrentDownload
|
const {torrentObject: torrent, ...download} = torrentDownload
|
||||||
|
@ -216,6 +216,7 @@ class Header extends React.Component {
|
|||||||
/>
|
/>
|
||||||
<RaisedButton
|
<RaisedButton
|
||||||
label={__('Downloads')}
|
label={__('Downloads')}
|
||||||
|
id='downloadTab'
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
window.router('/downloads')
|
window.router('/downloads')
|
||||||
}}
|
}}
|
||||||
|
@ -32,7 +32,7 @@ export default class SearchPage extends Page {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='column center'>
|
<div className='column center'>
|
||||||
<div className='torrents-container'>
|
<div className='torrents-container search-list'>
|
||||||
<SearchResults
|
<SearchResults
|
||||||
torrentsSearchResults={Search.instance().searchTorrents}
|
torrentsSearchResults={Search.instance().searchTorrents}
|
||||||
filesSearchResults={Search.instance().searchFiles}
|
filesSearchResults={Search.instance().searchFiles}
|
||||||
|
@ -264,6 +264,7 @@ class Search extends Component {
|
|||||||
<div style={{width: 25, height: 25, margin: 2, marginRight: 8}}>
|
<div style={{width: 25, height: 25, margin: 2, marginRight: 8}}>
|
||||||
<Tooltip hint={__('display search results for current search request')}>
|
<Tooltip hint={__('display search results for current search request')}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
id='open-recent-search'
|
||||||
checked={false}
|
checked={false}
|
||||||
uncheckedIcon={<svg viewBox="0 0 459 459">
|
uncheckedIcon={<svg viewBox="0 0 459 459">
|
||||||
<g>
|
<g>
|
||||||
|
@ -392,7 +392,7 @@ export default class Torrent extends Component {
|
|||||||
&&
|
&&
|
||||||
<ToolTip hint={__('Pause torrent downloading')} right={true}>
|
<ToolTip hint={__('Pause torrent downloading')} right={true}>
|
||||||
<a href={`magnet:?xt=urn:btih:${torrent.hash}`}>
|
<a href={`magnet:?xt=urn:btih:${torrent.hash}`}>
|
||||||
<svg style={{
|
<svg className='pauseTorrent' style={{
|
||||||
height: '24px',
|
height: '24px',
|
||||||
marginRight: 16,
|
marginRight: 16,
|
||||||
fill: this.state.downloadPaused ? '#42f47a' : 'black'
|
fill: this.state.downloadPaused ? '#42f47a' : 'black'
|
||||||
|
@ -7,6 +7,13 @@ const fs = require('fs')
|
|||||||
describe("download", function() {
|
describe("download", function() {
|
||||||
this.timeout(30000);
|
this.timeout(30000);
|
||||||
|
|
||||||
|
const fileTest = config.client.downloadPath + "/Roblox_setup.exe"
|
||||||
|
|
||||||
|
it("cleanup", function() {
|
||||||
|
if(fs.existsSync(fileTest))
|
||||||
|
fs.unlinkSync(fileTest);
|
||||||
|
})
|
||||||
|
|
||||||
it("click download", async function() {
|
it("click download", async function() {
|
||||||
this.timeout(45000);
|
this.timeout(45000);
|
||||||
const { app } = this
|
const { app } = this
|
||||||
@ -21,6 +28,21 @@ describe("download", function() {
|
|||||||
await app.client.click('.torrentRow .downloadFullButton')
|
await app.client.click('.torrentRow .downloadFullButton')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("check download exists in download tab", async function() {
|
||||||
|
this.timeout(8000);
|
||||||
|
const { app } = this
|
||||||
|
await app.client.click('#downloadTab')
|
||||||
|
await app.client.waitForExist('.downloads-list .torrentRow .torrentName')
|
||||||
|
const value = await app.client.$('.downloads-list .torrentRow .torrentName').getText()
|
||||||
|
assert.equal(value, 'Roblox_setup.exe')
|
||||||
|
// cancel in progress button must be exists
|
||||||
|
assert(await app.client.isExisting('.torrentRow .deleteDownloadBeforeFinish'));
|
||||||
|
assert(await app.client.isExisting('.torrentRow .pauseTorrent'));
|
||||||
|
// back to recent search
|
||||||
|
await app.client.click('#open-recent-search')
|
||||||
|
await app.client.waitForExist('.search-list')
|
||||||
|
})
|
||||||
|
|
||||||
it("wait until downloaded", async function() {
|
it("wait until downloaded", async function() {
|
||||||
this.timeout(90000);
|
this.timeout(90000);
|
||||||
const { app } = this
|
const { app } = this
|
||||||
@ -28,6 +50,9 @@ describe("download", function() {
|
|||||||
await app.client.waitUntil(async () => {
|
await app.client.waitUntil(async () => {
|
||||||
return (await app.client.getText('.torrentRow .progressDownloading')) === '100.0%'
|
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() {
|
it("check file after download", async function() {
|
||||||
@ -38,16 +63,30 @@ describe("download", function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("delete download from manager (after finish)", async function() {
|
it("delete download from manager (after finish)", async function() {
|
||||||
this.timeout(10000);
|
this.timeout(8000);
|
||||||
const { app } = this
|
const { app } = this
|
||||||
await app.client.waitForExist('.torrentRow .deleteDownloadAfterFinish')
|
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')
|
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() {
|
it("file must still exists after delete from manager", async function() {
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
const file = config.client.downloadPath + "/Roblox_setup.exe"
|
assert(fs.existsSync(fileTest));
|
||||||
assert(fs.existsSync(file));
|
assert.equal(await md5(fileTest), '7df171da63e2013c9b17e1857615b192');
|
||||||
assert.equal(await md5(file), '7df171da63e2013c9b17e1857615b192');
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user