Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
9cfbbb23
Commit
9cfbbb23
authored
Oct 22, 2015
by
Christina Roberts
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10298 from edx/christina/tnl-2419
Use waits because MathJax rendering is asynchronous.
parents
cb252c31
f7e2830a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
29 deletions
+37
-29
common/test/acceptance/pages/lms/discussion.py
+12
-4
common/test/acceptance/pages/lms/problem.py
+20
-8
common/test/acceptance/tests/discussion/test_discussion.py
+2
-4
common/test/acceptance/tests/lms/test_lms_problems.py
+3
-13
No files found.
common/test/acceptance/pages/lms/discussion.py
View file @
9cfbbb23
...
...
@@ -116,11 +116,19 @@ class DiscussionThreadPage(PageObject, DiscussionPageMixin):
def
is_discussion_body_visible
(
self
):
return
self
.
_is_element_visible
(
".post-body"
)
def
is_mathjax_preview_available
(
self
):
return
self
.
q
(
css
=
".MathJax_Preview"
)
.
text
[
0
]
==
""
def
verify_mathjax_preview_available
(
self
):
""" Checks that MathJax Preview css class is present """
self
.
wait_for
(
lambda
:
len
(
self
.
q
(
css
=
".MathJax_Preview"
)
.
text
)
>
0
and
self
.
q
(
css
=
".MathJax_Preview"
)
.
text
[
0
]
==
""
,
description
=
"MathJax Preview is rendered"
)
def
is_mathjax_rendered
(
self
):
return
self
.
_is_element_visible
(
".MathJax"
)
def
verify_mathjax_rendered
(
self
):
""" Checks that MathJax css class is present """
self
.
wait_for
(
lambda
:
self
.
_is_element_visible
(
".MathJax"
),
description
=
"MathJax Preview is rendered"
)
def
is_response_visible
(
self
,
comment_id
):
"""Returns true if the response is viewable onscreen"""
...
...
common/test/acceptance/pages/lms/problem.py
View file @
9cfbbb23
...
...
@@ -42,21 +42,33 @@ class ProblemPage(PageObject):
"""
return
self
.
q
(
css
=
"div.problem div.problem-hint"
)
.
text
[
0
]
@property
def
mathjax_rendered_in_problem
(
self
):
def
verify_mathjax_rendered_in_problem
(
self
):
"""
Check that MathJax have been rendered in problem hint
"""
mathjax_container
=
self
.
q
(
css
=
"div.problem p .MathJax .math"
)
return
mathjax_container
.
visible
and
mathjax_container
.
present
def
mathjax_present
():
""" Returns True if MathJax css is present in the problem body """
mathjax_container
=
self
.
q
(
css
=
"div.problem p .MathJax .math"
)
return
mathjax_container
.
visible
and
mathjax_container
.
present
@property
def
mathjax_rendered_in_hint
(
self
):
self
.
wait_for
(
mathjax_present
,
description
=
"MathJax rendered in problem body"
)
def
verify_mathjax_rendered_in_hint
(
self
):
"""
Check that MathJax have been rendered in problem hint
"""
mathjax_container
=
self
.
q
(
css
=
"div.problem div.problem-hint .MathJax .math"
)
return
mathjax_container
.
visible
and
mathjax_container
.
present
def
mathjax_present
():
""" Returns True if MathJax css is present in the problem body """
mathjax_container
=
self
.
q
(
css
=
"div.problem div.problem-hint .MathJax .math"
)
return
mathjax_container
.
visible
and
mathjax_container
.
present
self
.
wait_for
(
mathjax_present
,
description
=
"MathJax rendered in hint"
)
def
fill_answer
(
self
,
text
):
"""
...
...
common/test/acceptance/tests/discussion/test_discussion.py
View file @
9cfbbb23
...
...
@@ -6,7 +6,6 @@ import datetime
from
pytz
import
UTC
from
uuid
import
uuid4
from
nose.plugins.attrib
import
attr
from
flaky
import
flaky
from
.helpers
import
BaseDiscussionTestCase
from
..helpers
import
UniqueCourseTest
...
...
@@ -218,7 +217,6 @@ class DiscussionTabSingleThreadTest(BaseDiscussionTestCase, DiscussionResponsePa
self
.
thread_page
=
self
.
create_single_thread_page
(
thread_id
)
# pylint: disable=attribute-defined-outside-init
self
.
thread_page
.
visit
()
@flaky
# TODO fix this, see TNL-2419
def
test_mathjax_rendering
(
self
):
thread_id
=
"test_thread_{}"
.
format
(
uuid4
()
.
hex
)
...
...
@@ -233,8 +231,8 @@ class DiscussionTabSingleThreadTest(BaseDiscussionTestCase, DiscussionResponsePa
thread_fixture
.
push
()
self
.
setup_thread_page
(
thread_id
)
self
.
assertTrue
(
self
.
thread_page
.
is_discussion_body_visible
())
self
.
assertTrue
(
self
.
thread_page
.
is_mathjax_preview_available
()
)
self
.
assertTrue
(
self
.
thread_page
.
is_mathjax_rendered
()
)
self
.
thread_page
.
verify_mathjax_preview_available
(
)
self
.
thread_page
.
verify_mathjax_rendered
(
)
def
test_markdown_reference_link
(
self
):
"""
...
...
common/test/acceptance/tests/lms/test_lms_problems.py
View file @
9cfbbb23
...
...
@@ -275,28 +275,18 @@ class ProblemWithMathjax(ProblemsTest):
problem_page
=
ProblemPage
(
self
.
browser
)
self
.
assertEqual
(
problem_page
.
problem_name
,
"MATHJAX TEST PROBLEM"
)
# Verify MathJax has been rendered
problem_page
.
wait_for
(
lambda
:
problem_page
.
mathjax_rendered_in_problem
,
description
=
"MathJax rendered in body"
)
problem_page
.
verify_mathjax_rendered_in_problem
()
# The hint button rotates through multiple hints
problem_page
.
click_hint
()
self
.
assertIn
(
"Hint (1 of 2): mathjax should work1"
,
problem_page
.
hint_text
)
problem_page
.
wait_for
(
lambda
:
problem_page
.
mathjax_rendered_in_hint
,
description
=
"MathJax rendered in hint"
)
problem_page
.
verify_mathjax_rendered_in_hint
()
# Rotate the hint and check the problem hint
problem_page
.
click_hint
()
self
.
assertIn
(
"Hint (2 of 2): mathjax should work2"
,
problem_page
.
hint_text
)
problem_page
.
wait_for
(
lambda
:
problem_page
.
mathjax_rendered_in_hint
,
description
=
"MathJax rendered in hint"
)
problem_page
.
verify_mathjax_rendered_in_hint
()
class
ProblemPartialCredit
(
ProblemsTest
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment