Merge pull request #12268 from edx/muddasser/bokchoy/chrome/test_badge_share_modal

Fixed close button click issue
This commit is contained in:
Muddasser
2016-04-30 00:42:24 +05:00

View File

@@ -53,10 +53,22 @@ class Badge(PageObject):
"""
return BrowserQuery(self.full_view, css=".badges-modal").is_focused()
def bring_model_inside_window(self):
"""
Execute javascript to bring the popup(.badges-model) inside the window.
"""
script_to_execute = ("var popup = document.querySelectorAll('.badges-modal')[0];;"
"popup.style.left = '20%';")
self.full_view.execute_script(script_to_execute)
def close_modal(self):
"""
Close the badges modal and check that it is no longer displayed.
"""
# In chrome, close button is not inside window
# which causes click failures. To avoid this, just change
# the position of the popup
self.bring_model_inside_window()
BrowserQuery(self.full_view, css=".badges-modal .close").click()
EmptyPromise(lambda: not self.modal_displayed(), "Share modal dismissed").fulfill()