@@ -701,12 +701,11 @@ def test_widgets_selected_after_validation_error(
701701
702702 # clicking city select2 lists all available cities
703703 city_container .click ()
704- WebDriverWait (driver , 60 ).until (
705- expected_conditions .presence_of_element_located (
704+ city_options = WebDriverWait (driver , 60 ).until (
705+ expected_conditions .presence_of_all_elements_located (
706706 (By .CSS_SELECTOR , ".select2-results li" )
707707 )
708708 )
709- city_options = driver .find_elements (By .CSS_SELECTOR , ".select2-results li" )
710709 city_names_from_browser = {option .text for option in city_options }
711710 city_names_from_db = set (City .objects .values_list ("name" , flat = True ))
712711 assert len (city_names_from_browser ) == City .objects .count ()
@@ -751,12 +750,11 @@ def test_widgets_selected_after_validation_error(
751750
752751 # clicking country select2 lists reduced list to the only country available to the city
753752 country_container .click ()
754- WebDriverWait (driver , 60 ).until (
755- expected_conditions .presence_of_element_located (
753+ country_options = WebDriverWait (driver , 60 ).until (
754+ expected_conditions .presence_of_all_elements_located (
756755 (By .CSS_SELECTOR , ".select2-results li" )
757756 )
758757 )
759- country_options = driver .find_elements (By .CSS_SELECTOR , ".select2-results li" )
760758 country_names_from_browser = {option .text for option in country_options }
761759 country_names_from_db = {City .objects .get (name = city_name ).country .name }
762760 assert len (country_names_from_browser ) != Country .objects .count ()
0 commit comments