Fixed test_undo_changes and test_manaul_change that were failing on Chrome

This commit is contained in:
raeeschachar
2015-10-06 01:22:41 +05:00
parent 87e3988c6a
commit cb02b62b7c
2 changed files with 18 additions and 3 deletions

View File

@@ -48,11 +48,26 @@ class AdvancedSettingsPage(CoursePage):
self.browser.refresh()
self.wait_for_page()
def coordinates_for_scrolling(self, coordinates_for):
"""
Get the x and y coordinates of elements
"""
cordinates_dict = self.browser.find_element_by_css_selector(coordinates_for)
location = cordinates_dict.location
for key, val in location.iteritems():
if key == 'x':
x_axis = val
elif key == 'y':
y_axis = val
return x_axis, y_axis
def undo_changes_via_modal(self):
"""
Trigger clicking event of the undo changes button in the modal.
Wait for the undoing process to load via ajax call.
Before that Scroll so the button is clickable on all browsers
"""
self.browser.execute_script("window.scrollTo" + str(self.coordinates_for_scrolling(UNDO_BUTTON_SELECTOR)))
self.q(css=UNDO_BUTTON_SELECTOR).click()
self.wait_for_ajax()
@@ -60,7 +75,9 @@ class AdvancedSettingsPage(CoursePage):
"""
Trigger click event of the manual changes button in the modal.
No need to wait for any ajax.
Before that Scroll so the button is clickable on all browsers
"""
self.browser.execute_script("window.scrollTo" + str(self.coordinates_for_scrolling(MANUAL_BUTTON_SELECTOR)))
self.q(css=MANUAL_BUTTON_SELECTOR).click()
def is_validation_modal_present(self):