Commit cc0bf853 by Christine Lytwynec

Merge pull request #763 from edx/clytwynec/add-custom-a11y-rules

add custom a11y rules in accessibility tests
parents 48bcea06 c69c00af
......@@ -34,6 +34,11 @@ coverage.xml
test_ora2db
test_ora2db-journal
# Bok choy
test/custom_a11y_rules.js
test/acceptance/screenshots/*.png
test/logs/*
# Mr Developer
.mr.developer.cfg
.project
......
......@@ -33,5 +33,24 @@ cd test/logs
test_name="${1:-acceptance}"
# The machines that these tests run on in jenkins have an old
# version of npm which doesn't seem to work with the
# requirements in this repo. There is a devops ticket for
# this, but it may be better to wait until some of the other
# work they have going on now is done before attempting to
# install the custom rules via npm. This bit of code is a
# work around for that. It will work both in jenkins and for
# local runs of the tests.
if [[ "${test_name}" = "accessibility" ]]; then
export BOKCHOY_A11Y_CUSTOM_RULES_FILE=../../test/custom_a11y_rules.js
if [[ ! -f $BOKCHOY_A11Y_CUSTOM_RULES_FILE ]]; then
echo "Custom a11y rules file not found. Fetching it..."
custom_a11y_version=8633ea2fd04d84d69c4610bbfbf38db32ad005a9
curl https://raw.githubusercontent.com/edx/edx-custom-a11y-rules/${custom_a11y_version}/lib/custom_a11y_rules.js > ${BOKCHOY_A11Y_CUSTOM_RULES_FILE}
fi
fi
echo "Running acceptance tests from ${test_name}.py against the sandbox..."
python ../acceptance/${test_name}.py
......@@ -16,12 +16,21 @@ class OpenAssessmentA11yTest(OpenAssessmentTest):
self.auto_auth_page.visit()
def _check_a11y(self, page):
page.a11y_audit.config.set_scope(
exclude=[
".container-footer",
".nav-skip",
"#global-navigation",
],
)
page.a11y_audit.config.set_rules({
"ignore": [
"aria-valid-attr", # TODO: AC-199
"color-contrast", # TODO: AC-198
"empty-heading", # TODO: AC-197
"link-href", # TODO: AC-199
"link-name", # TODO: AC-196
"skip-link", # TODO: AC-179
]
})
page.a11y_audit.check_for_accessibility_errors()
......
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