Fixed test_undo_changes and test_manaul_change that were failing on Chrome
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -306,7 +306,7 @@ class AdvancedSettingsValidationTest(StudioCourseTest):
|
||||
# Let modal popup
|
||||
self.advanced_settings.wait_for_modal_load()
|
||||
|
||||
# Press Undo Changes button
|
||||
# Click Undo Changes button
|
||||
self.advanced_settings.undo_changes_via_modal()
|
||||
|
||||
# Check that changes are undone
|
||||
@@ -337,8 +337,6 @@ class AdvancedSettingsValidationTest(StudioCourseTest):
|
||||
|
||||
# Iterate through the wrong values and make sure they're still displayed
|
||||
for key, val in inputs.iteritems():
|
||||
print self.advanced_settings.get(key)
|
||||
print val
|
||||
self.assertEquals(
|
||||
str(self.advanced_settings.get(key)),
|
||||
str(val),
|
||||
|
||||
Reference in New Issue
Block a user