Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-poll
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
xblock-poll
Commits
a3b07134
Commit
a3b07134
authored
Aug 31, 2016
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add integration test that verifies that survey options are linked to
corresponding questions and answers.
parent
3981b6fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
tests/integration/test_functions.py
+26
-0
No files found.
tests/integration/test_functions.py
View file @
a3b07134
...
...
@@ -24,8 +24,12 @@
Tests a realistic, configured Poll to make sure that everything works as it
should.
"""
import
itertools
from
.base_test
import
PollBaseTest
ANSWER_SELECTOR
=
'label.poll-answer-text'
...
...
@@ -149,6 +153,28 @@ class TestSurveyFunctions(PollBaseTest):
submit_button
=
self
.
get_submit
()
self
.
assertFalse
(
submit_button
.
is_enabled
())
def
test_survey_options_a11y
(
self
):
"""
Checks if radio buttons representing survey options are linked to corresponding question and answer.
This is to ensure that screen reader users can be certain that a given radio button
is tied to a specific question and answer.
"""
self
.
go_to_page
(
'Survey Functions'
)
questions
=
self
.
browser
.
find_elements_by_css_selector
(
'.survey-question'
)
answers
=
self
.
browser
.
find_elements_by_css_selector
(
'.survey-answer'
)
question_ids
=
[
question
.
get_attribute
(
'id'
)
for
question
in
questions
]
answer_ids
=
[
answer
.
get_attribute
(
'id'
)
for
answer
in
answers
]
id_pairs
=
[
"{question_id} {answer_id}"
.
format
(
question_id
=
question_id
,
answer_id
=
answer_id
)
for
question_id
,
answer_id
in
itertools
.
product
(
question_ids
,
answer_ids
)
]
options
=
self
.
browser
.
find_elements_by_css_selector
(
'.survey-option input'
)
self
.
assertEqual
(
len
(
options
),
len
(
id_pairs
))
for
option
in
options
:
labelledby
=
option
.
get_attribute
(
'aria-labelledby'
)
self
.
assertIn
(
labelledby
,
id_pairs
)
def
fill_survey
(
self
,
assert_submit
=
False
):
"""
Fills out the survey. Optionally checks if the submit button is
...
...
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