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
6752b90d
Commit
6752b90d
authored
Nov 16, 2016
by
Albert St. Aubin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed flaky annotations and updated tests to correct flakiness
TNL-5774
parent
ac2b5bcc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
22 deletions
+38
-22
common/test/acceptance/pages/lms/problem.py
+27
-7
common/test/acceptance/tests/lms/test_lms_problems.py
+2
-2
common/test/acceptance/tests/lms/test_problem_types.py
+9
-13
No files found.
common/test/acceptance/pages/lms/problem.py
View file @
6752b90d
...
...
@@ -3,7 +3,6 @@ Problem Page.
"""
from
bok_choy.page_object
import
PageObject
from
common.test.acceptance.pages.common.utils
import
click_css
from
common.test.acceptance.tests.helpers
import
is_focused_on_element
from
selenium.webdriver.common.keys
import
Keys
...
...
@@ -219,7 +218,16 @@ class ProblemPage(PageObject):
"""
Check for focus problem meta.
"""
return
is_focused_on_element
(
self
.
browser
,
'.problem-header'
)
return
self
.
q
(
css
=
'.problem-header'
)
.
focused
def
wait_for_focus_on_problem_meta
(
self
):
"""
Waits for focus on Problem Meta section
"""
self
.
wait_for
(
promise_check_func
=
self
.
is_focus_on_problem_meta
,
description
=
'Waiting for focus on Problem Meta section'
)
def
is_submit_disabled
(
self
):
"""
...
...
@@ -316,20 +324,32 @@ class ProblemPage(PageObject):
'Waiting for the focus to be on the hint notification'
)
def
click_review_in_notification
(
self
):
def
click_review_in_notification
(
self
,
notification_type
):
"""
Click on the "Review" button within the visible notification.
"""
css_string
=
'.notification.notification-{notification_type} .review-btn'
.
format
(
notification_type
=
notification_type
)
# The review button cannot be clicked on until it is tabbed to, so first tab to it.
# Multiple tabs may be required depending on the content (for instance, hints with links).
def
tab_until_review_focused
():
""" Tab until the review button is focused """
self
.
browser
.
switch_to_active_element
()
.
send_keys
(
Keys
.
TAB
)
return
self
.
q
(
css
=
'.notification .review-btn'
)
.
focused
self
.
wait_for
(
tab_until_review_focused
,
'Waiting for the Review button to become focused'
)
if
self
.
q
(
css
=
css_string
)
.
focused
:
self
.
scroll_to_element
(
css_string
)
return
self
.
q
(
css
=
css_string
)
.
focused
click_css
(
self
,
'.notification .review-btn'
,
require_notification
=
False
)
self
.
wait_for
(
tab_until_review_focused
,
'Waiting for the Review button to become focused'
)
self
.
wait_for_element_visibility
(
css_string
,
'Waiting for the button to be visible'
)
click_css
(
self
,
css_string
,
require_notification
=
False
)
def
get_hint_button_disabled_attr
(
self
):
""" Return the disabled attribute of all hint buttons (once hints are visible, there will be two). """
...
...
common/test/acceptance/tests/lms/test_lms_problems.py
View file @
6752b90d
...
...
@@ -154,8 +154,8 @@ class ProblemHintTest(ProblemsTest, EventsTestMixin):
self
.
assertEqual
([
'true'
,
'true'
],
problem_page
.
get_hint_button_disabled_attr
())
# Now click on "Review" and make sure the focus goes to the correct place.
problem_page
.
click_review_in_notification
()
self
.
assertTrue
(
problem_page
.
is_focus_on_problem_meta
()
)
problem_page
.
click_review_in_notification
(
notification_type
=
'hint'
)
problem_page
.
wait_for_focus_on_problem_meta
(
)
# Check corresponding tracking events
actual_events
=
self
.
wait_for_events
(
...
...
common/test/acceptance/tests/lms/test_problem_types.py
View file @
6752b90d
...
...
@@ -7,7 +7,6 @@ import random
import
textwrap
from
abc
import
ABCMeta
,
abstractmethod
from
flaky
import
flaky
from
nose
import
SkipTest
from
nose.plugins.attrib
import
attr
from
selenium.webdriver
import
ActionChains
...
...
@@ -166,9 +165,8 @@ class ProblemTypeTestMixin(object):
self
.
wait_for_status
(
'correct'
)
self
.
problem_page
.
wait_success_notification
()
# Check that clicking on "Review" goes to the problem meta location
self
.
problem_page
.
click_review_in_notification
()
# TODO: determine why the focus is not being set
# self.assertTrue(self.problem_page.is_focus_on_problem_meta())
self
.
problem_page
.
click_review_in_notification
(
notification_type
=
'submit'
)
self
.
problem_page
.
wait_for_focus_on_problem_meta
()
# Check for corresponding tracking event
expected_events
=
[
...
...
@@ -257,7 +255,7 @@ class ProblemTypeTestMixin(object):
And I should see the problem title is focused
"""
self
.
problem_page
.
click_show
()
self
.
assertTrue
(
self
.
problem_page
.
is_focus_on_problem_meta
()
)
self
.
problem_page
.
wait_for_focus_on_problem_meta
(
)
@attr
(
shard
=
7
)
def
test_save_reaction
(
self
):
...
...
@@ -285,16 +283,14 @@ class ProblemTypeTestMixin(object):
self
.
assertTrue
(
self
.
problem_page
.
is_save_button_enabled
())
self
.
problem_page
.
wait_for_save_notification
()
# Check that clicking on "Review" goes to the problem meta location
self
.
problem_page
.
click_review_in_notification
()
# TODO: determine why the focus is not being set
# self.assertTrue(self.problem_page.is_focus_on_problem_meta())
self
.
problem_page
.
click_review_in_notification
(
notification_type
=
'save'
)
self
.
problem_page
.
wait_for_focus_on_problem_meta
()
# Not all problems will detect the change and remove the save notification
if
self
.
can_update_save_notification
:
self
.
answer_problem
(
correctness
=
'incorrect'
)
self
.
assertFalse
(
self
.
problem_page
.
is_save_notification_visible
())
@flaky
# TNL-5774
@attr
(
shard
=
7
)
def
test_reset_clears_answer_and_focus
(
self
):
"""
...
...
@@ -316,7 +312,7 @@ class ProblemTypeTestMixin(object):
# clear the answers
self
.
problem_page
.
click_reset
()
# Focus should change to meta
self
.
assertTrue
(
self
.
problem_page
.
is_focus_on_problem_meta
()
)
self
.
problem_page
.
wait_for_focus_on_problem_meta
(
)
# Answer should be reset
self
.
wait_for_status
(
'unanswered'
)
...
...
@@ -493,7 +489,7 @@ class CheckboxProblemTypeTest(ProblemTypeTestBase, ProblemTypeTestMixin):
self
.
problem_page
.
click_show
()
self
.
assertTrue
(
self
.
problem_page
.
is_solution_tag_present
())
self
.
assertTrue
(
self
.
problem_page
.
is_correct_choice_highlighted
(
correct_choices
=
[
1
,
3
]))
self
.
assertTrue
(
self
.
problem_page
.
is_focus_on_problem_meta
()
)
self
.
problem_page
.
wait_for_focus_on_problem_meta
(
)
class
MultipleChoiceProblemTypeTest
(
ProblemTypeTestBase
,
ProblemTypeTestMixin
):
...
...
@@ -706,8 +702,8 @@ class NumericalProblemTypeTest(ProblemTypeTestBase, ProblemTypeTestMixin):
self
.
problem_page
.
click_submit
()
self
.
problem_page
.
wait_for_gentle_alert_notification
()
# Check that clicking on "Review" goes to the problem meta location
self
.
problem_page
.
click_review_in_notification
()
self
.
assertTrue
(
self
.
problem_page
.
is_focus_on_problem_meta
()
)
self
.
problem_page
.
click_review_in_notification
(
notification_type
=
'gentle-alert'
)
self
.
problem_page
.
wait_for_focus_on_problem_meta
(
)
class
FormulaProblemTypeTest
(
ProblemTypeTestBase
,
ProblemTypeTestMixin
):
...
...
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