diff --git a/common/test/acceptance/accessibility/__init__.py b/common/test/acceptance/accessibility/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/common/test/acceptance/accessibility/test_lms_dashboard_a11y.py b/common/test/acceptance/accessibility/test_lms_dashboard_a11y.py deleted file mode 100644 index 45304ae506..0000000000 --- a/common/test/acceptance/accessibility/test_lms_dashboard_a11y.py +++ /dev/null @@ -1,28 +0,0 @@ -""" -Accessibility tests for LMS dashboard page. - -Run just this test with: -SELENIUM_BROWSER=phantomjs paver test_bokchoy -d accessibility -t test_lms_dashboard_a11y.py -""" -from ..tests.lms.test_lms_dashboard import BaseLmsDashboardTest - - -class LmsDashboardAxsTest(BaseLmsDashboardTest): - """ - Class to test lms student dashboard accessibility. - """ - - def test_dashboard_course_listings_axs(self): - """ - Test the accessibility of the course listings - """ - course_listings = self.dashboard_page.get_course_listings() - self.assertEqual(len(course_listings), 1) - - # There are several existing color contrast errors on this page, - # we will ignore this error in the test until we fix them. - self.dashboard_page.a11y_audit.config.set_rules({ - "ignore": ['color-contrast'], - }) - - self.dashboard_page.a11y_audit.check_for_accessibility_errors() diff --git a/common/test/acceptance/accessibility/test_studio_library_a11y.py b/common/test/acceptance/accessibility/test_studio_library_a11y.py deleted file mode 100644 index a4a86e1f43..0000000000 --- a/common/test/acceptance/accessibility/test_studio_library_a11y.py +++ /dev/null @@ -1,30 +0,0 @@ -""" -Accessibility tests for Studio Library pages. - -Run just this test with: -SELENIUM_BROWSER=phantomjs paver test_bokchoy -d accessibility -t test_studio_library_a11y.py -""" -from ..tests.studio.base_studio_test import StudioLibraryTest -from ..pages.studio.library import LibraryEditPage - - -class StudioLibraryAxsTest(StudioLibraryTest): - """ - Class to test Studio pages accessibility. - """ - - def test_lib_edit_page_axs(self): - """ - Check accessibility of LibraryEditPage. - """ - lib_page = LibraryEditPage(self.browser, self.library_key) - lib_page.visit() - lib_page.wait_until_ready() - - # There are several existing color contrast errors on this page, - # we will ignore this error in the test until we fix them. - lib_page.a11y_audit.config.set_rules({ - "ignore": ['color-contrast'], - }) - - lib_page.a11y_audit.check_for_accessibility_errors() diff --git a/common/test/acceptance/tests/lms/test_lms_dashboard.py b/common/test/acceptance/tests/lms/test_lms_dashboard.py index 8373360434..4e8cbf599c 100644 --- a/common/test/acceptance/tests/lms/test_lms_dashboard.py +++ b/common/test/acceptance/tests/lms/test_lms_dashboard.py @@ -3,6 +3,7 @@ End-to-end tests for the main LMS Dashboard (aka, Student Dashboard). """ import datetime +from nose.plugins.attrib import attr from ..helpers import UniqueCourseTest from ...fixtures.course import CourseFixture @@ -217,3 +218,25 @@ class LmsDashboardPageTest(BaseLmsDashboardTest): # Test that proper course date with 'starts' message is displayed if a course is about to start in future, # and course starts within 5 days self.assertEqual(course_date, expected_course_date) + + +@attr('a11y') +class LmsDashboardA11yTest(BaseLmsDashboardTest): + """ + Class to test lms student dashboard accessibility. + """ + + def test_dashboard_course_listings_a11y(self): + """ + Test the accessibility of the course listings + """ + course_listings = self.dashboard_page.get_course_listings() + self.assertEqual(len(course_listings), 1) + + # There are several existing color contrast errors on this page, + # we will ignore this error in the test until we fix them. + self.dashboard_page.a11y_audit.config.set_rules({ + "ignore": ['color-contrast'], + }) + + self.dashboard_page.a11y_audit.check_for_accessibility_errors() diff --git a/common/test/acceptance/tests/studio/test_studio_library.py b/common/test/acceptance/tests/studio/test_studio_library.py index 3094499285..fed2f5b8cf 100644 --- a/common/test/acceptance/tests/studio/test_studio_library.py +++ b/common/test/acceptance/tests/studio/test_studio_library.py @@ -637,3 +637,26 @@ class LibraryUsersPageTest(StudioLibraryTest): self.assertEqual(len(self.page.users), 1) user = self.page.users[0] self.assertTrue(user.is_current_user) + + +@attr('a11y') +class StudioLibraryA11yTest(StudioLibraryTest): + """ + Class to test Studio pages accessibility. + """ + + def test_lib_edit_page_a11y(self): + """ + Check accessibility of LibraryEditPage. + """ + lib_page = LibraryEditPage(self.browser, self.library_key) + lib_page.visit() + lib_page.wait_until_ready() + + # There are several existing color contrast errors on this page, + # we will ignore this error in the test until we fix them. + lib_page.a11y_audit.config.set_rules({ + "ignore": ['color-contrast'], + }) + + lib_page.a11y_audit.check_for_accessibility_errors() diff --git a/common/test/acceptance/tests/video/test_studio_video_module.py b/common/test/acceptance/tests/video/test_studio_video_module.py index 0ac762ae58..ff067e9fc7 100644 --- a/common/test/acceptance/tests/video/test_studio_video_module.py +++ b/common/test/acceptance/tests/video/test_studio_video_module.py @@ -3,6 +3,9 @@ """ Acceptance tests for CMS Video Module. """ +import os + +from mock import patch from nose.plugins.attrib import attr from unittest import skipIf from ...pages.studio.auto_auth import AutoAuthPage @@ -42,6 +45,38 @@ class CMSVideoBaseTest(UniqueCourseTest): ) self.assets = [] + self.addCleanup(YouTubeStubConfig.reset) + + def _create_course_unit(self, youtube_stub_config=None, subtitles=False): + """ + Create a Studio Video Course Unit and Navigate to it. + + Arguments: + youtube_stub_config (dict) + subtitles (bool) + + """ + if youtube_stub_config: + YouTubeStubConfig.configure(youtube_stub_config) + + if subtitles: + self.assets.append('subs_3_yD_cEKoCk.srt.sjson') + + self.navigate_to_course_unit() + + def _create_video(self): + """ + Create Xblock Video Component. + """ + self.video.create_video() + + video_xblocks = self.video.xblocks() + + # Total video xblock components count should be equals to 2 + # Why 2? One video component is created by default for each test. Please see + # test_studio_video_module.py:CMSVideoTest._create_course_unit + # And we are creating second video component here. + self.assertTrue(video_xblocks == 2) def _install_course_fixture(self): """ @@ -132,42 +167,6 @@ class CMSVideoTest(CMSVideoBaseTest): CMS Video Test Class """ - def setUp(self): - super(CMSVideoTest, self).setUp() - - self.addCleanup(YouTubeStubConfig.reset) - - def _create_course_unit(self, youtube_stub_config=None, subtitles=False): - """ - Create a Studio Video Course Unit and Navigate to it. - - Arguments: - youtube_stub_config (dict) - subtitles (bool) - - """ - if youtube_stub_config: - YouTubeStubConfig.configure(youtube_stub_config) - - if subtitles: - self.assets.append('subs_3_yD_cEKoCk.srt.sjson') - - self.navigate_to_course_unit() - - def _create_video(self): - """ - Create Xblock Video Component. - """ - self.video.create_video() - - video_xblocks = self.video.xblocks() - - # Total video xblock components count should be equals to 2 - # Why 2? One video component is created by default for each test. Please see - # test_studio_video_module.py:CMSVideoTest._create_course_unit - # And we are creating second video component here. - self.assertTrue(video_xblocks == 2) - def test_youtube_stub_proxy(self): """ Scenario: YouTube stub server proxies YouTube API correctly @@ -320,3 +319,31 @@ class CMSVideoTest(CMSVideoBaseTest): self.save_unit_settings() self.video.click_player_button('play') + + +@attr('a11y') +class CMSVideoA11yTest(CMSVideoBaseTest): + """ + CMS Video Accessibility Test Class + """ + + def setUp(self): + browser = os.environ.get('SELENIUM_BROWSER', 'firefox') + + # the a11y tests run in CI under phantomjs which doesn't + # support html5 video or flash player, so the video tests + # don't work in it. We still want to be able to run these + # tests in CI, so override the browser setting if it is + # phantomjs. + if browser == 'phantomjs': + browser = 'firefox' + + with patch.dict(os.environ, {'SELENIUM_BROWSER': browser}): + super(CMSVideoA11yTest, self).setUp() + + def test_video_player_a11y(self): + # Limit the scope of the audit to the video player only. + self.outline.a11y_audit.config.set_scope(include=["div.video"]) + + self._create_course_unit() + self.outline.a11y_audit.check_for_accessibility_errors() diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index 8f9e1340a2..8eca3d7c6f 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -119,7 +119,7 @@ django_debug_toolbar==1.3.2 # Used for testing astroid==1.3.8 -bok-choy==0.4.5 +bok-choy==0.4.6 chrono==1.0.2 coverage==4.0 ddt==0.8.0 diff --git a/scripts/accessibility-tests.sh b/scripts/accessibility-tests.sh index 1350f09891..d34b9e3bbc 100755 --- a/scripts/accessibility-tests.sh +++ b/scripts/accessibility-tests.sh @@ -3,4 +3,4 @@ echo "Setting up for accessibility tests..." source scripts/jenkins-common.sh echo "Running explicit accessibility tests..." -SELENIUM_BROWSER=phantomjs paver test_bokchoy -d accessibility +SELENIUM_BROWSER=phantomjs paver test_bokchoy --extra_args="-a 'a11y'" diff --git a/scripts/generic-ci-tests.sh b/scripts/generic-ci-tests.sh index 125e1e4b50..283bfedc74 100755 --- a/scripts/generic-ci-tests.sh +++ b/scripts/generic-ci-tests.sh @@ -172,7 +172,7 @@ END ;; "7") - paver test_bokchoy --extra_args="-a shard_1=False,shard_2=False,shard_3=False,shard_4=False,shard_5=False,shard_6=False --with-flaky" + paver test_bokchoy --extra_args="-a shard_1=False,shard_2=False,shard_3=False,shard_4=False,shard_5=False,shard_6=False,a11y=False --with-flaky" ;; # Default case because if we later define another bok-choy shard on Jenkins