Merge pull request #14421 from edx/christina/wiki

Wiki accessibility fixes.
This commit is contained in:
Christina Roberts
2017-02-03 10:34:58 -05:00
committed by GitHub
11 changed files with 192 additions and 112 deletions

View File

@@ -21,11 +21,25 @@ class CourseWikiPage(CoursePage):
def open_editor(self):
"""
Replace content of a wiki article with new content
Display the editor for a wiki article.
"""
edit_button = self.q(css='.fa-pencil')
edit_button.click()
def show_history(self):
"""
Show the change history for a wiki article.
"""
edit_button = self.q(css='.fa-clock-o')
edit_button.click()
def show_children(self):
"""
Show the children of a wiki article.
"""
children_link = self.q(css='.see-children>a')
children_link.click()
@property
def article_name(self):
"""
@@ -34,17 +48,15 @@ class CourseWikiPage(CoursePage):
return str(self.q(css='.main-article h1').text[0])
class CourseWikiEditPage(CoursePage):
"""
Editor page
"""
class CourseWikiSubviewPage(CoursePage): # pylint: disable=abstract-method
""" Abstract base page for subviews within the wiki. """
def __init__(self, browser, course_id, course_info):
"""
Course ID is currently of the form "edx/999/2013_Spring"
but this format could change.
"""
super(CourseWikiEditPage, self).__init__(browser, course_id)
super(CourseWikiSubviewPage, self).__init__(browser, course_id)
self.course_id = course_id
self.course_info = course_info
self.article_name = "{org}.{course_number}.{course_run}".format(
@@ -53,6 +65,12 @@ class CourseWikiEditPage(CoursePage):
course_run=self.course_info['run']
)
class CourseWikiEditPage(CourseWikiSubviewPage):
"""
Editor page
"""
@property
def url_path(self):
"""
@@ -79,3 +97,41 @@ class CourseWikiEditPage(CoursePage):
"""
self.q(css='button[name="save"]').click()
self.wait_for_element_presence('.alert-success', 'wait for the article to be saved')
class CourseWikiHistoryPage(CourseWikiSubviewPage):
"""
Course wiki change history page.
"""
def is_browser_on_page(self):
"""
Return if the browser is on the history page.
"""
return self.q(css='section.history').present
@property
def url_path(self):
"""
Construct a URL to the page within the course.
"""
return "/wiki/" + self.article_name + "/_history"
class CourseWikiChildrenPage(CourseWikiSubviewPage):
"""
Course wiki "All Children" page.
"""
def is_browser_on_page(self):
"""
Return if the browser is on the wiki children page (which contains a search widget).
"""
return self.q(css='.form-search').present
@property
def url_path(self):
"""
Construct a URL to the page within the course.
"""
return "/wiki/" + self.article_name + "/_dir"

View File

@@ -38,7 +38,9 @@ from common.test.acceptance.pages.studio.settings import SettingsPage
from common.test.acceptance.pages.lms.login_and_register import CombinedLoginAndRegisterPage, ResetPasswordPage
from common.test.acceptance.pages.lms.track_selection import TrackSelectionPage
from common.test.acceptance.pages.lms.pay_and_verify import PaymentAndVerificationFlow, FakePaymentPage
from common.test.acceptance.pages.lms.course_wiki import CourseWikiPage, CourseWikiEditPage
from common.test.acceptance.pages.lms.course_wiki import (
CourseWikiPage, CourseWikiEditPage, CourseWikiHistoryPage, CourseWikiChildrenPage
)
from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc, CourseUpdateDesc
@@ -543,7 +545,6 @@ class PayAndVerifyTest(EventsTestMixin, UniqueCourseTest):
self.assertEqual(enrollment_mode, 'verified')
@attr(shard=1)
class CourseWikiTest(UniqueCourseTest):
"""
Tests that verify the course wiki.
@@ -580,6 +581,14 @@ class CourseWikiTest(UniqueCourseTest):
self.course_wiki_page.open_editor()
self.course_wiki_edit_page.wait_for_page()
def _check_for_accessibility_errors(self, page, custom_rules=None):
""" Run accessibility check with custom rules, if provided """
if custom_rules is not None:
page.a11y_audit.config.set_rules(custom_rules)
page.a11y_audit.check_for_accessibility_errors()
@attr(shard=1)
def test_edit_course_wiki(self):
"""
Wiki page by default is editable for students.
@@ -596,6 +605,47 @@ class CourseWikiTest(UniqueCourseTest):
actual_content = unicode(self.course_wiki_page.q(css='.wiki-article p').text[0])
self.assertEqual(content, actual_content)
@attr('a11y')
def test_view_a11y(self):
"""
Verify the basic accessibility of the wiki page as initially displayed.
"""
self._check_for_accessibility_errors(self.course_wiki_page)
@attr('a11y')
def test_edit_a11y(self):
"""
Verify the basic accessibility of edit wiki page.
"""
self._open_editor()
self._check_for_accessibility_errors(self.course_wiki_edit_page)
@attr('a11y')
def test_changes_a11y(self):
"""
Verify the basic accessibility of changes wiki page.
"""
self.course_wiki_page.show_history()
history_page = CourseWikiHistoryPage(self.browser, self.course_id, self.course_info)
history_page.wait_for_page()
self._check_for_accessibility_errors(history_page)
@attr('a11y')
def test_children_a11y(self):
"""
Verify the basic accessibility of changes wiki page.
"""
self.course_wiki_page.show_children()
children_page = CourseWikiChildrenPage(self.browser, self.course_id, self.course_info)
children_page.wait_for_page()
custom_rules = {
'ignore': [
'label', # TNL-6440
'data-table' # TNL-6439
]
}
self._check_for_accessibility_errors(children_page, custom_rules)
@attr(shard=1)
class HighLevelTabTest(UniqueCourseTest):