Commit e7e1f647 by ssemenova

replace positive tab index values in the platform

TNL-4705
parent 905c5c56
"""
Course Textbooks page.
"""
from .course_page import CoursePage
from bok_choy.promise import EmptyPromise
class TextbookViewPage(CoursePage):
"""
Course Textbooks page.
"""
url_path = "pdfbook/0/"
def is_browser_on_page(self):
return self.q(css='.book-sidebar').present
def switch_to_pdf_frame(self, test):
"""
Waits for pdf frame to load, then switches driver to the frame
"""
EmptyPromise(
lambda: self.q(css='iframe').present, "Iframe loaded"
).fulfill()
driver = test.get_web_driver()
driver.switch_to_frame(driver.find_element_by_tag_name("iframe"))
......@@ -8,7 +8,7 @@ from ..common.utils import click_css
from .course_page import CoursePage
class TextbooksPage(CoursePage):
class TextbookUploadPage(CoursePage):
"""
Course Textbooks page.
"""
......@@ -41,7 +41,7 @@ class TextbooksPage(CoursePage):
Uploads a pdf textbook.
"""
# If the pdf upload section has not yet been toggled on, click on the upload pdf button
test_dir = path(__file__).abspath().dirname().dirname().dirname()
test_dir = path(__file__).abspath().dirname().dirname().dirname().dirname() # pylint:disable=no-value-for-parameter
file_path = test_dir + '/data/uploads/' + file_name
click_css(self, ".edit-textbook .action-upload", require_notification=False)
......@@ -70,3 +70,13 @@ class TextbooksPage(CoursePage):
return False
return response.status_code == 200
def upload_new_textbook(self):
"""
Fills out form to upload a new textbook
"""
self.open_add_textbook_form()
self.upload_pdf_file('textbook.pdf')
self.set_input_field_value('.edit-textbook #textbook-name-input', 'book_1')
self.set_input_field_value('.edit-textbook #chapter1-name', 'chap_1')
self.click_textbook_submit_button()
......@@ -18,7 +18,7 @@ from ...pages.studio.settings import SettingsPage
from ...pages.studio.settings_advanced import AdvancedSettingsPage
from ...pages.studio.settings_graders import GradingPage
from ...pages.studio.signup import SignupPage
from ...pages.studio.textbooks import TextbooksPage
from ...pages.studio.textbook_upload import TextbookUploadPage
from ...fixtures.course import XBlockFixtureDesc
from base_studio_test import StudioCourseTest
......@@ -82,7 +82,7 @@ class CoursePagesTest(StudioCourseTest):
# AssetIndexPage, # TODO: Skip testing this page due to FEDX-88
CourseUpdatesPage,
PagesPage, ExportCoursePage, ImportCoursePage, CourseTeamPage, CourseOutlinePage, SettingsPage,
AdvancedSettingsPage, GradingPage, TextbooksPage
AdvancedSettingsPage, GradingPage, TextbookUploadPage
]
]
......
......@@ -2,7 +2,8 @@
Acceptance tests for Studio related to the textbooks.
"""
from common.test.acceptance.tests.studio.base_studio_test import StudioCourseTest
from ...pages.studio.textbooks import TextbooksPage
from ...pages.studio.textbook_upload import TextbookUploadPage
from ...pages.lms.textbook_view import TextbookViewPage
from ...tests.helpers import disable_animations
from nose.plugins.attrib import attr
......@@ -17,15 +18,17 @@ class TextbooksTest(StudioCourseTest):
Install a course with no content using a fixture.
"""
super(TextbooksTest, self).setUp(is_staff)
self.textbook_page = TextbooksPage(
self.textbook_upload_page = TextbookUploadPage(
self.browser,
self.course_info['org'],
self.course_info['number'],
self.course_info['run']
)
self.textbook_page.visit()
self.textbook_upload_page.visit()
disable_animations(self)
self.textbook_view_page = TextbookViewPage(self.browser, self.course_id)
def test_create_first_book_message(self):
"""
Scenario: A message is displayed on the textbooks page when there are no uploaded textbooks
......@@ -33,7 +36,7 @@ class TextbooksTest(StudioCourseTest):
And I have not yet uploaded a textbook
Then I see a message stating that I have not uploaded any textbooks
"""
message = self.textbook_page.get_element_text('.wrapper-content .no-textbook-content')
message = self.textbook_upload_page.get_element_text('.wrapper-content .no-textbook-content')
self.assertIn("You haven't added any textbooks", message)
def test_new_textbook_upload(self):
......@@ -43,9 +46,44 @@ class TextbooksTest(StudioCourseTest):
And I have uploaded a PDF textbook and save the new textbook information
Then the "View Live" link contains a link to the textbook in the LMS
"""
self.textbook_page.open_add_textbook_form()
self.textbook_page.upload_pdf_file('textbook.pdf')
self.textbook_page.set_input_field_value('.edit-textbook #textbook-name-input', 'book_1')
self.textbook_page.set_input_field_value('.edit-textbook #chapter1-name', 'chap_1')
self.textbook_page.click_textbook_submit_button()
self.assertTrue(self.textbook_page.is_view_live_link_worked())
self.textbook_upload_page.upload_new_textbook()
self.assertTrue(self.textbook_upload_page.is_view_live_link_worked())
@attr('a11y')
def test_textbook_page_a11y(self):
"""
Uploads a new textbook
Runs an accessibility test on the textbook page in lms
"""
self.textbook_upload_page.upload_new_textbook()
self.textbook_view_page.visit()
self.textbook_view_page.a11y_audit.config.set_rules({
'ignore': [
'color-contrast', # AC-500
'skip-link', # AC-501
'link-href', # AC-502
'section' # AC-503
],
})
self.textbook_view_page.a11y_audit.check_for_accessibility_errors()
@attr('a11y')
def test_pdf_viewer_a11y(self):
"""
Uploads a new textbook
Runs an accessibility test on the pdf viewer frame in lms
"""
self.textbook_upload_page.upload_new_textbook()
self.textbook_view_page.visit()
self.textbook_view_page.switch_to_pdf_frame(self)
self.textbook_view_page.a11y_audit.config.set_rules({
'ignore': [
'html-lang', # AC-504
'meta-viewport', # AC-505
'skip-link', # AC-506
'link-href', # AC-507
],
})
self.textbook_view_page.a11y_audit.check_for_accessibility_errors()
......@@ -49,19 +49,19 @@ http://sourceforge.net/adobe/cmap/wiki/License/
<%static:js group='courseware'/>
</head>
<body tabindex="1">
<body>
<div id="outerContainer" class="loadingInProgress">
<div id="sidebarContainer">
<div id="toolbarSidebar">
<div class="splitToolbarButton toggled">
<button id="viewThumbnail" class="toolbarButton group toggled" title="Show Thumbnails" tabindex="2" data-l10n-id="thumbs">
<button id="viewThumbnail" class="toolbarButton group toggled" title="Show Thumbnails" data-l10n-id="thumbs">
<span data-l10n-id="thumbs_label">Thumbnails</span>
</button>
<button id="viewOutline" class="toolbarButton group" title="Show Document Outline" tabindex="3" data-l10n-id="outline">
<button id="viewOutline" class="toolbarButton group" title="Show Document Outline" data-l10n-id="outline">
<span data-l10n-id="outline_label">Document Outline</span>
</button>
<button id="viewAttachments" class="toolbarButton group" title="Show Attachments" tabindex="4" data-l10n-id="attachments">
<button id="viewAttachments" class="toolbarButton group" title="Show Attachments" data-l10n-id="attachments">
<span data-l10n-id="attachments_label">Attachments</span>
</button>
</div>
......@@ -79,72 +79,72 @@ http://sourceforge.net/adobe/cmap/wiki/License/
<div id="mainContainer">
<div class="findbar hidden doorHanger hiddenSmallView" id="findbar">
<label for="findInput" class="toolbarLabel" data-l10n-id="find_label">Find:</label>
<input id="findInput" class="toolbarField" tabindex="91">
<input id="findInput" class="toolbarField">
<div class="splitToolbarButton">
<button class="toolbarButton findPrevious" title="" id="findPrevious" tabindex="92" data-l10n-id="find_previous">
<button class="toolbarButton findPrevious" title="" id="findPrevious" data-l10n-id="find_previous">
<span data-l10n-id="find_previous_label">Previous</span>
</button>
<div class="splitToolbarButtonSeparator"></div>
<button class="toolbarButton findNext" title="" id="findNext" tabindex="93" data-l10n-id="find_next">
<button class="toolbarButton findNext" title="" id="findNext" data-l10n-id="find_next">
<span data-l10n-id="find_next_label">Next</span>
</button>
</div>
<input type="checkbox" id="findHighlightAll" class="toolbarField">
<label for="findHighlightAll" class="toolbarLabel" tabindex="94" data-l10n-id="find_highlight">Highlight all</label>
<label for="findHighlightAll" class="toolbarLabel" data-l10n-id="find_highlight">Highlight all</label>
<input type="checkbox" id="findMatchCase" class="toolbarField">
<label for="findMatchCase" class="toolbarLabel" tabindex="95" data-l10n-id="find_match_case_label">Match case</label>
<label for="findMatchCase" class="toolbarLabel" data-l10n-id="find_match_case_label">Match case</label>
<span id="findMsg" class="toolbarLabel"></span>
</div> <!-- findbar -->
<div id="secondaryToolbar" class="secondaryToolbar hidden doorHangerRight">
<div id="secondaryToolbarButtonContainer">
<button id="secondaryPresentationMode" class="secondaryToolbarButton presentationMode visibleLargeView" title="Switch to Presentation Mode" tabindex="51" data-l10n-id="presentation_mode">
<button id="secondaryPresentationMode" class="secondaryToolbarButton presentationMode visibleLargeView" title="Switch to Presentation Mode" data-l10n-id="presentation_mode">
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
</button>
<button id="secondaryOpenFile" class="secondaryToolbarButton openFile visibleLargeView" title="Open File" tabindex="52" data-l10n-id="open_file">
<button id="secondaryOpenFile" class="secondaryToolbarButton openFile visibleLargeView" title="Open File" data-l10n-id="open_file">
<span data-l10n-id="open_file_label">Open</span>
</button>
<button id="secondaryPrint" class="secondaryToolbarButton print visibleMediumView" title="Print" tabindex="53" data-l10n-id="print">
<button id="secondaryPrint" class="secondaryToolbarButton print visibleMediumView" title="Print" data-l10n-id="print">
<span data-l10n-id="print_label">Print</span>
</button>
<button id="secondaryDownload" class="secondaryToolbarButton download visibleMediumView" title="Download" tabindex="54" data-l10n-id="download">
<button id="secondaryDownload" class="secondaryToolbarButton download visibleMediumView" title="Download" data-l10n-id="download">
<span data-l10n-id="download_label">Download</span>
</button>
<a href="#" id="secondaryViewBookmark" class="secondaryToolbarButton bookmark visibleSmallView" title="Current view (copy or open in new window)" tabindex="55" data-l10n-id="bookmark">
<a href="#" id="secondaryViewBookmark" class="secondaryToolbarButton bookmark visibleSmallView" title="Current view (copy or open in new window)" data-l10n-id="bookmark">
<span data-l10n-id="bookmark_label">Current View</span>
</a>
<div class="horizontalToolbarSeparator visibleLargeView"></div>
<button id="firstPage" class="secondaryToolbarButton firstPage" title="Go to First Page" tabindex="56" data-l10n-id="first_page">
<button id="firstPage" class="secondaryToolbarButton firstPage" title="Go to First Page" data-l10n-id="first_page">
<span data-l10n-id="first_page_label">Go to First Page</span>
</button>
<button id="lastPage" class="secondaryToolbarButton lastPage" title="Go to Last Page" tabindex="57" data-l10n-id="last_page">
<button id="lastPage" class="secondaryToolbarButton lastPage" title="Go to Last Page" data-l10n-id="last_page">
<span data-l10n-id="last_page_label">Go to Last Page</span>
</button>
<div class="horizontalToolbarSeparator"></div>
<button id="pageRotateCw" class="secondaryToolbarButton rotateCw" title="Rotate Clockwise" tabindex="58" data-l10n-id="page_rotate_cw">
<button id="pageRotateCw" class="secondaryToolbarButton rotateCw" title="Rotate Clockwise" data-l10n-id="page_rotate_cw">
<span data-l10n-id="page_rotate_cw_label">Rotate Clockwise</span>
</button>
<button id="pageRotateCcw" class="secondaryToolbarButton rotateCcw" title="Rotate Counterclockwise" tabindex="59" data-l10n-id="page_rotate_ccw">
<button id="pageRotateCcw" class="secondaryToolbarButton rotateCcw" title="Rotate Counterclockwise" data-l10n-id="page_rotate_ccw">
<span data-l10n-id="page_rotate_ccw_label">Rotate Counterclockwise</span>
</button>
<div class="horizontalToolbarSeparator"></div>
<button id="toggleHandTool" class="secondaryToolbarButton handTool" title="Enable hand tool" tabindex="60" data-l10n-id="hand_tool_enable">
<button id="toggleHandTool" class="secondaryToolbarButton handTool" title="Enable hand tool" data-l10n-id="hand_tool_enable">
<span data-l10n-id="hand_tool_enable_label">Enable hand tool</span>
</button>
<div class="horizontalToolbarSeparator"></div>
<button id="documentProperties" class="secondaryToolbarButton documentProperties" title="Document Properties…" tabindex="61" data-l10n-id="document_properties">
<button id="documentProperties" class="secondaryToolbarButton documentProperties" title="Document Properties…" data-l10n-id="document_properties">
<span data-l10n-id="document_properties_label">Document Properties…</span>
</button>
</div>
......@@ -154,66 +154,66 @@ http://sourceforge.net/adobe/cmap/wiki/License/
<div id="toolbarContainer">
<div id="toolbarViewer">
<div id="toolbarViewerLeft">
<button id="sidebarToggle" class="toolbarButton" title="Toggle Sidebar" tabindex="11" data-l10n-id="toggle_sidebar">
<button id="sidebarToggle" class="toolbarButton" title="Toggle Sidebar" data-l10n-id="toggle_sidebar">
<span data-l10n-id="toggle_sidebar_label">Toggle Sidebar</span>
</button>
<div class="toolbarButtonSpacer"></div>
<button id="viewFind" class="toolbarButton group hiddenSmallView" title="Find in Document" tabindex="12" data-l10n-id="findbar">
<button id="viewFind" class="toolbarButton group hiddenSmallView" title="Find in Document" data-l10n-id="findbar">
<span data-l10n-id="findbar_label">Find</span>
</button>
<div class="splitToolbarButton">
<button class="toolbarButton pageUp" title="Previous Page" id="previous" tabindex="13" data-l10n-id="previous">
<button class="toolbarButton pageUp" title="Previous Page" id="previous" data-l10n-id="previous">
<span data-l10n-id="previous_label">Previous</span>
</button>
<div class="splitToolbarButtonSeparator"></div>
<button class="toolbarButton pageDown" title="Next Page" id="next" tabindex="14" data-l10n-id="next">
<button class="toolbarButton pageDown" title="Next Page" id="next" data-l10n-id="next">
<span data-l10n-id="next_label">Next</span>
</button>
</div>
<label id="pageNumberLabel" class="toolbarLabel" for="pageNumber" data-l10n-id="page_label">Page: </label>
<input type="number" id="pageNumber" class="toolbarField pageNumber" value="1" size="4" min="1" tabindex="15">
<input type="number" id="pageNumber" class="toolbarField pageNumber" value="1" size="4" min="1">
<span id="numPages" class="toolbarLabel"></span>
</div>
<div id="toolbarViewerRight">
<button id="presentationMode" class="toolbarButton presentationMode hiddenLargeView" title="Switch to Presentation Mode" tabindex="31" data-l10n-id="presentation_mode">
<button id="presentationMode" class="toolbarButton presentationMode hiddenLargeView" title="Switch to Presentation Mode" data-l10n-id="presentation_mode">
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
</button>
<button id="openFile" class="toolbarButton openFile hiddenLargeView" title="Open File" tabindex="32" data-l10n-id="open_file">
<button id="openFile" class="toolbarButton openFile hiddenLargeView" title="Open File" data-l10n-id="open_file">
<span data-l10n-id="open_file_label">Open</span>
</button>
<button id="print" class="toolbarButton print hiddenMediumView" title="Print" tabindex="33" data-l10n-id="print">
<button id="print" class="toolbarButton print hiddenMediumView" title="Print" data-l10n-id="print">
<span data-l10n-id="print_label">Print</span>
</button>
<button id="download" class="toolbarButton download hiddenMediumView" title="Download" tabindex="34" data-l10n-id="download">
<button id="download" class="toolbarButton download hiddenMediumView" title="Download" data-l10n-id="download">
<span data-l10n-id="download_label">Download</span>
</button>
<!-- <div class="toolbarButtonSpacer"></div> -->
<a href="#" id="viewBookmark" class="toolbarButton bookmark hiddenSmallView" title="Current view (copy or open in new window)" tabindex="35" data-l10n-id="bookmark">
<a href="#" id="viewBookmark" class="toolbarButton bookmark hiddenSmallView" title="Current view (copy or open in new window)" data-l10n-id="bookmark">
<span data-l10n-id="bookmark_label">Current View</span>
</a>
<div class="verticalToolbarSeparator hiddenSmallView"></div>
<button id="secondaryToolbarToggle" class="toolbarButton" title="Tools" tabindex="36" data-l10n-id="tools">
<button id="secondaryToolbarToggle" class="toolbarButton" title="Tools" data-l10n-id="tools">
<span data-l10n-id="tools_label">Tools</span>
</button>
</div>
<div class="outerCenter">
<div class="innerCenter" id="toolbarViewerMiddle">
<div class="splitToolbarButton">
<button id="zoomOut" class="toolbarButton zoomOut" title="Zoom Out" tabindex="21" data-l10n-id="zoom_out">
<button id="zoomOut" class="toolbarButton zoomOut" title="Zoom Out" data-l10n-id="zoom_out">
<span data-l10n-id="zoom_out_label">Zoom Out</span>
</button>
<div class="splitToolbarButtonSeparator"></div>
<button id="zoomIn" class="toolbarButton zoomIn" title="Zoom In" tabindex="22" data-l10n-id="zoom_in">
<button id="zoomIn" class="toolbarButton zoomIn" title="Zoom In" data-l10n-id="zoom_in">
<span data-l10n-id="zoom_in_label">Zoom In</span>
</button>
</div>
<span id="scaleSelectContainer" class="dropdownToolbarButton">
<select id="scaleSelect" title="Zoom" tabindex="23" data-l10n-id="zoom">
<select id="scaleSelect" title="Zoom" data-l10n-id="zoom">
<option id="pageAutoOption" title="" value="auto" selected="selected" data-l10n-id="page_scale_auto">Automatic Zoom</option>
<option id="pageActualOption" title="" value="page-actual" data-l10n-id="page_scale_actual">Actual Size</option>
<option id="pageFitOption" title="" value="page-fit" data-l10n-id="page_scale_fit">Fit Page</option>
......@@ -252,7 +252,7 @@ http://sourceforge.net/adobe/cmap/wiki/License/
data-l10n-id="page_rotate_ccw"></menuitem>
</menu>
<div id="viewerContainer" tabindex="0">
<div id="viewerContainer">
<div id="viewer" class="pdfViewer"></div>
</div>
......
......@@ -43,11 +43,11 @@
%endif
<p>${_("Your username, email, and full name will be sent to {destination}, where the collection and use of this information will be governed by their terms of service and privacy policy.").format(destination=return_to)}</p>
<label>${_("E-mail")}</label>
<input type="text" name="email" placeholder="${_('E-mail')}" tabindex="1" autofocus="autofocus" />
<input type="text" name="email" placeholder="${_('E-mail')}" autofocus="autofocus" />
<label>${_("Password")}</label>
<input type="password" name="password" placeholder="${_('Password')}" tabindex="2" />
<input type="password" name="password" placeholder="${_('Password')}" />
<div class="submit">
<input name="submit" type="submit" value="${_('Return To %s') % return_to}" tabindex="3" />
<input name="submit" type="submit" value="${_('Return To %s') % return_to}" />
</div>
</form>
</div>
......
......@@ -29,7 +29,7 @@ $(function(){
<div class="book-wrapper">
%if 'chapters' in textbook:
<section class="book-sidebar" aria-label="${_('Textbook Navigation')}">
<ul id="booknav" tabindex="0">
<ul id="booknav">
% for (index, entry) in enumerate(textbook['chapters']):
<li>
<a class="chapter" rel="${entry['url']}" href="#">${entry.get('title')}</a>
......@@ -47,8 +47,6 @@ $(function(){
width="856"
height="1108"
frameborder="0"
seamless
tabindex="1"
aria-live="polite"></iframe>
seamless></iframe>
</div>
</div>
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