mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Replaced selenium.find_element_by_css_selector where by_id is sufficient.
This commit is contained in:
parent
3d6474e1a5
commit
2ed2db2ea3
@ -4240,46 +4240,38 @@ class SeleniumAdminViewsFirefoxTests(AdminSeleniumWebDriverTestCase):
|
||||
reverse('admin:admin_views_mainprepopulated_add')))
|
||||
|
||||
# Main form ----------------------------------------------------------
|
||||
self.selenium.find_element_by_css_selector('#id_pubdate').send_keys('2012-02-18')
|
||||
self.selenium.find_element_by_id('id_pubdate').send_keys('2012-02-18')
|
||||
self.get_select_option('#id_status', 'option two').click()
|
||||
self.selenium.find_element_by_css_selector('#id_name').send_keys(' this is the mAin nÀMë and it\'s awεšomeııı')
|
||||
slug1 = self.selenium.find_element_by_css_selector('#id_slug1').get_attribute('value')
|
||||
slug2 = self.selenium.find_element_by_css_selector('#id_slug2').get_attribute('value')
|
||||
slug3 = self.selenium.find_element_by_css_selector('#id_slug3').get_attribute('value')
|
||||
self.selenium.find_element_by_id('id_name').send_keys(' this is the mAin nÀMë and it\'s awεšomeııı')
|
||||
slug1 = self.selenium.find_element_by_id('id_slug1').get_attribute('value')
|
||||
slug2 = self.selenium.find_element_by_id('id_slug2').get_attribute('value')
|
||||
slug3 = self.selenium.find_element_by_id('id_slug3').get_attribute('value')
|
||||
self.assertEqual(slug1, 'main-name-and-its-awesomeiii-2012-02-18')
|
||||
self.assertEqual(slug2, 'option-two-main-name-and-its-awesomeiii')
|
||||
self.assertEqual(slug3, 'main-n\xe0m\xeb-and-its-aw\u03b5\u0161ome\u0131\u0131\u0131')
|
||||
|
||||
# Stacked inlines ----------------------------------------------------
|
||||
# Initial inline
|
||||
self.selenium.find_element_by_css_selector('#id_relatedprepopulated_set-0-pubdate').send_keys('2011-12-17')
|
||||
self.selenium.find_element_by_id('id_relatedprepopulated_set-0-pubdate').send_keys('2011-12-17')
|
||||
self.get_select_option('#id_relatedprepopulated_set-0-status', 'option one').click()
|
||||
self.selenium.find_element_by_css_selector(
|
||||
'#id_relatedprepopulated_set-0-name'
|
||||
).send_keys(' here is a sŤāÇkeð inline ! ')
|
||||
slug1 = self.selenium.find_element_by_css_selector(
|
||||
'#id_relatedprepopulated_set-0-slug1'
|
||||
).get_attribute('value')
|
||||
slug2 = self.selenium.find_element_by_css_selector(
|
||||
'#id_relatedprepopulated_set-0-slug2'
|
||||
).get_attribute('value')
|
||||
self.selenium.find_element_by_id('id_relatedprepopulated_set-0-name').send_keys(
|
||||
' here is a sŤāÇkeð inline ! '
|
||||
)
|
||||
slug1 = self.selenium.find_element_by_id('id_relatedprepopulated_set-0-slug1').get_attribute('value')
|
||||
slug2 = self.selenium.find_element_by_id('id_relatedprepopulated_set-0-slug2').get_attribute('value')
|
||||
self.assertEqual(slug1, 'here-stacked-inline-2011-12-17')
|
||||
self.assertEqual(slug2, 'option-one-here-stacked-inline')
|
||||
|
||||
# Add an inline
|
||||
self.selenium.find_elements_by_link_text('Add another Related prepopulated')[0].click()
|
||||
self.selenium.find_element_by_css_selector('#id_relatedprepopulated_set-1-pubdate').send_keys('1999-01-25')
|
||||
self.selenium.find_element_by_id('id_relatedprepopulated_set-1-pubdate').send_keys('1999-01-25')
|
||||
self.get_select_option('#id_relatedprepopulated_set-1-status', 'option two').click()
|
||||
self.selenium.find_element_by_css_selector('#id_relatedprepopulated_set-1-name').send_keys(
|
||||
self.selenium.find_element_by_id('id_relatedprepopulated_set-1-name').send_keys(
|
||||
' now you haVe anöther sŤāÇkeð inline with a very ... '
|
||||
'loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooog text... '
|
||||
)
|
||||
slug1 = self.selenium.find_element_by_css_selector(
|
||||
'#id_relatedprepopulated_set-1-slug1'
|
||||
).get_attribute('value')
|
||||
slug2 = self.selenium.find_element_by_css_selector(
|
||||
'#id_relatedprepopulated_set-1-slug2'
|
||||
).get_attribute('value')
|
||||
slug1 = self.selenium.find_element_by_id('id_relatedprepopulated_set-1-slug1').get_attribute('value')
|
||||
slug2 = self.selenium.find_element_by_id('id_relatedprepopulated_set-1-slug2').get_attribute('value')
|
||||
# 50 characters maximum for slug1 field
|
||||
self.assertEqual(slug1, 'now-you-have-another-stacked-inline-very-loooooooo')
|
||||
# 60 characters maximum for slug2 field
|
||||
@ -4287,33 +4279,25 @@ class SeleniumAdminViewsFirefoxTests(AdminSeleniumWebDriverTestCase):
|
||||
|
||||
# Tabular inlines ----------------------------------------------------
|
||||
# Initial inline
|
||||
self.selenium.find_element_by_css_selector('#id_relatedprepopulated_set-2-0-pubdate').send_keys('1234-12-07')
|
||||
self.selenium.find_element_by_id('id_relatedprepopulated_set-2-0-pubdate').send_keys('1234-12-07')
|
||||
self.get_select_option('#id_relatedprepopulated_set-2-0-status', 'option two').click()
|
||||
self.selenium.find_element_by_css_selector(
|
||||
'#id_relatedprepopulated_set-2-0-name'
|
||||
).send_keys('And now, with a tÃbűlaŘ inline !!!')
|
||||
slug1 = self.selenium.find_element_by_css_selector(
|
||||
'#id_relatedprepopulated_set-2-0-slug1'
|
||||
).get_attribute('value')
|
||||
slug2 = self.selenium.find_element_by_css_selector(
|
||||
'#id_relatedprepopulated_set-2-0-slug2'
|
||||
).get_attribute('value')
|
||||
self.selenium.find_element_by_id('id_relatedprepopulated_set-2-0-name').send_keys(
|
||||
'And now, with a tÃbűlaŘ inline !!!'
|
||||
)
|
||||
slug1 = self.selenium.find_element_by_id('id_relatedprepopulated_set-2-0-slug1').get_attribute('value')
|
||||
slug2 = self.selenium.find_element_by_id('id_relatedprepopulated_set-2-0-slug2').get_attribute('value')
|
||||
self.assertEqual(slug1, 'and-now-tabular-inline-1234-12-07')
|
||||
self.assertEqual(slug2, 'option-two-and-now-tabular-inline')
|
||||
|
||||
# Add an inline
|
||||
self.selenium.find_elements_by_link_text('Add another Related prepopulated')[1].click()
|
||||
self.selenium.find_element_by_css_selector('#id_relatedprepopulated_set-2-1-pubdate').send_keys('1981-08-22')
|
||||
self.selenium.find_element_by_id('id_relatedprepopulated_set-2-1-pubdate').send_keys('1981-08-22')
|
||||
self.get_select_option('#id_relatedprepopulated_set-2-1-status', 'option one').click()
|
||||
self.selenium.find_element_by_css_selector('#id_relatedprepopulated_set-2-1-name').send_keys(
|
||||
self.selenium.find_element_by_id('id_relatedprepopulated_set-2-1-name').send_keys(
|
||||
'a tÃbűlaŘ inline with ignored ;"&*^\%$#@-/`~ characters'
|
||||
)
|
||||
slug1 = self.selenium.find_element_by_css_selector(
|
||||
'#id_relatedprepopulated_set-2-1-slug1'
|
||||
).get_attribute('value')
|
||||
slug2 = self.selenium.find_element_by_css_selector(
|
||||
'#id_relatedprepopulated_set-2-1-slug2'
|
||||
).get_attribute('value')
|
||||
slug1 = self.selenium.find_element_by_id('id_relatedprepopulated_set-2-1-slug1').get_attribute('value')
|
||||
slug2 = self.selenium.find_element_by_id('id_relatedprepopulated_set-2-1-slug2').get_attribute('value')
|
||||
self.assertEqual(slug1, 'tabular-inline-ignored-characters-1981-08-22')
|
||||
self.assertEqual(slug2, 'option-one-tabular-inline-ignored-characters')
|
||||
|
||||
@ -4382,11 +4366,11 @@ class SeleniumAdminViewsFirefoxTests(AdminSeleniumWebDriverTestCase):
|
||||
reverse('admin:admin_views_mainprepopulated_change', args=(item.id,)))
|
||||
|
||||
self.selenium.get(object_url)
|
||||
self.selenium.find_element_by_css_selector('#id_name').send_keys(' the best')
|
||||
self.selenium.find_element_by_id('id_name').send_keys(' the best')
|
||||
|
||||
# The slugs got prepopulated since they were originally empty
|
||||
slug1 = self.selenium.find_element_by_css_selector('#id_slug1').get_attribute('value')
|
||||
slug2 = self.selenium.find_element_by_css_selector('#id_slug2').get_attribute('value')
|
||||
slug1 = self.selenium.find_element_by_id('id_slug1').get_attribute('value')
|
||||
slug2 = self.selenium.find_element_by_id('id_slug2').get_attribute('value')
|
||||
self.assertEqual(slug1, 'main-name-best-2012-02-18')
|
||||
self.assertEqual(slug2, 'option-two-main-name-best')
|
||||
|
||||
@ -4395,11 +4379,11 @@ class SeleniumAdminViewsFirefoxTests(AdminSeleniumWebDriverTestCase):
|
||||
self.wait_page_loaded()
|
||||
|
||||
self.selenium.get(object_url)
|
||||
self.selenium.find_element_by_css_selector('#id_name').send_keys(' hello')
|
||||
self.selenium.find_element_by_id('id_name').send_keys(' hello')
|
||||
|
||||
# The slugs got prepopulated didn't change since they were originally not empty
|
||||
slug1 = self.selenium.find_element_by_css_selector('#id_slug1').get_attribute('value')
|
||||
slug2 = self.selenium.find_element_by_css_selector('#id_slug2').get_attribute('value')
|
||||
slug1 = self.selenium.find_element_by_id('id_slug1').get_attribute('value')
|
||||
slug2 = self.selenium.find_element_by_id('id_slug2').get_attribute('value')
|
||||
self.assertEqual(slug1, 'main-name-best-2012-02-18')
|
||||
self.assertEqual(slug2, 'option-two-main-name-best')
|
||||
|
||||
|
@ -1068,9 +1068,9 @@ class HorizontalVerticalFilterSeleniumFirefoxTests(SeleniumDataMixin, AdminSelen
|
||||
for field_name in ['students', 'alumni']:
|
||||
from_box = '#id_%s_from' % field_name
|
||||
to_box = '#id_%s_to' % field_name
|
||||
choose_link = '#id_%s_add_link' % field_name
|
||||
remove_link = '#id_%s_remove_link' % field_name
|
||||
input = self.selenium.find_element_by_css_selector('#id_%s_input' % field_name)
|
||||
choose_link = 'id_%s_add_link' % field_name
|
||||
remove_link = 'id_%s_remove_link' % field_name
|
||||
input = self.selenium.find_element_by_id('id_%s_input' % field_name)
|
||||
|
||||
# Initial values
|
||||
self.assertSelectOptions(from_box,
|
||||
@ -1099,14 +1099,14 @@ class HorizontalVerticalFilterSeleniumFirefoxTests(SeleniumDataMixin, AdminSelen
|
||||
input.send_keys('a')
|
||||
self.assertSelectOptions(from_box, [str(self.arthur.id), str(self.jason.id)])
|
||||
self.get_select_option(from_box, str(self.jason.id)).click()
|
||||
self.selenium.find_element_by_css_selector(choose_link).click()
|
||||
self.selenium.find_element_by_id(choose_link).click()
|
||||
self.assertSelectOptions(from_box, [str(self.arthur.id)])
|
||||
self.assertSelectOptions(to_box,
|
||||
[str(self.lisa.id), str(self.peter.id),
|
||||
str(self.jason.id)])
|
||||
|
||||
self.get_select_option(to_box, str(self.lisa.id)).click()
|
||||
self.selenium.find_element_by_css_selector(remove_link).click()
|
||||
self.selenium.find_element_by_id(remove_link).click()
|
||||
self.assertSelectOptions(from_box,
|
||||
[str(self.arthur.id), str(self.lisa.id)])
|
||||
self.assertSelectOptions(to_box,
|
||||
@ -1124,7 +1124,7 @@ class HorizontalVerticalFilterSeleniumFirefoxTests(SeleniumDataMixin, AdminSelen
|
||||
# Check that pressing enter on a filtered option sends it properly
|
||||
# to the 'to' box.
|
||||
self.get_select_option(to_box, str(self.jason.id)).click()
|
||||
self.selenium.find_element_by_css_selector(remove_link).click()
|
||||
self.selenium.find_element_by_id(remove_link).click()
|
||||
input.send_keys('ja')
|
||||
self.assertSelectOptions(from_box, [str(self.jason.id)])
|
||||
input.send_keys([Keys.ENTER])
|
||||
|
Loading…
Reference in New Issue
Block a user