17. Браузерное тестирование
class AdminSeleniumWebDriverTestCase(LiveServerTestCase):
...
class DateTimePickerSelenium(AdminSeleniumWebDriverTestCase):
def test_show_hide_date_time_picker_widgets(self):
self.admin_login(username='super', password='123')
# Open a page that has a date and time picker widgets
self.selenium.get('%s%s' % (self.live_server_url,
'/admin_widgets/member/add/'))
# Check that the date picker is hidden
self.assertEqual(
self.get_css_value('#calendarbox0', 'display'), 'none')
# Click the calendar icon
self.selenium.find_element_by_id('calendarlink0').click()
# Check that the date picker is visible
self.assertEqual(
self.get_css_value('#calendarbox0', 'display'), 'block')