fix(tests): fix tests on new api

This commit is contained in:
Alexey Kasyanchuk
2021-01-05 23:35:20 +03:00
parent e3c20a6fe2
commit 4b763c9377
5 changed files with 51 additions and 56 deletions

View File

@ -7,37 +7,35 @@ describe("search", function() {
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()
await (await app.client.$('#searchInput')).setValue('1413ba1915affdc3de7e1a81d6fdc32ef19395c9')
await (await app.client.$('#search')).click()
const value = await (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')
await (await app.client.$('#searchInput')).setValue('Roblox_setup')
await (await app.client.$('#search')).click()
await app.client.$('.torrentRow .torrentName')
const results = (await app.client.$$('.torrentRow .torrentName')).length
assert(results >= 1, 'default search on Roblox must return Roblox_setup record')
})
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')
await (await app.client.$('#searchInput')).setValue('Roblo')
await (await app.client.$('#search')).click()
await app.client.$('.torrentRow .torrentName')
const results = (await app.client.$$('.torrentRow .torrentName')).length
assert(results >= 1, 'particial word search must find string')
})
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')
await (await app.client.$('#searchInput')).setValue('magnet:?xt=urn:btih:1413ba1915affdc3de7e1a81d6fdc32ef19395c9')
await (await app.client.$('#search')).click()
await app.client.$('.torrentRow .torrentName')
const results = (await app.client.$$('.torrentRow .torrentName')).length
assert(results >= 1, 'magnet search must return 1 or more record')
})