AC-523 - duplicate-id - instructor_dashboard.py
This commit is contained in:
@@ -166,7 +166,7 @@ class DashboardPage(PageObject):
|
||||
"""
|
||||
Get course date of the first course from dashboard
|
||||
"""
|
||||
return self.q(css='ul.listing-courses .course-item .info-date-block').first.text[0]
|
||||
return self.q(css='ul.listing-courses .course-item:first-of-type .info-date-block').first.text[0]
|
||||
|
||||
def click_username_dropdown(self):
|
||||
"""
|
||||
|
||||
@@ -748,8 +748,8 @@ class MembershipPageAutoEnrollSection(PageObject):
|
||||
"""
|
||||
url = None
|
||||
|
||||
auto_enroll_browse_button_selector = '.auto_enroll_csv .file-browse input.file_field#browseBtn'
|
||||
auto_enroll_upload_button_selector = '.auto_enroll_csv button[name="enrollment_signup_button"]'
|
||||
auto_enroll_browse_button_selector = '.auto_enroll_csv .file-browse input.file_field#browseBtn-auto_enroll_csv'
|
||||
auto_enroll_upload_button_selector = '.auto_enroll_csv #submitBtn-auto_enroll_csv'
|
||||
batch_enrollment_selector = '.batch-enrollment'
|
||||
NOTIFICATION_ERROR = 'error'
|
||||
NOTIFICATION_WARNING = 'warning'
|
||||
|
||||
@@ -5,7 +5,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 ..helpers import UniqueCourseTest, generate_course_key
|
||||
from ...fixtures.course import CourseFixture
|
||||
from ...pages.lms.auto_auth import AutoAuthPage
|
||||
from ...pages.lms.dashboard import DashboardPage
|
||||
@@ -40,9 +40,10 @@ class BaseLmsDashboardTest(UniqueCourseTest):
|
||||
})
|
||||
self.course_fixture.install()
|
||||
|
||||
# Create the test user, register them for the course, and authenticate
|
||||
self.username = "test_{uuid}".format(uuid=self.unique_id[0:6])
|
||||
self.email = "{user}@example.com".format(user=self.username)
|
||||
|
||||
# Create the test user, register them for the course, and authenticate
|
||||
AutoAuthPage(
|
||||
self.browser,
|
||||
username=self.username,
|
||||
@@ -54,6 +55,83 @@ class BaseLmsDashboardTest(UniqueCourseTest):
|
||||
self.dashboard_page.visit()
|
||||
|
||||
|
||||
class BaseLmsDashboardTestMultiple(UniqueCourseTest):
|
||||
""" Base test suite for the LMS Student Dashboard with Multiple Courses"""
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
Initializes the components (page objects, courses, users) for this test suite
|
||||
"""
|
||||
# Some parameters are provided by the parent setUp() routine, such as the following:
|
||||
# self.course_id, self.course_info, self.unique_id
|
||||
super(BaseLmsDashboardTestMultiple, self).setUp()
|
||||
|
||||
# Load page objects for use by the tests
|
||||
self.dashboard_page = DashboardPage(self.browser)
|
||||
|
||||
# Configure some aspects of the test course and install the settings into the course
|
||||
self.courses = {
|
||||
'A': {
|
||||
'org': 'test_org',
|
||||
'number': self.unique_id,
|
||||
'run': 'test_run_A',
|
||||
'display_name': 'Test Course A'
|
||||
},
|
||||
'B': {
|
||||
'org': 'test_org',
|
||||
'number': self.unique_id,
|
||||
'run': 'test_run_B',
|
||||
'display_name': 'Test Course B'
|
||||
},
|
||||
'C': {
|
||||
'org': 'test_org',
|
||||
'number': self.unique_id,
|
||||
'run': 'test_run_C',
|
||||
'display_name': 'Test Course C'
|
||||
}
|
||||
}
|
||||
|
||||
self.username = "test_{uuid}".format(uuid=self.unique_id[0:6])
|
||||
self.email = "{user}@example.com".format(user=self.username)
|
||||
|
||||
self.course_keys = {}
|
||||
self.course_fixtures = {}
|
||||
|
||||
for key, value in self.courses.iteritems():
|
||||
course_key = generate_course_key(
|
||||
value['org'],
|
||||
value['number'],
|
||||
value['run'],
|
||||
)
|
||||
|
||||
course_fixture = CourseFixture(
|
||||
value['org'],
|
||||
value['number'],
|
||||
value['run'],
|
||||
value['display_name'],
|
||||
)
|
||||
|
||||
course_fixture.add_advanced_settings({
|
||||
u"social_sharing_url": {u"value": "http://custom/course/url"}
|
||||
})
|
||||
|
||||
course_fixture.install()
|
||||
|
||||
self.course_keys[key] = course_key
|
||||
self.course_fixtures[key] = course_fixture
|
||||
|
||||
# Create the test user, register them for the course, and authenticate
|
||||
AutoAuthPage(
|
||||
self.browser,
|
||||
username=self.username,
|
||||
email=self.email,
|
||||
course_id=course_key
|
||||
).visit()
|
||||
|
||||
# Navigate the authenticated, enrolled user to the dashboard page and get testing!
|
||||
self.dashboard_page.visit()
|
||||
|
||||
|
||||
class LmsDashboardPageTest(BaseLmsDashboardTest):
|
||||
""" Test suite for the LMS Student Dashboard page """
|
||||
|
||||
@@ -109,8 +187,10 @@ class LmsDashboardPageTest(BaseLmsDashboardTest):
|
||||
course_start_date = datetime.datetime(1970, 1, 1)
|
||||
course_end_date = self.now - datetime.timedelta(days=90)
|
||||
|
||||
self.course_fixture.add_course_details({'start_date': course_start_date,
|
||||
'end_date': course_end_date})
|
||||
self.course_fixture.add_course_details({
|
||||
'start_date': course_start_date,
|
||||
'end_date': course_end_date
|
||||
})
|
||||
self.course_fixture.configure_course()
|
||||
|
||||
end_date = course_end_date.strftime(DEFAULT_SHORT_DATE_FORMAT)
|
||||
@@ -140,8 +220,10 @@ class LmsDashboardPageTest(BaseLmsDashboardTest):
|
||||
course_start_date = datetime.datetime(1970, 1, 1)
|
||||
course_end_date = self.now + datetime.timedelta(days=90)
|
||||
|
||||
self.course_fixture.add_course_details({'start_date': course_start_date,
|
||||
'end_date': course_end_date})
|
||||
self.course_fixture.add_course_details({
|
||||
'start_date': course_start_date,
|
||||
'end_date': course_end_date
|
||||
})
|
||||
self.course_fixture.configure_course()
|
||||
|
||||
start_date = course_start_date.strftime(DEFAULT_SHORT_DATE_FORMAT)
|
||||
@@ -171,8 +253,10 @@ class LmsDashboardPageTest(BaseLmsDashboardTest):
|
||||
course_start_date = self.now + datetime.timedelta(days=30)
|
||||
course_end_date = self.now + datetime.timedelta(days=365)
|
||||
|
||||
self.course_fixture.add_course_details({'start_date': course_start_date,
|
||||
'end_date': course_end_date})
|
||||
self.course_fixture.add_course_details({
|
||||
'start_date': course_start_date,
|
||||
'end_date': course_end_date
|
||||
})
|
||||
self.course_fixture.configure_course()
|
||||
|
||||
start_date = course_start_date.strftime(DEFAULT_SHORT_DATE_FORMAT)
|
||||
@@ -203,8 +287,10 @@ class LmsDashboardPageTest(BaseLmsDashboardTest):
|
||||
course_start_date = self.now + datetime.timedelta(days=2)
|
||||
course_end_date = self.now + datetime.timedelta(days=365)
|
||||
|
||||
self.course_fixture.add_course_details({'start_date': course_start_date,
|
||||
'end_date': course_end_date})
|
||||
self.course_fixture.add_course_details({
|
||||
'start_date': course_start_date,
|
||||
'end_date': course_end_date
|
||||
})
|
||||
self.course_fixture.configure_course()
|
||||
|
||||
start_date = course_start_date.strftime(DEFAULT_DAY_AND_TIME_FORMAT)
|
||||
@@ -221,7 +307,7 @@ class LmsDashboardPageTest(BaseLmsDashboardTest):
|
||||
|
||||
|
||||
@attr('a11y')
|
||||
class LmsDashboardA11yTest(BaseLmsDashboardTest):
|
||||
class LmsDashboardA11yTest(BaseLmsDashboardTestMultiple):
|
||||
"""
|
||||
Class to test lms student dashboard accessibility.
|
||||
"""
|
||||
@@ -230,6 +316,12 @@ class LmsDashboardA11yTest(BaseLmsDashboardTest):
|
||||
"""
|
||||
Test the accessibility of the course listings
|
||||
"""
|
||||
course_listings = self.dashboard_page.get_course_listings()
|
||||
self.assertEqual(len(course_listings), 1)
|
||||
course_listings = self.dashboard_page.get_courses()
|
||||
self.assertEqual(len(course_listings), 3)
|
||||
self.dashboard_page.a11y_audit.config.set_rules({
|
||||
'ignore': [
|
||||
'link-href', # AC-530
|
||||
'aria-required-children', # AC-534
|
||||
]
|
||||
})
|
||||
self.dashboard_page.a11y_audit.check_for_accessibility_errors()
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
<input disabled="disabled" id="browseFile" placeholder="choose file"/>
|
||||
|
||||
<div class="file-browse btn btn-primary">
|
||||
<span class="browse"> Browse </span>
|
||||
<input class="file_field" id="browseBtn" name="students_list" type="file" accept=".csv"/>
|
||||
<label for="browseBtn-auto_enroll_csv" class="browse">Browse</label>
|
||||
<input class="file_field" id="browseBtn-auto_enroll_csv" name="students_list" type="file" accept=".csv"/>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" name="enrollment_signup_button">${_("Upload CSV")}</button>
|
||||
<button type="submit" id="submitBtn-auto_enroll_csv" name="enrollment_signup_button">Upload CSV</button>
|
||||
</form>
|
||||
<div class="results"></div>
|
||||
</div>
|
||||
|
||||
@@ -117,7 +117,7 @@ class AuthListWidget extends MemberListWidget
|
||||
|
||||
# create revoke button and insert it into the row
|
||||
label_trans = gettext("Revoke access")
|
||||
$revoke_btn = $ _.template('<div class="revoke"><span class="icon fa fa-times-circle" aria-hidden="true"></span> <%= label %></div>')({label: label_trans}),
|
||||
$revoke_btn = $ _.template('<div class="revoke"><span class="icon fa fa-times-circle" aria-hidden="true"></span> <%- label %></div>')({label: label_trans}),
|
||||
class: 'revoke'
|
||||
$revoke_btn.click =>
|
||||
@modify_member_access member.email, 'revoke', (error) =>
|
||||
@@ -166,10 +166,10 @@ class AuthListWidget extends MemberListWidget
|
||||
@clear_errors()
|
||||
@clear_input()
|
||||
if data.userDoesNotExist
|
||||
msg = gettext("Could not find a user with username or email address '<%= identifier %>'.")
|
||||
msg = gettext("Could not find a user with username or email address '<%- identifier %>'.")
|
||||
@show_errors _.template(msg, {identifier: data.unique_student_identifier})
|
||||
else if data.inactiveUser
|
||||
msg = gettext("Error: User '<%= username %>' has not yet activated their account. Users must create and activate their accounts before they can be assigned a role.")
|
||||
msg = gettext("Error: User '<%- username %>' has not yet activated their account. Users must create and activate their accounts before they can be assigned a role.")
|
||||
@show_errors _.template(msg, {username: data.unique_student_identifier})
|
||||
else if data.removingSelfAsInstructor
|
||||
@show_errors gettext "Error: You cannot remove yourself from the Instructor group!"
|
||||
@@ -181,12 +181,12 @@ class @AutoEnrollmentViaCsv
|
||||
# Wrapper for the AutoEnrollmentViaCsv subsection.
|
||||
# This object handles buttons, success and failure reporting,
|
||||
# and server communication.
|
||||
@$student_enrollment_form = @$container.find("form#student-auto-enroll-form")
|
||||
@$enrollment_signup_button = @$container.find("[name='enrollment_signup_button']")
|
||||
@$student_enrollment_form = @$container.find("#student-auto-enroll-form")
|
||||
@$enrollment_signup_button = @$container.find("#submitBtn-auto_enroll_csv")
|
||||
@$students_list_file = @$container.find("input[name='students_list']")
|
||||
@$csrf_token = @$container.find("input[name='csrfmiddlewaretoken']")
|
||||
@$results = @$container.find("div.results")
|
||||
@$browse_button = @$container.find("#browseBtn")
|
||||
@$browse_button = @$container.find("#browseBtn-auto_enroll_csv")
|
||||
@$browse_file = @$container.find("#browseFile")
|
||||
|
||||
@processing = false
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
<div class="customBrowseBtn">
|
||||
<input disabled="disabled" class="browse-file" placeholder="<%- gettext("Choose File") %>" />
|
||||
<div class="file-browse btn btn-primary">
|
||||
<span class="browse"> <%- gettext("Browse") %> </span>
|
||||
<input class="file_field" id="browseBtn" name="students_list" type="file" accept=".csv"/>
|
||||
<label for="browseBtn-bulk-exc-students" class="browse"><%- gettext("Browse") %></label>
|
||||
<input class="file_field" id="browseBtn-bulk-exc-students" name="students_list" type="file" accept=".csv"/>
|
||||
</div>
|
||||
</div>
|
||||
<div><button class="btn-blue upload-csv-button" type="submit"><%- gettext('Add to Exception List') %></button></div>
|
||||
|
||||
@@ -96,11 +96,11 @@ from openedx.core.djangoapps.course_groups.partition_scheme import get_cohorted_
|
||||
<input disabled="disabled" id="browseFile" placeholder="choose file" />
|
||||
<div class="file-browse btn btn-primary">
|
||||
<span class="browse"> Browse </span>
|
||||
<label for="browseBtn" class="sr">${_("Upload a CSV for bulk enrollment")}</label>
|
||||
<input class="file_field" id="browseBtn" name="students_list" type="file" accept=".csv"/>
|
||||
<label for="browseBtn-auto_enroll_csv" class="sr">${_("Upload a CSV for bulk enrollment")}</label>
|
||||
<input class="file_field" id="browseBtn-auto_enroll_csv" name="students_list" type="file" accept=".csv"/>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" name="enrollment_signup_button">${_("Upload CSV")}</button>
|
||||
<button type="submit" id="submitBtn-auto_enroll_csv" name="enrollment_signup_button">${_("Upload CSV")}</button>
|
||||
<input type="hidden" name="csrfmiddlewaretoken" value="${ csrf_token }">
|
||||
</form>
|
||||
<div class="results"></div>
|
||||
|
||||
Reference in New Issue
Block a user