Commit 6da296e4 by Muddasser

Extract hint from html instead of text

parent 76b8e2e8
...@@ -37,6 +37,13 @@ class ProblemPage(PageObject): ...@@ -37,6 +37,13 @@ class ProblemPage(PageObject):
return self.q(css="div.problem span.message").text[0] return self.q(css="div.problem span.message").text[0]
@property @property
def extract_hint_text_from_html(self):
"""
Return the "hint" text of the problem from html
"""
return self.q(css="div.problem div.problem-hint").html[0].split(' <', 1)[0]
@property
def hint_text(self): def hint_text(self):
""" """
Return the "hint" text of the problem from its div. Return the "hint" text of the problem from its div.
......
...@@ -288,13 +288,13 @@ class ProblemWithMathjax(ProblemsTest): ...@@ -288,13 +288,13 @@ class ProblemWithMathjax(ProblemsTest):
# The hint button rotates through multiple hints # The hint button rotates through multiple hints
problem_page.click_hint() problem_page.click_hint()
self.assertIn("Hint (1 of 2): mathjax should work1", problem_page.hint_text) self.assertIn("Hint (1 of 2): mathjax should work1", problem_page.extract_hint_text_from_html)
problem_page.verify_mathjax_rendered_in_hint() problem_page.verify_mathjax_rendered_in_hint()
# Rotate the hint and check the problem hint # Rotate the hint and check the problem hint
problem_page.click_hint() problem_page.click_hint()
self.assertIn("Hint (2 of 2): mathjax should work2", problem_page.hint_text) self.assertIn("Hint (2 of 2): mathjax should work2", problem_page.extract_hint_text_from_html)
problem_page.verify_mathjax_rendered_in_hint() problem_page.verify_mathjax_rendered_in_hint()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment