From f7688401653b13208ee75dbd2679848e96465512 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Thu, 28 May 2020 09:20:14 -0700 Subject: [PATCH] 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 Reviewed-by: James Valleroy --- plinth/modules/transmission/tests/test_functional.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plinth/modules/transmission/tests/test_functional.py b/plinth/modules/transmission/tests/test_functional.py index ae7236b2e..68e8341e8 100644 --- a/plinth/modules/transmission/tests/test_functional.py +++ b/plinth/modules/transmission/tests/test_functional.py @@ -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'))