Fix TNL-5453
This commit is contained in:
@@ -3,6 +3,7 @@ Utility methods common to Studio and the LMS.
|
||||
"""
|
||||
from bok_choy.promise import EmptyPromise
|
||||
from common.test.acceptance.tests.helpers import disable_animations
|
||||
from selenium.webdriver.common.action_chains import ActionChains
|
||||
|
||||
|
||||
def wait_for_notification(page):
|
||||
@@ -70,3 +71,10 @@ def confirm_prompt(page, cancel=False, require_notification=None):
|
||||
page.wait_for_element_visibility(confirmation_button_css, 'Confirmation button is visible')
|
||||
require_notification = (not cancel) if require_notification is None else require_notification
|
||||
click_css(page, confirmation_button_css, require_notification=require_notification)
|
||||
|
||||
|
||||
def hover(browser, element):
|
||||
"""
|
||||
Hover over an element.
|
||||
"""
|
||||
ActionChains(browser).move_to_element(element).perform()
|
||||
|
||||
@@ -5,6 +5,7 @@ from bok_choy.page_object import PageObject
|
||||
from bok_choy.promise import EmptyPromise, Promise
|
||||
|
||||
from common.test.acceptance.tests.helpers import is_focused_on_element
|
||||
from common.test.acceptance.pages.common.utils import hover
|
||||
|
||||
from common.test.acceptance.pages.lms.course_page import CoursePage
|
||||
|
||||
@@ -185,10 +186,14 @@ class DiscussionThreadPage(PageObject, DiscussionPageMixin):
|
||||
return link_href[0] if link_href else None
|
||||
|
||||
def get_response_vote_count(self, response_id):
|
||||
vote_count_css = '.response_{} .discussion-response .action-vote'.format(response_id)
|
||||
vote_count_element = self.browser.find_element_by_css_selector(vote_count_css)
|
||||
# To get the vote count, one must hover over the element first.
|
||||
hover(self.browser, vote_count_element)
|
||||
return self._get_element_text(".response_{} .discussion-response .action-vote .vote-count".format(response_id))
|
||||
|
||||
def vote_response(self, response_id):
|
||||
current_count = self._get_element_text(".response_{} .discussion-response .action-vote .vote-count".format(response_id))
|
||||
current_count = self.get_response_vote_count(response_id)
|
||||
self._find_within(".response_{} .discussion-response .action-vote".format(response_id)).first.click()
|
||||
self.wait_for(
|
||||
lambda: current_count != self.get_response_vote_count(response_id),
|
||||
|
||||
Reference in New Issue
Block a user