Fixed a timing edge case in the RelatedFieldWidgetSeleniumFirefoxTests.
By settings an implicit wait timeout for the find_* methods we can wait till the javascript code add the new option to the DOM. See http://ci.djangoproject.com/job/Django/database=mysql_gis,python=python3.3/3174/testReport/junit/admin_widgets.tests/RelatedFieldWidgetSeleniumFirefoxTests/test_foreign_key_using_to_field/ Stacktrace: Traceback (most recent call last): File "/var/lib/jenkins/jobs/Django/workspace/database/mysql_gis/python/python3.3/tests/admin_widgets/tests.py", line 1060, in test_foreign_key_using_to_field self.assertEqual(username_value, new_option.get_attribute('value')) AssertionError: 'newuser' != 'testser' - newuser + testser
This commit is contained in:
parent
2fa0dd73b1
commit
351a061497
|
@ -1055,9 +1055,10 @@ class RelatedFieldWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
|
|||
save_button_css_selector = '.submit-row > input[type=submit]'
|
||||
self.selenium.find_element_by_css_selector(save_button_css_selector).click()
|
||||
self.selenium.switch_to_window(main_window)
|
||||
user_select = self.selenium.find_element_by_id('id_user')
|
||||
new_option = user_select.find_elements_by_tag_name('option')[-1]
|
||||
self.assertEqual(username_value, new_option.get_attribute('value'))
|
||||
# Wait up to 2 seconds for the new option to show up after clicking save in the popup.
|
||||
self.selenium.implicitly_wait(2)
|
||||
self.selenium.find_element_by_css_selector('#id_user option[value=newuser]')
|
||||
self.selenium.implicitly_wait(0)
|
||||
|
||||
# Go ahead and submit the form to make sure it works
|
||||
self.selenium.find_element_by_css_selector(save_button_css_selector).click()
|
||||
|
@ -1070,4 +1071,4 @@ class RelatedFieldWidgetSeleniumChromeTests(RelatedFieldWidgetSeleniumFirefoxTes
|
|||
webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
|
||||
|
||||
class RelatedFieldWidgetSeleniumIETests(RelatedFieldWidgetSeleniumFirefoxTests):
|
||||
webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
|
||||
webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
|
||||
|
|
Loading…
Reference in New Issue