From fb52176a6f38071a540e8187fcb618d1fd152d09 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Mon, 20 Apr 2020 11:37:15 +0200 Subject: [PATCH] Made DateTimePickerShortcutsSeleniumTests.test_date_time_picker_shortcuts() less flaky. Moved picking the current time closer to the actual click. --- tests/admin_widgets/tests.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index 3d9f396d2d..b46753f95f 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -938,8 +938,6 @@ class DateTimePickerShortcutsSeleniumTests(AdminWidgetSeleniumTestCase): if tz_yesterday != tz_tomorrow: error_margin += timedelta(hours=1) - now = datetime.now() - self.selenium.get(self.live_server_url + reverse('admin:admin_widgets_member_add')) 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. shortcuts = self.selenium.find_elements_by_css_selector('.field-birthdate .datetimeshortcuts') + now = datetime.now() for shortcut in shortcuts: shortcut.find_element_by_tag_name('a').click()