Special condition needed for newer firefox version.

On the older firefox version (28), the offset approach fails. This
update is being made as part of an effort to upgrade to firefox 42
incrementally. So we are including logic for Firefox 28 vs 42 that
we can remove after the upgrade.
This commit is contained in:
Ben Patterson
2016-01-14 17:03:23 -05:00
parent 2b731b70d5
commit 29e4ba95e1

View File

@@ -263,9 +263,14 @@ class CourseOutlineContainer(CourseOutlineItem):
currently_expanded = subsection_expanded()
# Need to click slightly off-center in order for the click to be recognized.
ele = self.browser.find_element_by_css_selector(self._bounded_selector('.ui-toggle-expansion i'))
ActionChains(self.browser).move_to_element_with_offset(ele, 1, 1).click().perform()
# TODO: Special offset needed for newer firefox version. This was only tested with Firefox 42.
firefox_version = float(self.browser.capabilities['version'])
if firefox_version >= 42:
# Need to click slightly off-center in order for the click to be recognized.
ele = self.browser.find_element_by_css_selector(self._bounded_selector('.ui-toggle-expansion i'))
ActionChains(self.browser).move_to_element_with_offset(ele, 1, 1).click().perform()
else:
self.q(css=self._bounded_selector('.ui-toggle-expansion i')).first.click()
self.wait_for_element_presence(self._bounded_selector(self.ADD_BUTTON_SELECTOR), 'Subsection is expanded')
EmptyPromise(