feat(tests): search test
This commit is contained in:
parent
ce618f4408
commit
ae7b6fe793
@ -287,6 +287,7 @@ class Search extends Component {
|
||||
floatingLabelText={__('What to search?')}
|
||||
fullWidth={true}
|
||||
ref='searchInput'
|
||||
id='searchInput'
|
||||
defaultValue={this.searchValue}
|
||||
errorText={this.searchError}
|
||||
onKeyPress={(e) => {
|
||||
@ -335,7 +336,7 @@ class Search extends Component {
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
<RaisedButton style={{marginLeft: '10px'}} label={__('Search')} primary={true} onClick={() =>{
|
||||
<RaisedButton style={{marginLeft: '10px'}} id='search' label={__('Search')} primary={true} onClick={() =>{
|
||||
this.search()
|
||||
}} />
|
||||
</div>
|
||||
|
@ -262,6 +262,7 @@ export default class Torrent extends Component {
|
||||
return (
|
||||
<div>
|
||||
<ListItem
|
||||
className='torrentRow'
|
||||
innerDivStyle={{paddingRight: 84}}
|
||||
onClick={(e) => {
|
||||
const link = '/torrent/' + torrent.hash;
|
||||
@ -284,7 +285,7 @@ export default class Torrent extends Component {
|
||||
if(node)
|
||||
node.onclick = () => { return false }
|
||||
}}>
|
||||
<span className='break-word' style={{
|
||||
<span className='break-word torrentName' style={{
|
||||
color: torrent.contentCategory != 'xxx' ? (torrent.peer ? '#5643db' : 'black') : (torrent.peer ? '#9083e2' : 'grey')
|
||||
}}>
|
||||
{torrent.name}
|
||||
|
1
src/background/asyncWait.js
Normal file
1
src/background/asyncWait.js
Normal file
@ -0,0 +1 @@
|
||||
module.exports = (time) => new Promise((resolve) => setTimeout(resolve, time))
|
@ -8,7 +8,7 @@ const startApplication = function() {
|
||||
args: ["."],
|
||||
startTimeout: 30000,
|
||||
waitTimeout: 30000,
|
||||
quitTimeout: 10000
|
||||
quitTimeout: 15000
|
||||
});
|
||||
return this.app.start();
|
||||
};
|
||||
|
44
tests/seach.test.js
Normal file
44
tests/seach.test.js
Normal file
@ -0,0 +1,44 @@
|
||||
import { assert } from "chai";
|
||||
const asyncWait = require('../src/background/asyncWait')
|
||||
|
||||
describe("search", function() {
|
||||
this.timeout(30000);
|
||||
|
||||
it("dht seach", async function() {
|
||||
this.timeout(45000);
|
||||
const { app } = this
|
||||
await app.client.waitForExist('#searchInput')
|
||||
await app.client.$('#searchInput').setValue('1413ba1915affdc3de7e1a81d6fdc32ef19395c9')
|
||||
await app.client.click('#search')
|
||||
await app.client.waitForExist('.torrentRow .torrentName')
|
||||
const value = await app.client.$('.torrentRow .torrentName').getText()
|
||||
assert.equal(value, 'Roblox_setup.exe')
|
||||
})
|
||||
|
||||
it("sphinx search", async function() {
|
||||
const { app } = this
|
||||
await app.client.$('#searchInput').setValue('Roblox_setup')
|
||||
await app.client.click('#search')
|
||||
await app.client.waitForExist('.torrentRow .torrentName')
|
||||
const results = (await app.client.$$('.torrentRow .torrentName')).length
|
||||
assert(results >= 1)
|
||||
})
|
||||
|
||||
it("sphinx particial search", async function() {
|
||||
const { app } = this
|
||||
await app.client.$('#searchInput').setValue('Roblo')
|
||||
await app.client.click('#search')
|
||||
await app.client.waitForExist('.torrentRow .torrentName')
|
||||
const results = (await app.client.$$('.torrentRow .torrentName')).length
|
||||
assert(results >= 1)
|
||||
})
|
||||
|
||||
it("magnet search", async function() {
|
||||
const { app } = this
|
||||
await app.client.$('#searchInput').setValue('magnet:?xt=urn:btih:1413ba1915affdc3de7e1a81d6fdc32ef19395c9')
|
||||
await app.client.click('#search')
|
||||
await app.client.waitForExist('.torrentRow .torrentName')
|
||||
const results = (await app.client.$$('.torrentRow .torrentName')).length
|
||||
assert(results == 1)
|
||||
})
|
||||
});
|
Loading…
Reference in New Issue
Block a user