Revert "Decorated instructor dashboard with sudo_required."
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
"""
|
||||
Django sudo page to get sudo access.
|
||||
"""
|
||||
|
||||
from bok_choy.javascript import wait_for_js
|
||||
from bok_choy.page_object import PageObject
|
||||
|
||||
|
||||
class SudoPage(PageObject):
|
||||
"""
|
||||
Sudo page to get sudo access
|
||||
"""
|
||||
SUDO_FORM = 'form.sudo-form'
|
||||
|
||||
def __init__(self, browser, redirect_page):
|
||||
super(SudoPage, self).__init__(browser)
|
||||
self.redirect_page = redirect_page
|
||||
|
||||
def is_browser_on_page(self):
|
||||
return self.q(css=self.SUDO_FORM).present
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
"""
|
||||
Construct a URL to the page which needs sudo access.
|
||||
"""
|
||||
return self.redirect_page.url
|
||||
|
||||
@property
|
||||
def sudo_password_input(self):
|
||||
"""
|
||||
Returns sudo password input box.
|
||||
"""
|
||||
return self.q(css='{} input[id=id_password]'.format(self.SUDO_FORM))
|
||||
|
||||
@property
|
||||
def submit_button(self):
|
||||
"""
|
||||
Returns submit button.
|
||||
"""
|
||||
return self.q(css='{} input[type=submit]'.format(self.SUDO_FORM))
|
||||
|
||||
@wait_for_js
|
||||
def submit_sudo_password_and_get_access(self, password):
|
||||
"""
|
||||
Fill password in input field and click submit.
|
||||
"""
|
||||
input_box = self.sudo_password_input.first.results[0]
|
||||
input_box.send_keys(password)
|
||||
self.click_submit()
|
||||
self.redirect_page.wait_for_page()
|
||||
|
||||
def click_submit(self):
|
||||
"""
|
||||
Click on submit button.
|
||||
"""
|
||||
return self.submit_button.click()
|
||||
@@ -759,14 +759,12 @@ class DataDownloadPage(PageObject):
|
||||
return self.report_download_links.map(lambda el: el.text)
|
||||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
class StudentAdminPage(PageObject):
|
||||
"""
|
||||
Student admin section of the Instructor dashboard.
|
||||
"""
|
||||
url = None
|
||||
ENTRANCE_EXAM_CONTAINER = ".entrance-exam-grade-container"
|
||||
SG_CONTAINER = ".student-grade-container"
|
||||
EE_CONTAINER = ".entrance-exam-grade-container"
|
||||
|
||||
def is_browser_on_page(self):
|
||||
"""
|
||||
@@ -775,161 +773,89 @@ class StudentAdminPage(PageObject):
|
||||
return self.q(css='a[data-section=student_admin].active-section').present
|
||||
|
||||
@property
|
||||
def entrance_exam_student_email_input(self):
|
||||
def student_email_input(self):
|
||||
"""
|
||||
Returns email address/username input box for entrance exam.
|
||||
Returns email address/username input box.
|
||||
"""
|
||||
return self.q(css='{} input[name=entrance-exam-student-select-grade]'.format(self.ENTRANCE_EXAM_CONTAINER))
|
||||
|
||||
@property
|
||||
def entrance_exam_reset_attempts_button(self):
|
||||
"""
|
||||
Returns reset student attempts button for entrance exam.
|
||||
"""
|
||||
return self.q(css='{} input[name=reset-entrance-exam-attempts]'.format(self.ENTRANCE_EXAM_CONTAINER))
|
||||
|
||||
@property
|
||||
def entrance_exam_rescore_submission_button(self):
|
||||
"""
|
||||
Returns rescore student submission button for entrance exam.
|
||||
"""
|
||||
return self.q(css='{} input[name=rescore-entrance-exam]'.format(self.ENTRANCE_EXAM_CONTAINER))
|
||||
|
||||
@property
|
||||
def skip_entrance_exam_button(self):
|
||||
"""
|
||||
Return Let Student Skip Entrance Exam button.
|
||||
"""
|
||||
return self.q(css='{} input[name=skip-entrance-exam]'.format(self.ENTRANCE_EXAM_CONTAINER))
|
||||
|
||||
@property
|
||||
def entrance_exam_delete_student_state_button(self):
|
||||
"""
|
||||
Returns delete student state button for entrance exam.
|
||||
"""
|
||||
return self.q(css='{} input[name=delete-entrance-exam-state]'.format(self.ENTRANCE_EXAM_CONTAINER))
|
||||
|
||||
@property
|
||||
def background_task_history_button(self):
|
||||
"""
|
||||
Returns show background task history for student button for entrance exam.
|
||||
"""
|
||||
return self.q(css='{} input[name=entrance-exam-task-history]'.format(self.ENTRANCE_EXAM_CONTAINER))
|
||||
|
||||
@property
|
||||
def entrance_exam_top_notification(self):
|
||||
"""
|
||||
Returns show background task history for student button for entrance exam.
|
||||
"""
|
||||
return self.q(css='{} .request-response-error'.format(self.ENTRANCE_EXAM_CONTAINER)).first
|
||||
return self.q(css='{} input[name=entrance-exam-student-select-grade]'.format(self.EE_CONTAINER))
|
||||
|
||||
@property
|
||||
def reset_attempts_button(self):
|
||||
"""
|
||||
Returns reset student attempts button.
|
||||
"""
|
||||
return self.q(css='{} input[name=reset-attempts-single]'.format(self.SG_CONTAINER))
|
||||
return self.q(css='{} input[name=reset-entrance-exam-attempts]'.format(self.EE_CONTAINER))
|
||||
|
||||
@property
|
||||
def rescore_submission_button(self):
|
||||
"""
|
||||
Returns rescore student submission button.
|
||||
"""
|
||||
return self.q(css='{} input[name=rescore-problem-single]'.format(self.SG_CONTAINER))
|
||||
return self.q(css='{} input[name=rescore-entrance-exam]'.format(self.EE_CONTAINER))
|
||||
|
||||
@property
|
||||
def skip_entrance_exam_button(self):
|
||||
"""
|
||||
Return Let Student Skip Entrance Exam button.
|
||||
"""
|
||||
return self.q(css='{} input[name=skip-entrance-exam]'.format(self.EE_CONTAINER))
|
||||
|
||||
@property
|
||||
def delete_student_state_button(self):
|
||||
"""
|
||||
Returns delete student state button.
|
||||
"""
|
||||
return self.q(css='{} input[name=delete-state-single]'.format(self.SG_CONTAINER))
|
||||
return self.q(css='{} input[name=delete-entrance-exam-state]'.format(self.EE_CONTAINER))
|
||||
|
||||
@property
|
||||
def background_task_history_button(self):
|
||||
"""
|
||||
Returns show background task history for student button.
|
||||
"""
|
||||
return self.q(css='{} input[name=entrance-exam-task-history]'.format(self.EE_CONTAINER))
|
||||
|
||||
@property
|
||||
def top_notification(self):
|
||||
"""
|
||||
Returns show background task history for student button.
|
||||
"""
|
||||
return self.q(css='{} .request-response-error'.format(self.SG_CONTAINER)).first
|
||||
return self.q(css='{} .request-response-error'.format(self.EE_CONTAINER)).first
|
||||
|
||||
def is_entrance_exam_student_email_input_visible(self):
|
||||
def is_student_email_input_visible(self):
|
||||
"""
|
||||
Returns True if student email address/username input box is present
|
||||
for entrance exam.
|
||||
Returns True if student email address/username input box is present.
|
||||
"""
|
||||
return self.entrance_exam_student_email_input.is_present()
|
||||
return self.student_email_input.is_present()
|
||||
|
||||
def is_entrance_exam_reset_attempts_button_visible(self):
|
||||
def is_reset_attempts_button_visible(self):
|
||||
"""
|
||||
Returns True if reset student attempts button is present
|
||||
for entrance exam.
|
||||
Returns True if reset student attempts button is present.
|
||||
"""
|
||||
return self.entrance_exam_reset_attempts_button.is_present()
|
||||
return self.reset_attempts_button.is_present()
|
||||
|
||||
def is_entrance_exam_rescore_submission_button_visible(self):
|
||||
def is_rescore_submission_button_visible(self):
|
||||
"""
|
||||
Returns True if rescore student submission button is present
|
||||
for entrance exam.
|
||||
Returns True if rescore student submission button is present.
|
||||
"""
|
||||
return self.entrance_exam_rescore_submission_button.is_present()
|
||||
return self.rescore_submission_button.is_present()
|
||||
|
||||
def is_entrance_exam_delete_student_state_button_visible(self):
|
||||
def is_delete_student_state_button_visible(self):
|
||||
"""
|
||||
Returns True if delete student state for entrance exam button is present
|
||||
for entrance exam.
|
||||
Returns True if delete student state for entrance exam button is present.
|
||||
"""
|
||||
return self.entrance_exam_delete_student_state_button.is_present()
|
||||
return self.delete_student_state_button.is_present()
|
||||
|
||||
def is_background_task_history_button_visible(self):
|
||||
"""
|
||||
Returns True if show background task history for student button is present
|
||||
for entrance exam.
|
||||
Returns True if show background task history for student button is present.
|
||||
"""
|
||||
return self.background_task_history_button.is_present()
|
||||
|
||||
def is_background_task_history_table_visible(self):
|
||||
"""
|
||||
Returns True if background task history table is present
|
||||
for entrance exam.
|
||||
Returns True if background task history table is present.
|
||||
"""
|
||||
return self.q(css='{} .entrance-exam-task-history-table'.format(self.ENTRANCE_EXAM_CONTAINER)).is_present()
|
||||
|
||||
def entrance_exam_click_reset_attempts_button(self):
|
||||
"""
|
||||
clicks reset student attempts button for entrance exam.
|
||||
"""
|
||||
return self.entrance_exam_reset_attempts_button.click()
|
||||
|
||||
def entrance_exam_click_rescore_submissions_button(self):
|
||||
"""
|
||||
clicks rescore submissions button for entrance exam.
|
||||
"""
|
||||
return self.entrance_exam_rescore_submission_button.click()
|
||||
|
||||
def click_skip_entrance_exam_button(self):
|
||||
"""
|
||||
clicks let student skip entrance exam button for entrance exam.
|
||||
"""
|
||||
return self.skip_entrance_exam_button.click()
|
||||
|
||||
def entrance_exam_click_delete_student_state_button(self):
|
||||
"""
|
||||
clicks delete student state button for entrance exam.
|
||||
"""
|
||||
return self.entrance_exam_delete_student_state_button.click()
|
||||
|
||||
def entrance_exam_click_task_history_button(self):
|
||||
"""
|
||||
clicks background task history button for entrance exam.
|
||||
"""
|
||||
return self.background_task_history_button.click()
|
||||
|
||||
def set_student_email_for_ee(self, email_addres):
|
||||
"""
|
||||
Sets given email address as value of student email address/username input box
|
||||
for entrance exam.
|
||||
"""
|
||||
input_box = self.entrance_exam_student_email_input.first.results[0]
|
||||
input_box.send_keys(email_addres)
|
||||
return self.q(css='{} .entrance-exam-task-history-table'.format(self.EE_CONTAINER)).is_present()
|
||||
|
||||
def click_reset_attempts_button(self):
|
||||
"""
|
||||
@@ -943,13 +869,30 @@ class StudentAdminPage(PageObject):
|
||||
"""
|
||||
return self.rescore_submission_button.click()
|
||||
|
||||
def click_skip_entrance_exam_button(self):
|
||||
"""
|
||||
clicks let student skip entrance exam button.
|
||||
"""
|
||||
return self.skip_entrance_exam_button.click()
|
||||
|
||||
def click_delete_student_state_button(self):
|
||||
"""
|
||||
clicks delete student state button and confirm the action.
|
||||
clicks delete student state button.
|
||||
"""
|
||||
with self.handle_alert(confirm=True):
|
||||
self.delete_student_state_button.click()
|
||||
self.wait_for_ajax()
|
||||
return self.delete_student_state_button.click()
|
||||
|
||||
def click_task_history_button(self):
|
||||
"""
|
||||
clicks background task history button.
|
||||
"""
|
||||
return self.background_task_history_button.click()
|
||||
|
||||
def set_student_email(self, email_addres):
|
||||
"""
|
||||
Sets given email address as value of student email address/username input box.
|
||||
"""
|
||||
input_box = self.student_email_input.first.results[0]
|
||||
input_box.send_keys(email_addres)
|
||||
|
||||
|
||||
class CertificatesPage(PageObject):
|
||||
|
||||
@@ -68,14 +68,31 @@ class StaffDebugPage(PageObject):
|
||||
def is_browser_on_page(self):
|
||||
return self.q(css='section.staff-modal').present
|
||||
|
||||
def click_student_grade_adjustments(self, user=None):
|
||||
def reset_attempts(self, user=None):
|
||||
"""
|
||||
This clicks on the reset attempts link with an optionally
|
||||
specified user.
|
||||
"""
|
||||
if user:
|
||||
self.q(css='input[id^=sd_fu_]').first.fill(user)
|
||||
self.q(css='section.staff-modal a.staff-debug-grade-adjustments').click()
|
||||
self.q(css='section.staff-modal a.staff-debug-reset').click()
|
||||
|
||||
def delete_state(self, user=None):
|
||||
"""
|
||||
This delete's a student's state for the problem
|
||||
"""
|
||||
if user:
|
||||
self.q(css='input[id^=sd_fu_]').fill(user)
|
||||
self.q(css='section.staff-modal a.staff-debug-sdelete').click()
|
||||
|
||||
def rescore(self, user=None):
|
||||
"""
|
||||
This clicks on the reset attempts link with an optionally
|
||||
specified user.
|
||||
"""
|
||||
if user:
|
||||
self.q(css='input[id^=sd_fu_]').first.fill(user)
|
||||
self.q(css='section.staff-modal a.staff-debug-rescore').click()
|
||||
|
||||
@property
|
||||
def idash_msg(self):
|
||||
|
||||
@@ -9,7 +9,7 @@ from pytz import UTC, utc
|
||||
from bok_choy.promise import EmptyPromise
|
||||
from nose.plugins.attrib import attr
|
||||
from .helpers import CohortTestMixin
|
||||
from ..helpers import UniqueCourseTest, EventsTestMixin, create_user_partition_json, get_sudo_access
|
||||
from ..helpers import UniqueCourseTest, EventsTestMixin, create_user_partition_json
|
||||
from xmodule.partitions.partitions import Group
|
||||
from ...fixtures.course import CourseFixture, XBlockFixtureDesc
|
||||
from ...pages.lms.auto_auth import AutoAuthPage
|
||||
@@ -53,16 +53,14 @@ class CohortConfigurationTest(EventsTestMixin, UniqueCourseTest, CohortTestMixin
|
||||
).visit().get_user_id()
|
||||
|
||||
# login as an instructor
|
||||
instructor_password = 'test'
|
||||
self.instructor_name = "instructor_user"
|
||||
self.instructor_id = AutoAuthPage(
|
||||
self.browser, username=self.instructor_name, email="instructor_user@example.com",
|
||||
course_id=self.course_id, staff=True, password=instructor_password
|
||||
course_id=self.course_id, staff=True
|
||||
).visit().get_user_id()
|
||||
|
||||
# go to the membership page on the instructor dashboard
|
||||
self.instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
|
||||
get_sudo_access(self.browser, self.instructor_dashboard_page, instructor_password)
|
||||
self.instructor_dashboard_page.visit()
|
||||
self.cohort_management_page = self.instructor_dashboard_page.select_cohort_management()
|
||||
|
||||
@@ -650,16 +648,14 @@ class CohortDiscussionTopicsTest(UniqueCourseTest, CohortTestMixin):
|
||||
self.cohort_id = self.add_manual_cohort(self.course_fixture, self.cohort_name)
|
||||
|
||||
# login as an instructor
|
||||
self.instructor_password = 'test'
|
||||
self.instructor_name = "instructor_user"
|
||||
self.instructor_id = AutoAuthPage(
|
||||
self.browser, username=self.instructor_name, email="instructor_user@example.com",
|
||||
course_id=self.course_id, staff=True, password=self.instructor_password
|
||||
course_id=self.course_id, staff=True
|
||||
).visit().get_user_id()
|
||||
|
||||
# go to the membership page on the instructor dashboard
|
||||
self.instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
|
||||
get_sudo_access(self.browser, self.instructor_dashboard_page, self.instructor_password)
|
||||
self.instructor_dashboard_page.visit()
|
||||
self.cohort_management_page = self.instructor_dashboard_page.select_cohort_management()
|
||||
self.cohort_management_page.wait_for_page()
|
||||
@@ -944,16 +940,14 @@ class CohortContentGroupAssociationTest(UniqueCourseTest, CohortTestMixin):
|
||||
})
|
||||
|
||||
# login as an instructor
|
||||
instructor_password = 'test'
|
||||
self.instructor_name = "instructor_user"
|
||||
self.instructor_id = AutoAuthPage(
|
||||
self.browser, username=self.instructor_name, email="instructor_user@example.com",
|
||||
course_id=self.course_id, staff=True, password=instructor_password
|
||||
course_id=self.course_id, staff=True
|
||||
).visit().get_user_id()
|
||||
|
||||
# go to the membership page on the instructor dashboard
|
||||
self.instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
|
||||
get_sudo_access(self.browser, self.instructor_dashboard_page, instructor_password)
|
||||
self.instructor_dashboard_page.visit()
|
||||
self.cohort_management_page = self.instructor_dashboard_page.select_cohort_management()
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ from selenium.webdriver.support.select import Select
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
from selenium.webdriver.support import expected_conditions as EC
|
||||
from unittest import TestCase
|
||||
from ..pages.common.sudo_page import SudoPage
|
||||
|
||||
|
||||
from ..pages.common import BASE_URL
|
||||
@@ -685,12 +684,3 @@ class TestWithSearchIndexMixin(object):
|
||||
def _cleanup_index_file(self):
|
||||
""" Removes search index backing file """
|
||||
remove_file(self.TEST_INDEX_FILENAME)
|
||||
|
||||
|
||||
def get_sudo_access(browser, redirect_page, password):
|
||||
"""
|
||||
Get sudo access for instructor or staff user.
|
||||
"""
|
||||
sudo_password_page = SudoPage(browser, redirect_page)
|
||||
sudo_password_page.visit()
|
||||
sudo_password_page.submit_sudo_password_and_get_access(password)
|
||||
|
||||
@@ -9,7 +9,6 @@ from ...pages.studio.overview import CourseOutlinePage
|
||||
from ...pages.lms.courseware_search import CoursewareSearchPage
|
||||
from ...pages.lms.staff_view import StaffPage
|
||||
from ...fixtures.course import XBlockFixtureDesc
|
||||
from ..helpers import get_sudo_access
|
||||
|
||||
from nose.plugins.attrib import attr
|
||||
|
||||
@@ -84,13 +83,13 @@ class CoursewareSearchCohortTest(ContainerBase):
|
||||
super(CoursewareSearchCohortTest, self).tearDown()
|
||||
os.remove(self.TEST_INDEX_FILENAME)
|
||||
|
||||
def _auto_auth(self, username, email, staff, password='test'):
|
||||
def _auto_auth(self, username, email, staff):
|
||||
"""
|
||||
Logout and login with given credentials.
|
||||
"""
|
||||
LogoutPage(self.browser).visit()
|
||||
StudioAutoAuthPage(self.browser, username=username, email=email,
|
||||
course_id=self.course_id, staff=staff, password=password).visit()
|
||||
course_id=self.course_id, staff=staff).visit()
|
||||
|
||||
def _studio_reindex(self):
|
||||
"""
|
||||
@@ -194,7 +193,7 @@ class CoursewareSearchCohortTest(ContainerBase):
|
||||
Each cohort is assigned one student.
|
||||
"""
|
||||
instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
|
||||
get_sudo_access(self.browser, instructor_dashboard_page, 'test')
|
||||
instructor_dashboard_page.visit()
|
||||
cohort_management_page = instructor_dashboard_page.select_cohort_management()
|
||||
|
||||
def add_cohort_with_student(cohort_name, content_group, student):
|
||||
|
||||
@@ -6,7 +6,7 @@ End-to-end tests for the LMS Instructor Dashboard.
|
||||
from nose.plugins.attrib import attr
|
||||
from bok_choy.promise import EmptyPromise
|
||||
|
||||
from ..helpers import UniqueCourseTest, get_modal_alert, EventsTestMixin, get_sudo_access
|
||||
from ..helpers import UniqueCourseTest, get_modal_alert, EventsTestMixin
|
||||
from ...pages.common.logout import LogoutPage
|
||||
from ...pages.lms.auto_auth import AutoAuthPage
|
||||
from ...pages.lms.instructor_dashboard import InstructorDashboardPage
|
||||
@@ -22,9 +22,7 @@ class BaseInstructorDashboardTest(EventsTestMixin, UniqueCourseTest):
|
||||
Logs in as an instructor and returns the id.
|
||||
"""
|
||||
username = "test_instructor_{uuid}".format(uuid=self.unique_id[0:6])
|
||||
auto_auth_page = AutoAuthPage(
|
||||
self.browser, username=username, course_id=self.course_id, staff=True, password="test"
|
||||
)
|
||||
auto_auth_page = AutoAuthPage(self.browser, username=username, course_id=self.course_id, staff=True)
|
||||
return username, auto_auth_page.visit().get_user_id()
|
||||
|
||||
def visit_instructor_dashboard(self):
|
||||
@@ -32,7 +30,6 @@ class BaseInstructorDashboardTest(EventsTestMixin, UniqueCourseTest):
|
||||
Visits the instructor dashboard.
|
||||
"""
|
||||
instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
|
||||
get_sudo_access(self.browser, instructor_dashboard_page, "test")
|
||||
instructor_dashboard_page.visit()
|
||||
return instructor_dashboard_page
|
||||
|
||||
@@ -145,10 +142,10 @@ class EntranceExamGradeTest(BaseInstructorDashboardTest):
|
||||
Then I see Student Email input box, Reset Student Attempt, Rescore Student Submission,
|
||||
Delete Student State for entrance exam and Show Background Task History for Student buttons
|
||||
"""
|
||||
self.assertTrue(self.student_admin_section.is_entrance_exam_student_email_input_visible())
|
||||
self.assertTrue(self.student_admin_section.is_entrance_exam_reset_attempts_button_visible())
|
||||
self.assertTrue(self.student_admin_section.is_entrance_exam_rescore_submission_button_visible())
|
||||
self.assertTrue(self.student_admin_section.is_entrance_exam_delete_student_state_button_visible())
|
||||
self.assertTrue(self.student_admin_section.is_student_email_input_visible())
|
||||
self.assertTrue(self.student_admin_section.is_reset_attempts_button_visible())
|
||||
self.assertTrue(self.student_admin_section.is_rescore_submission_button_visible())
|
||||
self.assertTrue(self.student_admin_section.is_delete_student_state_button_visible())
|
||||
self.assertTrue(self.student_admin_section.is_background_task_history_button_visible())
|
||||
|
||||
def test_clicking_reset_student_attempts_button_without_email_shows_error(self):
|
||||
@@ -161,10 +158,10 @@ class EntranceExamGradeTest(BaseInstructorDashboardTest):
|
||||
Then I should be shown an Error Notification
|
||||
And The Notification message should read 'Please enter a student email address or username.'
|
||||
"""
|
||||
self.student_admin_section.entrance_exam_click_reset_attempts_button()
|
||||
self.student_admin_section.click_reset_attempts_button()
|
||||
self.assertEqual(
|
||||
'Please enter a student email address or username.',
|
||||
self.student_admin_section.entrance_exam_top_notification.text[0]
|
||||
self.student_admin_section.top_notification.text[0]
|
||||
)
|
||||
|
||||
def test_clicking_reset_student_attempts_button_with_success(self):
|
||||
@@ -177,8 +174,8 @@ class EntranceExamGradeTest(BaseInstructorDashboardTest):
|
||||
email address or username
|
||||
Then I should be shown an alert with success message
|
||||
"""
|
||||
self.student_admin_section.set_student_email_for_ee(self.student_identifier)
|
||||
self.student_admin_section.entrance_exam_click_reset_attempts_button()
|
||||
self.student_admin_section.set_student_email(self.student_identifier)
|
||||
self.student_admin_section.click_reset_attempts_button()
|
||||
alert = get_modal_alert(self.student_admin_section.browser)
|
||||
alert.dismiss()
|
||||
|
||||
@@ -191,10 +188,10 @@ class EntranceExamGradeTest(BaseInstructorDashboardTest):
|
||||
Adjustment after non existing student email address or username
|
||||
Then I should be shown an error message
|
||||
"""
|
||||
self.student_admin_section.set_student_email_for_ee('non_existing@example.com')
|
||||
self.student_admin_section.entrance_exam_click_reset_attempts_button()
|
||||
self.student_admin_section.set_student_email('non_existing@example.com')
|
||||
self.student_admin_section.click_reset_attempts_button()
|
||||
self.student_admin_section.wait_for_ajax()
|
||||
self.assertGreater(len(self.student_admin_section.entrance_exam_top_notification.text[0]), 0)
|
||||
self.assertGreater(len(self.student_admin_section.top_notification.text[0]), 0)
|
||||
|
||||
def test_clicking_rescore_submission_button_with_success(self):
|
||||
"""
|
||||
@@ -205,8 +202,8 @@ class EntranceExamGradeTest(BaseInstructorDashboardTest):
|
||||
Adjustment after entering a valid student email address or username
|
||||
Then I should be shown an alert with success message
|
||||
"""
|
||||
self.student_admin_section.set_student_email_for_ee(self.student_identifier)
|
||||
self.student_admin_section.entrance_exam_click_rescore_submissions_button()
|
||||
self.student_admin_section.set_student_email(self.student_identifier)
|
||||
self.student_admin_section.click_rescore_submissions_button()
|
||||
alert = get_modal_alert(self.student_admin_section.browser)
|
||||
alert.dismiss()
|
||||
|
||||
@@ -219,10 +216,10 @@ class EntranceExamGradeTest(BaseInstructorDashboardTest):
|
||||
Adjustment after non existing student email address or username
|
||||
Then I should be shown an error message
|
||||
"""
|
||||
self.student_admin_section.set_student_email_for_ee('non_existing@example.com')
|
||||
self.student_admin_section.entrance_exam_click_rescore_submissions_button()
|
||||
self.student_admin_section.set_student_email('non_existing@example.com')
|
||||
self.student_admin_section.click_rescore_submissions_button()
|
||||
self.student_admin_section.wait_for_ajax()
|
||||
self.assertGreater(len(self.student_admin_section.entrance_exam_top_notification.text[0]), 0)
|
||||
self.assertGreater(len(self.student_admin_section.top_notification.text[0]), 0)
|
||||
|
||||
def test_clicking_skip_entrance_exam_button_with_success(self):
|
||||
"""
|
||||
@@ -234,7 +231,7 @@ class EntranceExamGradeTest(BaseInstructorDashboardTest):
|
||||
email address or username
|
||||
Then I should be shown an alert with success message
|
||||
"""
|
||||
self.student_admin_section.set_student_email_for_ee(self.student_identifier)
|
||||
self.student_admin_section.set_student_email(self.student_identifier)
|
||||
self.student_admin_section.click_skip_entrance_exam_button()
|
||||
#first we have window.confirm
|
||||
alert = get_modal_alert(self.student_admin_section.browser)
|
||||
@@ -254,14 +251,14 @@ class EntranceExamGradeTest(BaseInstructorDashboardTest):
|
||||
student email address or username
|
||||
Then I should be shown an error message
|
||||
"""
|
||||
self.student_admin_section.set_student_email_for_ee('non_existing@example.com')
|
||||
self.student_admin_section.set_student_email('non_existing@example.com')
|
||||
self.student_admin_section.click_skip_entrance_exam_button()
|
||||
#first we have window.confirm
|
||||
alert = get_modal_alert(self.student_admin_section.browser)
|
||||
alert.accept()
|
||||
|
||||
self.student_admin_section.wait_for_ajax()
|
||||
self.assertGreater(len(self.student_admin_section.entrance_exam_top_notification.text[0]), 0)
|
||||
self.assertGreater(len(self.student_admin_section.top_notification.text[0]), 0)
|
||||
|
||||
def test_clicking_delete_student_attempts_button_with_success(self):
|
||||
"""
|
||||
@@ -273,8 +270,8 @@ class EntranceExamGradeTest(BaseInstructorDashboardTest):
|
||||
email address or username
|
||||
Then I should be shown an alert with success message
|
||||
"""
|
||||
self.student_admin_section.set_student_email_for_ee(self.student_identifier)
|
||||
self.student_admin_section.entrance_exam_click_delete_student_state_button()
|
||||
self.student_admin_section.set_student_email(self.student_identifier)
|
||||
self.student_admin_section.click_delete_student_state_button()
|
||||
alert = get_modal_alert(self.student_admin_section.browser)
|
||||
alert.dismiss()
|
||||
|
||||
@@ -289,10 +286,10 @@ class EntranceExamGradeTest(BaseInstructorDashboardTest):
|
||||
email address or username
|
||||
Then I should be shown an error message
|
||||
"""
|
||||
self.student_admin_section.set_student_email_for_ee('non_existing@example.com')
|
||||
self.student_admin_section.entrance_exam_click_delete_student_state_button()
|
||||
self.student_admin_section.set_student_email('non_existing@example.com')
|
||||
self.student_admin_section.click_delete_student_state_button()
|
||||
self.student_admin_section.wait_for_ajax()
|
||||
self.assertGreater(len(self.student_admin_section.entrance_exam_top_notification.text[0]), 0)
|
||||
self.assertGreater(len(self.student_admin_section.top_notification.text[0]), 0)
|
||||
|
||||
def test_clicking_task_history_button_with_success(self):
|
||||
"""
|
||||
@@ -304,8 +301,8 @@ class EntranceExamGradeTest(BaseInstructorDashboardTest):
|
||||
email address or username
|
||||
Then I should be shown an table listing all background tasks
|
||||
"""
|
||||
self.student_admin_section.set_student_email_for_ee(self.student_identifier)
|
||||
self.student_admin_section.entrance_exam_click_task_history_button()
|
||||
self.student_admin_section.set_student_email(self.student_identifier)
|
||||
self.student_admin_section.click_task_history_button()
|
||||
self.assertTrue(self.student_admin_section.is_background_task_history_table_visible())
|
||||
|
||||
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
Tests the "preview" selector in the LMS that allows changing between Staff, Student, and Content Groups.
|
||||
"""
|
||||
|
||||
from ..helpers import UniqueCourseTest, create_user_partition_json, get_modal_alert
|
||||
from ..helpers import UniqueCourseTest, create_user_partition_json
|
||||
from ...pages.studio.auto_auth import AutoAuthPage
|
||||
from ...pages.lms.courseware import CoursewarePage
|
||||
from ...pages.lms.instructor_dashboard import InstructorDashboardPage, StudentAdminPage
|
||||
from ...pages.lms.staff_view import StaffPage
|
||||
from ...pages.common.sudo_page import SudoPage
|
||||
from ...fixtures.course import CourseFixture, XBlockFixtureDesc
|
||||
from xmodule.partitions.partitions import Group
|
||||
from textwrap import dedent
|
||||
@@ -38,9 +36,8 @@ class StaffViewTest(UniqueCourseTest):
|
||||
|
||||
# Auto-auth register for the course.
|
||||
# Do this as global staff so that you will see the Staff View
|
||||
self.staff_password = 'test'
|
||||
AutoAuthPage(self.browser, username=self.USERNAME, email=self.EMAIL,
|
||||
course_id=self.course_id, staff=True, password=self.staff_password).visit()
|
||||
course_id=self.course_id, staff=True).visit()
|
||||
|
||||
def _goto_staff_page(self):
|
||||
"""
|
||||
@@ -102,41 +99,26 @@ class StaffDebugTest(CourseWithoutContentGroupsTest):
|
||||
"""
|
||||
Tests that verify the staff debug info.
|
||||
"""
|
||||
|
||||
def _goto_student_admin_section(self):
|
||||
"""
|
||||
Get sudo access and return student admin section.
|
||||
"""
|
||||
instructor_page = InstructorDashboardPage(self.browser, self.course_id)
|
||||
sudo_page = SudoPage(self.browser, instructor_page)
|
||||
sudo_page.wait_for_page()
|
||||
sudo_page.submit_sudo_password_and_get_access(self.staff_password)
|
||||
|
||||
student_admin_section = StudentAdminPage(self.browser)
|
||||
student_admin_section.wait_for_page()
|
||||
return student_admin_section
|
||||
|
||||
def test_reset_attempts_empty(self):
|
||||
"""
|
||||
Test that we reset even when there is no student state
|
||||
"""
|
||||
|
||||
staff_debug_page = self._goto_staff_page().open_staff_debug_info()
|
||||
staff_debug_page.click_student_grade_adjustments()
|
||||
student_admin_section = self._goto_student_admin_section()
|
||||
student_admin_section.click_reset_attempts_button()
|
||||
alert = get_modal_alert(student_admin_section.browser)
|
||||
alert.dismiss()
|
||||
staff_debug_page.reset_attempts()
|
||||
msg = staff_debug_page.idash_msg[0]
|
||||
self.assertEqual(u'Successfully reset the attempts '
|
||||
'for user {}'.format(self.USERNAME), msg)
|
||||
|
||||
def test_delete_state_empty(self):
|
||||
"""
|
||||
Test that we delete properly even when there isn't state to delete.
|
||||
"""
|
||||
staff_debug_page = self._goto_staff_page().open_staff_debug_info()
|
||||
staff_debug_page.click_student_grade_adjustments()
|
||||
student_admin_section = self._goto_student_admin_section()
|
||||
student_admin_section.click_delete_student_state_button()
|
||||
self.assertEqual(len(student_admin_section.top_notification.text[0]), 0)
|
||||
staff_debug_page.delete_state()
|
||||
msg = staff_debug_page.idash_msg[0]
|
||||
self.assertEqual(u'Successfully deleted student state '
|
||||
'for user {}'.format(self.USERNAME), msg)
|
||||
|
||||
def test_reset_attempts_state(self):
|
||||
"""
|
||||
@@ -146,11 +128,10 @@ class StaffDebugTest(CourseWithoutContentGroupsTest):
|
||||
staff_page.answer_problem()
|
||||
|
||||
staff_debug_page = staff_page.open_staff_debug_info()
|
||||
staff_debug_page.click_student_grade_adjustments()
|
||||
student_admin_section = self._goto_student_admin_section()
|
||||
student_admin_section.click_reset_attempts_button()
|
||||
alert = get_modal_alert(student_admin_section.browser)
|
||||
alert.dismiss()
|
||||
staff_debug_page.reset_attempts()
|
||||
msg = staff_debug_page.idash_msg[0]
|
||||
self.assertEqual(u'Successfully reset the attempts '
|
||||
'for user {}'.format(self.USERNAME), msg)
|
||||
|
||||
def test_rescore_state(self):
|
||||
"""
|
||||
@@ -160,11 +141,9 @@ class StaffDebugTest(CourseWithoutContentGroupsTest):
|
||||
staff_page.answer_problem()
|
||||
|
||||
staff_debug_page = staff_page.open_staff_debug_info()
|
||||
staff_debug_page.click_student_grade_adjustments()
|
||||
student_admin_section = self._goto_student_admin_section()
|
||||
student_admin_section.click_rescore_submissions_button()
|
||||
alert = get_modal_alert(student_admin_section.browser)
|
||||
alert.dismiss()
|
||||
staff_debug_page.rescore()
|
||||
msg = staff_debug_page.idash_msg[0]
|
||||
self.assertEqual(u'Successfully rescored problem for user STAFF_TESTER', msg)
|
||||
|
||||
def test_student_state_delete(self):
|
||||
"""
|
||||
@@ -174,10 +153,10 @@ class StaffDebugTest(CourseWithoutContentGroupsTest):
|
||||
staff_page.answer_problem()
|
||||
|
||||
staff_debug_page = staff_page.open_staff_debug_info()
|
||||
staff_debug_page.click_student_grade_adjustments()
|
||||
student_admin_section = self._goto_student_admin_section()
|
||||
student_admin_section.click_delete_student_state_button()
|
||||
self.assertEqual(len(student_admin_section.top_notification.text[0]), 0)
|
||||
staff_debug_page.delete_state()
|
||||
msg = staff_debug_page.idash_msg[0]
|
||||
self.assertEqual(u'Successfully deleted student state '
|
||||
'for user {}'.format(self.USERNAME), msg)
|
||||
|
||||
def test_student_by_email(self):
|
||||
"""
|
||||
@@ -187,11 +166,10 @@ class StaffDebugTest(CourseWithoutContentGroupsTest):
|
||||
staff_page.answer_problem()
|
||||
|
||||
staff_debug_page = staff_page.open_staff_debug_info()
|
||||
staff_debug_page.click_student_grade_adjustments(self.EMAIL)
|
||||
student_admin_section = self._goto_student_admin_section()
|
||||
student_admin_section.click_reset_attempts_button()
|
||||
alert = get_modal_alert(student_admin_section.browser)
|
||||
alert.dismiss()
|
||||
staff_debug_page.reset_attempts(self.EMAIL)
|
||||
msg = staff_debug_page.idash_msg[0]
|
||||
self.assertEqual(u'Successfully reset the attempts '
|
||||
'for user {}'.format(self.EMAIL), msg)
|
||||
|
||||
def test_bad_student(self):
|
||||
"""
|
||||
@@ -201,10 +179,10 @@ class StaffDebugTest(CourseWithoutContentGroupsTest):
|
||||
staff_page.answer_problem()
|
||||
|
||||
staff_debug_page = staff_page.open_staff_debug_info()
|
||||
staff_debug_page.click_student_grade_adjustments('INVALIDUSER')
|
||||
student_admin_section = self._goto_student_admin_section()
|
||||
student_admin_section.click_delete_student_state_button()
|
||||
self.assertGreater(len(student_admin_section.top_notification.text[0]), 0)
|
||||
staff_debug_page.delete_state('INVALIDUSER')
|
||||
msg = staff_debug_page.idash_msg[0]
|
||||
self.assertEqual(u'Failed to delete student state. '
|
||||
'User does not exist.', msg)
|
||||
|
||||
def test_reset_attempts_for_problem_loaded_via_ajax(self):
|
||||
"""
|
||||
@@ -215,11 +193,10 @@ class StaffDebugTest(CourseWithoutContentGroupsTest):
|
||||
staff_page.answer_problem()
|
||||
|
||||
staff_debug_page = staff_page.open_staff_debug_info()
|
||||
staff_debug_page.click_student_grade_adjustments()
|
||||
student_admin_section = self._goto_student_admin_section()
|
||||
student_admin_section.click_reset_attempts_button()
|
||||
alert = get_modal_alert(student_admin_section.browser)
|
||||
alert.dismiss()
|
||||
staff_debug_page.reset_attempts()
|
||||
msg = staff_debug_page.idash_msg[0]
|
||||
self.assertEqual(u'Successfully reset the attempts '
|
||||
'for user {}'.format(self.USERNAME), msg)
|
||||
|
||||
def test_rescore_state_for_problem_loaded_via_ajax(self):
|
||||
"""
|
||||
@@ -230,11 +207,9 @@ class StaffDebugTest(CourseWithoutContentGroupsTest):
|
||||
staff_page.answer_problem()
|
||||
|
||||
staff_debug_page = staff_page.open_staff_debug_info()
|
||||
staff_debug_page.click_student_grade_adjustments()
|
||||
student_admin_section = self._goto_student_admin_section()
|
||||
student_admin_section.click_rescore_submissions_button()
|
||||
alert = get_modal_alert(student_admin_section.browser)
|
||||
alert.dismiss()
|
||||
staff_debug_page.rescore()
|
||||
msg = staff_debug_page.idash_msg[0]
|
||||
self.assertEqual(u'Successfully rescored problem for user STAFF_TESTER', msg)
|
||||
|
||||
def test_student_state_delete_for_problem_loaded_via_ajax(self):
|
||||
"""
|
||||
@@ -245,10 +220,10 @@ class StaffDebugTest(CourseWithoutContentGroupsTest):
|
||||
staff_page.answer_problem()
|
||||
|
||||
staff_debug_page = staff_page.open_staff_debug_info()
|
||||
staff_debug_page.click_student_grade_adjustments()
|
||||
student_admin_section = self._goto_student_admin_section()
|
||||
student_admin_section.click_delete_student_state_button()
|
||||
self.assertEqual(len(student_admin_section.top_notification.text[0]), 0)
|
||||
staff_debug_page.delete_state()
|
||||
msg = staff_debug_page.idash_msg[0]
|
||||
self.assertEqual(u'Successfully deleted student state '
|
||||
'for user {}'.format(self.USERNAME), msg)
|
||||
|
||||
|
||||
class CourseWithContentGroupsTest(StaffViewTest):
|
||||
|
||||
@@ -5,7 +5,6 @@ from flaky import flaky
|
||||
from nose.plugins.attrib import attr
|
||||
|
||||
from .base_studio_test import StudioCourseTest
|
||||
from ..helpers import get_sudo_access
|
||||
from ...pages.studio.auto_auth import AutoAuthPage
|
||||
|
||||
from ...pages.studio.users import CourseTeamPage
|
||||
@@ -39,7 +38,6 @@ class CourseTeamPageTest(StudioCourseTest):
|
||||
self.page = CourseTeamPage( # pylint:disable=attribute-defined-outside-init
|
||||
self.browser, self.course_info['org'], self.course_info['number'], self.course_info['run']
|
||||
)
|
||||
get_sudo_access(self.browser, self.page, self.user.get('password'))
|
||||
self._go_to_course_team_page()
|
||||
|
||||
def _go_to_course_team_page(self):
|
||||
@@ -127,7 +125,6 @@ class CourseTeamPageTest(StudioCourseTest):
|
||||
self.page.add_user_to_course(self.other_user.get('email'))
|
||||
self._assert_user_present(self.other_user, present=True)
|
||||
self.log_in(self.other_user)
|
||||
get_sudo_access(self.browser, self.page, self.other_user.get('password'))
|
||||
self._assert_current_course(visible=True)
|
||||
|
||||
@flaky # TODO fix this, see TNL-2667
|
||||
@@ -146,7 +143,6 @@ class CourseTeamPageTest(StudioCourseTest):
|
||||
self._assert_user_present(self.other_user, present=True)
|
||||
|
||||
self.log_in(self.other_user)
|
||||
get_sudo_access(self.browser, self.page, self.other_user.get('password'))
|
||||
self._assert_current_course(visible=True)
|
||||
self._go_to_course_team_page()
|
||||
|
||||
@@ -208,7 +204,6 @@ class CourseTeamPageTest(StudioCourseTest):
|
||||
self._assert_is_admin(other)
|
||||
|
||||
self.log_in(self.other_user)
|
||||
get_sudo_access(self.browser, self.page, self.other_user.get('password'))
|
||||
self._go_to_course_team_page()
|
||||
other = self.page.get_user(self.other_user.get('email'))
|
||||
self.assertTrue(other.is_current_user)
|
||||
@@ -240,14 +235,12 @@ class CourseTeamPageTest(StudioCourseTest):
|
||||
|
||||
# precondition check - frank is an admin and can add/delete/promote/demote users
|
||||
self.log_in(self.other_user)
|
||||
get_sudo_access(self.browser, self.page, self.other_user.get('password'))
|
||||
self._go_to_course_team_page()
|
||||
other = self.page.get_user(self.other_user.get('email'))
|
||||
self.assertTrue(other.is_current_user)
|
||||
self._assert_can_manage_users()
|
||||
|
||||
self.log_in(self.user)
|
||||
get_sudo_access(self.browser, self.page, self.user.get('password'))
|
||||
self._go_to_course_team_page()
|
||||
other = self.page.get_user(self.other_user.get('email'))
|
||||
other.click_demote()
|
||||
@@ -256,7 +249,6 @@ class CourseTeamPageTest(StudioCourseTest):
|
||||
self._assert_is_staff(other)
|
||||
|
||||
self.log_in(self.other_user)
|
||||
get_sudo_access(self.browser, self.page, self.other_user.get('password'))
|
||||
self._go_to_course_team_page()
|
||||
other = self.page.get_user(self.other_user.get('email'))
|
||||
self.assertTrue(other.is_current_user)
|
||||
@@ -342,7 +334,6 @@ class CourseTeamPageTest(StudioCourseTest):
|
||||
self.assertFalse(current.can_promote)
|
||||
|
||||
self.log_in(self.other_user)
|
||||
get_sudo_access(self.browser, self.page, self.other_user.get('password'))
|
||||
self._go_to_course_team_page()
|
||||
|
||||
current = self.page.get_user(self.user.get('email'))
|
||||
|
||||
@@ -7,7 +7,6 @@ from flaky import flaky
|
||||
|
||||
from .base_studio_test import StudioLibraryTest
|
||||
from ...fixtures.course import XBlockFixtureDesc
|
||||
from ..helpers import get_sudo_access
|
||||
from ...pages.studio.auto_auth import AutoAuthPage
|
||||
from ...pages.studio.utils import add_component
|
||||
from ...pages.studio.library import LibraryEditPage
|
||||
@@ -515,7 +514,6 @@ class LibraryUsersPageTest(StudioLibraryTest):
|
||||
AutoAuthPage(self.browser, username="second", email="second@example.com", no_login=True).visit()
|
||||
|
||||
self.page = LibraryUsersPage(self.browser, self.library_key)
|
||||
get_sudo_access(self.browser, self.page, self.user.get("password"))
|
||||
self.page.visit()
|
||||
|
||||
def _refresh_page(self):
|
||||
|
||||
@@ -11,7 +11,6 @@ from ..pages.studio.settings_group_configurations import GroupConfigurationsPage
|
||||
from ..pages.studio.auto_auth import AutoAuthPage as StudioAutoAuthPage
|
||||
from ..fixtures.course import XBlockFixtureDesc
|
||||
from ..fixtures import LMS_BASE_URL
|
||||
from .helpers import get_sudo_access
|
||||
from ..pages.studio.component_editor import ComponentVisibilityEditorView
|
||||
from ..pages.lms.instructor_dashboard import InstructorDashboardPage
|
||||
from ..pages.lms.courseware import CoursewarePage
|
||||
@@ -55,12 +54,8 @@ class EndToEndCohortedCoursewareTest(ContainerBase):
|
||||
).visit()
|
||||
|
||||
# Start logged in as the staff user.
|
||||
self.instructor_password = 'test'
|
||||
StudioAutoAuthPage(
|
||||
self.browser,
|
||||
username=self.staff_user["username"],
|
||||
email=self.staff_user["email"],
|
||||
password=self.instructor_password
|
||||
self.browser, username=self.staff_user["username"], email=self.staff_user["email"]
|
||||
).visit()
|
||||
|
||||
def populate_course_fixture(self, course_fixture):
|
||||
@@ -143,7 +138,6 @@ class EndToEndCohortedCoursewareTest(ContainerBase):
|
||||
Each cohort is assigned one student.
|
||||
"""
|
||||
instructor_dashboard_page = InstructorDashboardPage(self.browser, self.course_id)
|
||||
get_sudo_access(self.browser, instructor_dashboard_page, self.instructor_password)
|
||||
instructor_dashboard_page.visit()
|
||||
cohort_management_page = instructor_dashboard_page.select_cohort_management()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user