'Ensure that pressing the ESC key closes the date and time picker
widgets.
Refs #17064.'

def test_show_hide_date_time_picker_widgets(self):

    from selenium.webdriver.common.keys import Keys
    self.admin_login(username=u'super', password=u'secret', login_url=u'/')
    self.selenium.get((u'%s%s' % (self.live_server_url, u'/admin_widgets/member/add/')))
    self.assertEqual(self.get_css_value(u'#calendarbox0', u'display'), u'none')
    self.selenium.find_element_by_id(u'calendarlink0').click()
    self.assertEqual(self.get_css_value(u'#calendarbox0', u'display'), u'block')
    self.selenium.find_element_by_tag_name(u'body').send_keys([Keys.ESCAPE])
    self.assertEqual(self.get_css_value(u'#calendarbox0', u'display'), u'none')
    self.assertEqual(self.get_css_value(u'#clockbox0', u'display'), u'none')
    self.selenium.find_element_by_id(u'clocklink0').click()
    self.assertEqual(self.get_css_value(u'#clockbox0', u'display'), u'block')
    self.selenium.find_element_by_tag_name(u'body').send_keys([Keys.ESCAPE])
    self.assertEqual(self.get_css_value(u'#clockbox0', u'display'), u'none')
