diff options
| author | nessita <124304+nessita@users.noreply.github.com> | 2023-11-28 19:06:17 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-28 23:06:17 +0100 |
| commit | 134cde8415b3a9118262ef4ea34cf798c258be03 (patch) | |
| tree | 04630e70bede1112c0c9eafe545654545e451cbb /tests/admin_views/test_autocomplete_view.py | |
| parent | 9e7ac5890147a8271eb5eb19bb88ab93dadc6c6d (diff) | |
Removed hard-coded expected results in SeleniumTests.test_select_multiple test.
This ensures that both tests, test_select() and test_select_multiple(),
use analogous calculations for the expected amount of results, and for
the iteration when pressing "arrow down" and waiting for the ajax call
to complete.
Diffstat (limited to 'tests/admin_views/test_autocomplete_view.py')
| -rw-r--r-- | tests/admin_views/test_autocomplete_view.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/admin_views/test_autocomplete_view.py b/tests/admin_views/test_autocomplete_view.py index 68bfacb016..8f56dd8314 100644 --- a/tests/admin_views/test_autocomplete_view.py +++ b/tests/admin_views/test_autocomplete_view.py @@ -461,8 +461,8 @@ class SeleniumTests(AdminSeleniumTestCase): ) search = self.selenium.find_element(By.CSS_SELECTOR, ".select2-search__field") # Load next page of results by scrolling to the bottom of the list. - with self.select2_ajax_wait(): - for _ in range(PAGINATOR_SIZE + 1): + for _ in range(PAGINATOR_SIZE + 1): + with self.select2_ajax_wait(): search.send_keys(Keys.ARROW_DOWN) # All objects are now loaded. self.assertCountSeleniumElements( @@ -532,7 +532,9 @@ class SeleniumTests(AdminSeleniumTestCase): with self.select2_ajax_wait(): search.send_keys(Keys.ARROW_DOWN) self.assertCountSeleniumElements( - ".select2-results__option", 31, root_element=result_container + ".select2-results__option", + PAGINATOR_SIZE + 11, + root_element=result_container, ) # Limit the results with the search field. with self.select2_ajax_wait(): @@ -540,7 +542,9 @@ class SeleniumTests(AdminSeleniumTestCase): # Ajax request is delayed. self.assertIs(result_container.is_displayed(), True) self.assertCountSeleniumElements( - ".select2-results__option", 32, root_element=result_container + ".select2-results__option", + PAGINATOR_SIZE + 12, + root_element=result_container, ) self.assertIs(result_container.is_displayed(), True) |
