transmission: tests: functional: Fix to wait properly

When the page is initially loaded, torrents don't appear. It is later loaded
using an AJAX call. Wait until we find the torrents we need.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2020-05-28 09:20:14 -07:00 committed by James Valleroy
parent bc6b24247d
commit f768840165
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -26,7 +26,9 @@ def transmission_upload_sample_torrent(session_browser):
parsers.parse(
'there should be {torrents_number:d} torrents listed in transmission'))
def transmission_assert_number_of_torrents(session_browser, torrents_number):
assert torrents_number == _get_number_of_torrents(session_browser)
functional.visit(session_browser, '/transmission')
assert functional.eventually(
lambda: torrents_number == _get_number_of_torrents(session_browser))
def _remove_all_torrents(browser):
@ -65,5 +67,4 @@ def _upload_sample_torrent(browser):
def _get_number_of_torrents(browser):
"""Return the number torrents currently in transmission."""
functional.visit(browser, '/transmission')
return len(browser.find_by_css('#torrent_list .torrent'))