Fix flakiness on annotation selenium test

This commit is contained in:
Jesse Zoldak
2015-01-09 13:52:46 -05:00
parent c93817962e
commit 586d798069

View File

@@ -65,8 +65,16 @@ class AnnotationComponentPage(PageObject):
Submit correct answer for active problem.
"""
self.q(css=self.active_problem_selector('.comment')).fill('Test Response')
self.q(css=self.active_problem_selector('.tag[data-id="{}"]'.format(self.active_problem))).click()
answer_css = self.active_problem_selector('.tag[data-id="{}"]'.format(self.active_problem))
# Selenium will first move the element into view then click on it.
self.q(css=answer_css).click()
# Wait for the click to take effect, which is after the class is applied.
self.wait_for(lambda: 'selected' in self.q(css=answer_css).attrs('class')[0], description='answer selected')
# Click the "Check" button.
self.q(css=self.active_problem_selector('.check')).click()
# This will trigger a POST to problem_check so wait until the response is returned.
self.wait_for_ajax()
def check_feedback(self):
"""