Select2Widget test: move general error check to the end of the function; test that the select2 results get displayed when the widget is clicked

This commit is contained in:
Ben Cail 2015-04-08 08:47:34 -04:00
parent 12b00c1084
commit 537c8ec40b

View file

@ -25,8 +25,11 @@ class TestSelect2Widget(object):
def test_selecting(self, db, client, live_server, driver):
driver.get(live_server + self.url)
dropdown = driver.find_element_by_css_selector('.select2-results')
assert dropdown.is_displayed() is False
elem = driver.find_element_by_css_selector('.select2-choice')
elem.click()
assert dropdown.is_displayed() is True
with pytest.raises(NoSuchElementException):
error = driver.find_element_by_xpath('//body[@JSError]')
pytest.fail(error.get_attribute('JSError'))
elem = driver.find_element_by_id('s2id_id_number')
elem.click()