Made DateTimePickerShortcutsSeleniumTests.test_date_time_picker_shortcuts() less flaky.

Moved picking the current time closer to the actual click.
This commit is contained in:
Mariusz Felisiak 2020-04-20 11:37:15 +02:00
parent b73e66e758
commit fb52176a6f
1 changed files with 1 additions and 2 deletions

View File

@ -938,8 +938,6 @@ class DateTimePickerShortcutsSeleniumTests(AdminWidgetSeleniumTestCase):
if tz_yesterday != tz_tomorrow: if tz_yesterday != tz_tomorrow:
error_margin += timedelta(hours=1) error_margin += timedelta(hours=1)
now = datetime.now()
self.selenium.get(self.live_server_url + reverse('admin:admin_widgets_member_add')) self.selenium.get(self.live_server_url + reverse('admin:admin_widgets_member_add'))
self.selenium.find_element_by_id('id_name').send_keys('test') self.selenium.find_element_by_id('id_name').send_keys('test')
@ -947,6 +945,7 @@ class DateTimePickerShortcutsSeleniumTests(AdminWidgetSeleniumTestCase):
# Click on the "today" and "now" shortcuts. # Click on the "today" and "now" shortcuts.
shortcuts = self.selenium.find_elements_by_css_selector('.field-birthdate .datetimeshortcuts') shortcuts = self.selenium.find_elements_by_css_selector('.field-birthdate .datetimeshortcuts')
now = datetime.now()
for shortcut in shortcuts: for shortcut in shortcuts:
shortcut.find_element_by_tag_name('a').click() shortcut.find_element_by_tag_name('a').click()