From 5a86f2b276e07df2d74e2d571e93ab2d4599a3d0 Mon Sep 17 00:00:00 2001 From: Agha Awais Date: Thu, 4 Oct 2018 11:56:54 +0000 Subject: [PATCH] Bokchoy tests for Instructor dashboard data download tab --- .../pages/lms/instructor_dashboard.py | 36 +++++ .../lms/test_lms_instructor_dashboard.py | 139 +++++++++++++++++- .../instructor/features/data_download.feature | 37 ----- lms/envs/bok_choy.py | 3 + 4 files changed, 170 insertions(+), 45 deletions(-) delete mode 100644 lms/djangoapps/instructor/features/data_download.feature diff --git a/common/test/acceptance/pages/lms/instructor_dashboard.py b/common/test/acceptance/pages/lms/instructor_dashboard.py index 295e097f05..3ad1cebfdd 100644 --- a/common/test/acceptance/pages/lms/instructor_dashboard.py +++ b/common/test/acceptance/pages/lms/instructor_dashboard.py @@ -1089,6 +1089,27 @@ class DataDownloadPage(PageObject): """ return self.q(css='input[name=list-profiles-csv]') + @property + def enrolled_student_profile_button(self): + """ + Returns the "List enrolled students' profile information" button. + """ + return self.q(css='input[name=list-profiles]') + + @property + def enrolled_student_profile_button_present(self): + """ + Checks for the presence of Enrolled Student Profile Button + """ + return self.q(css='input[name=list-profiles]').present + + @property + def generate_grading_configuration_button(self): + """ + Returns the "Grading Configuration" button. + """ + return self.q(css='input[name="dump-gradeconf"]') + @property def generate_grade_report_button(self): """ @@ -1131,6 +1152,21 @@ class DataDownloadPage(PageObject): """ return self.report_download_links.map(lambda el: el.text) + @property + def student_profile_information(self): + """ + Returns Student profile information + """ + return self.q(css='#data-student-profiles-table').text + + @property + def grading_config_text(self): + """ + Returns grading configuration text + """ + self.wait_for_element_visibility('#data-grade-config-text', 'Grading Configurations are visible') + return self.q(css='#data-grade-config-text').text[0] + class StudentAdminPage(PageObject): """ diff --git a/common/test/acceptance/tests/lms/test_lms_instructor_dashboard.py b/common/test/acceptance/tests/lms/test_lms_instructor_dashboard.py index 6054db3aa2..32913928c6 100644 --- a/common/test/acceptance/tests/lms/test_lms_instructor_dashboard.py +++ b/common/test/acceptance/tests/lms/test_lms_instructor_dashboard.py @@ -54,7 +54,7 @@ class BaseInstructorDashboardTest(EventsTestMixin, UniqueCourseTest): ) auto_auth_page.visit() user_info = auto_auth_page.user_info - return user_info['username'], user_info['user_id'] + return user_info['username'], user_info['user_id'], user_info['email'], user_info['password'] def visit_instructor_dashboard(self): """ @@ -404,7 +404,7 @@ class ProctoredExamsTest(BaseInstructorDashboardTest): self._create_a_timed_exam_and_attempt() # When I log in as an instructor, - __, __ = self.log_in_as_instructor() + __, __, __, __ = self.log_in_as_instructor() # And visit the Student Proctored Exam Attempts Section of Instructor Dashboard's Special Exams tab instructor_dashboard_page = self.visit_instructor_dashboard() @@ -577,7 +577,7 @@ class DataDownloadsTest(BaseInstructorDashboardTest): def setUp(self): super(DataDownloadsTest, self).setUp() self.course_fixture = CourseFixture(**self.course_info).install() - self.instructor_username, self.instructor_id = self.log_in_as_instructor() + self.instructor_username, self.instructor_id, __, __ = self.log_in_as_instructor() instructor_dashboard_page = self.visit_instructor_dashboard() self.data_download_section = instructor_dashboard_page.select_data_download() @@ -687,6 +687,129 @@ class DataDownloadsTest(BaseInstructorDashboardTest): self.data_download_section.a11y_audit.check_for_accessibility_errors() +@ddt.ddt +class DataDownloadsWithMultipleRoleTests(BaseInstructorDashboardTest): + """ + Bok Choy tests for the "Data Downloads" tab with multiple user roles. + """ + def setUp(self): + super(DataDownloadsWithMultipleRoleTests, self).setUp() + self.course_fixture = CourseFixture(**self.course_info).install() + + @ddt.data(['staff'], ['instructor']) + def test_list_student_profile_information(self, role): + """ + Scenario: List enrolled students' profile information + Given I am "" for a course + When I click "List enrolled students' profile information" + Then I see a table of student profiles + Examples: + | Role | + | instructor | + | staff | + """ + username, user_id, email, __ = self.log_in_as_instructor( + global_staff=False, + course_access_roles=role + ) + instructor_dashboard_page = self.visit_instructor_dashboard() + data_download_section = instructor_dashboard_page.select_data_download() + + data_download_section.enrolled_student_profile_button.click() + student_profile_info = data_download_section.student_profile_information + + self.assertNotIn(student_profile_info, [u'', u'Loading']) + expected_data = [user_id, username, email] + for datum in expected_data: + self.assertIn(str(datum), student_profile_info[0].split('\n')) + + @ddt.data(['staff'], ['instructor']) + def test_list_student_profile_information_for_large_course(self, role): + """ + Scenario: List enrolled students' profile information for a large course + Given I am "" for a very large course + When I visit the "Data Download" tab + Then I do not see a button to 'List enrolled students' profile information' + Examples: + | Role | + | instructor | + | staff | + + """ + username, __, email, password = self.log_in_as_instructor( + global_staff=False, + course_access_roles=role + ) + instructor_dashboard_page = self.visit_instructor_dashboard() + data_download_section = instructor_dashboard_page.select_data_download() + + self.assertTrue(data_download_section.enrolled_student_profile_button_present) + LogoutPage(self.browser).visit() + for __ in range(5): + learner_username = "test_student_{uuid}".format(uuid=self.unique_id[0:8]) + learner_email = "{user}@example.com".format(user=learner_username) + + # Enroll test users in the course + AutoAuthPage( + self.browser, + username=learner_username, + email=learner_email, + course_id=self.course_id + ).visit() + + # Login again with staff or instructor + AutoAuthPage( + self.browser, + username=username, + email=email, + password=password, + course_id=self.course_id, + staff=False, + course_access_roles=role + ).visit() + + instructor_dashboard_page = self.visit_instructor_dashboard() + instructor_dashboard_page.select_data_download() + self.assertFalse(data_download_section.enrolled_student_profile_button_present) + + @ddt.data(['staff'], ['instructor']) + def test_view_grading_configuration(self, role): + """ + Scenario: View the grading configuration + Given I am "" for a course + When I click "Grading Configuration" + Then I see the grading configuration for the course + Examples: + | Role | + | instructor | + | staff | + """ + expected = u"""----------------------------------------------------------------------------- +Course grader: + + +Graded sections: + subgrader=, type=Homework, category=Homework, weight=0.15 + subgrader=, type=Lab, category=Lab, weight=0.15 + subgrader=, type=Midterm Exam, category=Midterm Exam, weight=0.3 + subgrader=, type=Final Exam, category=Final Exam, weight=0.4 +----------------------------------------------------------------------------- +Listing grading context for course {} +graded sections: +[] +all graded blocks: +length=0""".format(self.course_id) + self.log_in_as_instructor( + global_staff=False, + course_access_roles=role + ) + instructor_dashboard_page = self.visit_instructor_dashboard() + data_download_section = instructor_dashboard_page.select_data_download() + + data_download_section.generate_grading_configuration_button.click() + self.assertEqual(data_download_section.grading_config_text, expected) + + @attr(shard=10) @ddt.ddt class CertificatesTest(BaseInstructorDashboardTest): @@ -708,7 +831,7 @@ class CertificatesTest(BaseInstructorDashboardTest): CourseFixture(**self.course_info).install() self.cert_fixture = CertificateConfigFixture(self.course_id, self.test_certificate_config) self.cert_fixture.install() - self.user_name, self.user_id = self.log_in_as_instructor() + self.user_name, self.user_id, __, __ = self.log_in_as_instructor() self.instructor_dashboard_page = self.visit_instructor_dashboard() self.certificates_section = self.instructor_dashboard_page.select_certificates() disable_animations(self.certificates_section) @@ -934,7 +1057,7 @@ class CertificatesTest(BaseInstructorDashboardTest): # Create a new user who is not enrolled in the course AutoAuthPage(self.browser, username=new_user, email=new_email).visit() # Login as instructor and visit Certificate Section of Instructor Dashboard - self.user_name, self.user_id = self.log_in_as_instructor() + self.user_name, self.user_id, __, __ = self.log_in_as_instructor() self.instructor_dashboard_page.visit() self.certificates_section = self.instructor_dashboard_page.select_certificates() @@ -1061,7 +1184,7 @@ class CertificateInvalidationTest(BaseInstructorDashboardTest): self.cert_fixture = CertificateConfigFixture(self.course_id, self.test_certificate_config) self.cert_fixture.install() - self.user_name, self.user_id = self.log_in_as_instructor() + self.user_name, self.user_id, __, __ = self.log_in_as_instructor() self.instructor_dashboard_page = self.visit_instructor_dashboard() self.certificates_section = self.instructor_dashboard_page.select_certificates() @@ -1195,7 +1318,7 @@ class CertificateInvalidationTest(BaseInstructorDashboardTest): # Create a new user who is not enrolled in the course AutoAuthPage(self.browser, username=new_user, email=new_email).visit() # Login as instructor and visit Certificate Section of Instructor Dashboard - self.user_name, self.user_id = self.log_in_as_instructor() + self.user_name, self.user_id, __, __ = self.log_in_as_instructor() self.instructor_dashboard_page.visit() self.certificates_section = self.instructor_dashboard_page.select_certificates() @@ -1341,7 +1464,7 @@ class StudentAdminTest(BaseInstructorDashboardTest): ), ).install() - self.username, _ = self.log_in_as_instructor() + self.username, __, __, __ = self.log_in_as_instructor() self.instructor_dashboard_page = self.visit_instructor_dashboard() def test_rescore_rescorable(self): diff --git a/lms/djangoapps/instructor/features/data_download.feature b/lms/djangoapps/instructor/features/data_download.feature deleted file mode 100644 index 2cd75bc15d..0000000000 --- a/lms/djangoapps/instructor/features/data_download.feature +++ /dev/null @@ -1,37 +0,0 @@ -@shard_2 -Feature: LMS.Instructor Dash Data Download - As an instructor or course staff, - In order to manage my class - I want to view and download data information about my students. - - ### todos when more time can be spent on instructor dashboard - #Scenario: Download profile information as a CSV - #Scenario: Download student anonymized IDs as a CSV - ## Need to figure out how to assert csvs will download without actually downloading them - - Scenario: List enrolled students' profile information - Given I am "" for a course - When I click "List enrolled students' profile information" - Then I see a table of student profiles - Examples: - | Role | - | instructor | - | staff | - - Scenario: List enrolled students' profile information for a large course - Given I am "" for a very large course - When I visit the "Data Download" tab - Then I do not see a button to 'List enrolled students' profile information' - Examples: - | Role | - | instructor | - | staff | - - Scenario: View the grading configuration - Given I am "" for a course - When I click "Grading Configuration" - Then I see the grading configuration for the course - Examples: - | Role | - | instructor | - | staff | diff --git a/lms/envs/bok_choy.py b/lms/envs/bok_choy.py index e87c4ee056..4a23fe6237 100644 --- a/lms/envs/bok_choy.py +++ b/lms/envs/bok_choy.py @@ -159,6 +159,9 @@ FEATURES['RESTRICT_AUTOMATIC_AUTH'] = False # Open up endpoint for faking Software Secure responses FEATURES['ENABLE_SOFTWARE_SECURE_FAKE'] = True +# Disable instructor dash buttons for downloading course data when enrollment exceeds this number +FEATURES['MAX_ENROLLMENT_INSTR_BUTTONS'] = 4 + FEATURES['ENABLE_ENROLLMENT_TRACK_USER_PARTITION'] = True ########################### Entrance Exams #################################