Exemple #1
0
 def setUp(self):
     super(NewLibraryHelpTest, self).setUp()
     self.auth_page = AutoAuthPage(self.browser, staff=True)
     self.dashboard_page = DashboardPage(self.browser)
     self.auth_page.visit()
     self.dashboard_page.visit()
     self.assertTrue(self.dashboard_page.has_new_library_button)
     self.dashboard_page.click_new_library()
    def _update_user(self, user_info):
        """
        Update user with provided `user_info`

        Arguments:
            `user_info`: dictionary containing values of attributes to be updated
        """
        AutoAuthPage(self.browser, no_login=True, **user_info).visit()
Exemple #3
0
 def setUp(self):
     super(NewCourseHelpTest, self).setUp()
     self.auth_page = AutoAuthPage(self.browser, staff=True)
     self.dashboard_page = DashboardPage(self.browser)
     self.auth_page.visit()
     self.dashboard_page.visit()
     self.assertTrue(self.dashboard_page.new_course_button.present)
     self.dashboard_page.click_new_course_button()
    def setUp(self):
        """
        Load the helper for the home page (dashboard page)
        """
        super(CreateLibraryTest, self).setUp()

        self.auth_page = AutoAuthPage(self.browser, staff=True)
        self.dashboard_page = DashboardPage(self.browser)
Exemple #5
0
 def _create_user(self):
     """
     Create a unique user
     """
     auto_auth = AutoAuthPage(self.browser).visit()
     user_info = auto_auth.user_info
     LogoutPage(self.browser).visit()
     return user_info
Exemple #6
0
 def test_badge_share_modal(self):
     username = '******'
     AutoAuthPage(self.browser, username=username).visit()
     profile_page = self.visit_profile_page(username)
     profile_page.display_accomplishments()
     badge = profile_page.badges[0]
     badge.display_modal()
     badge.close_modal()
Exemple #7
0
 def log_in_as_unique_user(self):
     """
     Create a unique user and return the account's username and id.
     """
     username = "******".format(uuid=self.unique_id[0:6])
     auto_auth_page = AutoAuthPage(self.browser, username=username).visit()
     user_id = auto_auth_page.get_user_id()
     return username, user_id
Exemple #8
0
 def _auto_auth(self, username, email, staff):
     """
     Logout and login with given credentials.
     """
     AutoAuthPage(self.browser,
                  username=username,
                  email=email,
                  course_id=self.course_id,
                  staff=staff).visit()
Exemple #9
0
 def test_redirect_banner(self):
     """
     Navigate to the course info page, then check that we're on the
     dashboard page with the appropriate message.
     """
     AutoAuthPage(self.browser).visit()
     url = BASE_URL + "/course_modes/choose/" + self.course_id
     self.browser.get(url)
     self._assert_dashboard_message()
Exemple #10
0
    def auth(self, enroll=True):
        """Authenticate, enrolling the user in the configured course if requested."""
        CourseFixture(**self.course_info).install()

        course_id = self.course_id if enroll else None
        auth_page = AutoAuthPage(self.browser, course_id=course_id)
        auth_page.visit()

        self.username = auth_page.user_info['username']
Exemple #11
0
 def setUp(self):
     """Create a course that isn't live yet and enroll for it."""
     super(NotLiveRedirectTest, self).setUp()
     CourseFixture(
         self.course_info['org'], self.course_info['number'],
         self.course_info['run'], self.course_info['display_name'],
         start_date=datetime(year=2099, month=1, day=1)
     ).install()
     AutoAuthPage(self.browser, course_id=self.course_id).visit()
 def log_in_as_unique_user(self):
     """
     Log in as a valid lms user.
     """
     AutoAuthPage(self.browser,
                  username="******",
                  email="*****@*****.**",
                  password="******",
                  course_id=self.course_id).visit()
    def setUp(self):
        """
        Setup course
        """
        super(LmsPerformanceTest, self).setUp()

        # Install a course with sections/problems, tabs, updates, and handouts
        course_fix = CourseFixture(self.course_info['org'],
                                   self.course_info['number'],
                                   self.course_info['run'],
                                   self.course_info['display_name'])

        course_fix.add_update(
            CourseUpdateDesc(date='January 29, 2014',
                             content='Test course update1'))
        course_fix.add_update(
            CourseUpdateDesc(date='January 30, 2014',
                             content='Test course update2'))
        course_fix.add_update(
            CourseUpdateDesc(date='January 31, 2014',
                             content='Test course update3'))

        course_fix.add_children(
            XBlockFixtureDesc('chapter', 'Test Section 1').add_children(
                XBlockFixtureDesc(
                    'sequential', 'Test Subsection 1').add_children(
                        XBlockFixtureDesc(
                            'problem',
                            'Test Problem 1',
                            data=load_data_str('multiple_choice.xml')),
                        XBlockFixtureDesc(
                            'problem',
                            'Test Problem 2',
                            data=load_data_str('formula_problem.xml')),
                        XBlockFixtureDesc('html',
                                          'Test HTML',
                                          data="<html>Html child text</html>"),
                    )),
            XBlockFixtureDesc('chapter', 'Test Section 2').add_children(
                XBlockFixtureDesc(
                    'sequential', 'Test Subsection 2').add_children(
                        XBlockFixtureDesc(
                            'html',
                            'Html Child',
                            data="<html>Html child text</html>"))),
            XBlockFixtureDesc('chapter', 'Test Section 3').add_children(
                XBlockFixtureDesc('sequential',
                                  'Test Subsection 3').add_children(
                                      XBlockFixtureDesc(
                                          'problem',
                                          'Test Problem 3')))).install()

        AutoAuthPage(self.browser,
                     username=self.username,
                     email=self.email,
                     course_id=self.course_id).visit()
Exemple #14
0
    def setUp(self):
        """
        Initialize pages and install a course fixture.
        """
        super(HighLevelTabTest, self).setUp()

        # self.course_info['number'] must be shorter since we are accessing the wiki. See TNL-1751
        self.course_info['number'] = self.unique_id[0:6]

        self.course_home_page = CourseHomePage(self.browser, self.course_id)
        self.progress_page = ProgressPage(self.browser, self.course_id)
        self.courseware_page = CoursewarePage(self.browser, self.course_id)
        self.tab_nav = TabNavPage(self.browser)
        self.video = VideoPage(self.browser)

        # Install a course with sections/problems, tabs, updates, and handouts
        course_fix = CourseFixture(self.course_info['org'],
                                   self.course_info['number'],
                                   self.course_info['run'],
                                   self.course_info['display_name'])

        course_fix.add_update(
            CourseUpdateDesc(date='January 29, 2014',
                             content='Test course update1'))

        course_fix.add_handout('demoPDF.pdf')

        course_fix.add_children(
            XBlockFixtureDesc('static_tab',
                              'Test Static Tab',
                              data=r"static tab data with mathjax \(E=mc^2\)"),
            XBlockFixtureDesc('chapter', 'Test Section').add_children(
                XBlockFixtureDesc(
                    'sequential', 'Test Subsection').add_children(
                        XBlockFixtureDesc(
                            'problem',
                            'Test Problem 1',
                            data=load_data_str('multiple_choice.xml')),
                        XBlockFixtureDesc(
                            'problem',
                            'Test Problem 2',
                            data=load_data_str('formula_problem.xml')),
                        XBlockFixtureDesc('html', 'Test HTML'),
                    )),
            XBlockFixtureDesc('chapter', 'Test Section 2').add_children(
                XBlockFixtureDesc('sequential', 'Test Subsection 2'),
                XBlockFixtureDesc(
                    'sequential', 'Test Subsection 3').add_children(
                        XBlockFixtureDesc(
                            'problem',
                            'Test Problem A',
                            data=load_data_str('multiple_choice.xml'))),
            )).install()

        # Auto-auth register for the course
        AutoAuthPage(self.browser, course_id=self.course_id).visit()
Exemple #15
0
def auto_auth(browser, username, email, staff, course_id, **kwargs):
    """
    Logout and login with given credentials.
    """
    AutoAuthPage(browser,
                 username=username,
                 email=email,
                 course_id=course_id,
                 staff=staff,
                 **kwargs).visit()
 def log_in(self, user, is_staff=False):
     """
     Log in as the user that created the library.
     By default the user will not have staff access unless is_staff is passed as True.
     """
     auth_page = AutoAuthPage(self.browser,
                              staff=is_staff,
                              username=user.get('username'),
                              email=user.get('email'),
                              password=user.get('password'))
     auth_page.visit()
Exemple #17
0
    def setUp(self):
        super(LibraryUsersPageTest, self).setUp()

        # Create a second user for use in these tests:
        AutoAuthPage(self.browser,
                     username="******",
                     email="*****@*****.**",
                     no_login=True).visit()

        self.page = LibraryUsersPage(self.browser, self.library_key)
        self.page.visit()
Exemple #18
0
 def test_badges_accessibility(self):
     """
     Test the accessibility of the badge listings and sharing modal.
     """
     username = '******'
     AutoAuthPage(self.browser, username=username).visit()
     profile_page = self.visit_profile_page(username)
     profile_page.display_accomplishments()
     profile_page.a11y_audit.check_for_accessibility_errors()
     profile_page.badges[0].display_modal()
     profile_page.a11y_audit.check_for_accessibility_errors()
Exemple #19
0
    def test_deferred_verification_enrollment(self):
        # Create a user and log them in
        student_id = AutoAuthPage(self.browser).visit().get_user_id()

        enroll_user_track(self.browser, self.course_id, 'verified')

        # Navigate to the dashboard
        self.dashboard_page.visit()

        # Expect that we're enrolled as verified in the course
        enrollment_mode = self.dashboard_page.get_enrollment_mode(self.course_info["display_name"])
        self.assertEqual(enrollment_mode, 'verified')
Exemple #20
0
    def setUp(self):
        """
        Create a unique identifier for the course used in this test.
        """
        # Ensure that the superclass sets up
        super(XBlockAcidBase, self).setUp()

        self.setup_fixtures()

        AutoAuthPage(self.browser, course_id=self.course_id).visit()

        self.courseware_page = CoursewarePage(self.browser, self.course_id)
 def log_in_as_unique_user(self, email=None, full_name=None, password=None):
     """
     Create a unique user and return the account's username and id.
     """
     username = "******".format(uuid=self.unique_id[0:6])
     auto_auth_page = AutoAuthPage(self.browser,
                                   username=username,
                                   email=email,
                                   full_name=full_name,
                                   password=password).visit()
     user_id = auto_auth_page.get_user_id()
     return username, user_id
    def setUp(self):
        """
        Load the helper for the home page (dashboard page)
        """
        super(CreateCourseTest, self).setUp()

        self.auth_page = AutoAuthPage(self.browser, staff=True)
        self.dashboard_page = DashboardPage(self.browser)
        self.course_name = "New Course Name"
        self.course_org = "orgX"
        self.course_number = str(uuid.uuid4().get_hex().upper()[0:6])
        self.course_run = "2015_T2"
Exemple #23
0
 def _make_user(self, username):
     """ Registers user and returns user representation dictionary as expected by `log_in` function """
     user = {
         'username': username,
         'email': username + "@example.com",
         'password': username + '123'
     }
     AutoAuthPage(
         self.browser, no_login=True,
         username=user.get('username'), email=user.get('email'), password=user.get('password')
     ).visit()
     return user
Exemple #24
0
    def test_entrance_exam_section_2(self):
        """
         Scenario: Any course that is enabled for an entrance exam, should have entrance exam chapter at course
         page.
            Given that I am on the course page
            When I view the course that has an entrance exam
            Then there should be an "Entrance Exam" chapter.'
        """
        courseware_page = CoursewarePage(self.browser, self.course_id)
        entrance_exam_link_selector = '.accordion .course-navigation .chapter .group-heading'
        # visit course page and make sure there is not entrance exam chapter.
        courseware_page.visit()
        courseware_page.wait_for_page()
        self.assertFalse(
            element_has_text(page=courseware_page,
                             css_selector=entrance_exam_link_selector,
                             text='Entrance Exam'))

        # Logout and login as a staff.
        LogoutPage(self.browser).visit()
        AutoAuthPage(self.browser, course_id=self.course_id,
                     staff=True).visit()

        # visit course settings page and set/enabled entrance exam for that course.
        self.settings_page.visit()
        self.settings_page.require_entrance_exam()
        self.settings_page.save_changes()

        # Logout and login as a student.
        LogoutPage(self.browser).visit()
        AutoAuthPage(self.browser, course_id=self.course_id,
                     staff=False).visit()

        # visit course info page and make sure there is an "Entrance Exam" section.
        courseware_page.visit()
        courseware_page.wait_for_page()
        self.assertTrue(
            element_has_text(page=courseware_page,
                             css_selector=entrance_exam_link_selector,
                             text='Entrance Exam'))
    def setUp(self):
        super(AnnotatableProblemTest, self).setUp()

        self.courseware_page = CoursewarePage(self.browser, self.course_id)

        # Install a course with two annotations and two annotations problems.
        course_fix = CourseFixture(self.course_info['org'],
                                   self.course_info['number'],
                                   self.course_info['run'],
                                   self.course_info['display_name'])

        self.annotation_count = 2
        course_fix.add_children(
            XBlockFixtureDesc('chapter', 'Test Section').add_children(
                XBlockFixtureDesc('sequential', 'Test Subsection').
                add_children(
                    XBlockFixtureDesc(
                        'vertical', 'Test Annotation Vertical').add_children(
                            XBlockFixtureDesc(
                                'annotatable',
                                'Test Annotation Module',
                                data=self.DATA_TEMPLATE.format("\n".join(
                                    self.ANNOTATION_TEMPLATE.format(i)
                                    for i in range(self.annotation_count)))),
                            XBlockFixtureDesc(
                                'problem',
                                'Test Annotation Problem 0',
                                data=self.PROBLEM_TEMPLATE.format(
                                    number=0,
                                    options="\n".join(
                                        self.OPTION_TEMPLATE.format(
                                            number=k,
                                            correctness=_correctness(k, 0)) for
                                        k in range(self.annotation_count)))),
                            XBlockFixtureDesc(
                                'problem',
                                'Test Annotation Problem 1',
                                data=self.PROBLEM_TEMPLATE.format(
                                    number=1,
                                    options="\n".join(
                                        self.OPTION_TEMPLATE.format(
                                            number=k,
                                            correctness=_correctness(k, 1))
                                        for k in range(self.annotation_count)
                                    ))))))).install()

        # Auto-auth register for the course.
        AutoAuthPage(self.browser,
                     username=self.USERNAME,
                     email=self.EMAIL,
                     course_id=self.course_id,
                     staff=False).visit()
Exemple #26
0
    def setUp(self):
        """
        Set up a cohorted course
        """
        super(CohortConfigurationTest, self).setUp()

        # create course with cohorts
        self.manual_cohort_name = "ManualCohort1"
        self.auto_cohort_name = "AutoCohort1"
        self.course_fixture = CourseFixture(**self.course_info).install()
        self.setup_cohort_config(self.course_fixture, auto_cohort_groups=[self.auto_cohort_name])
        self.manual_cohort_id = self.add_manual_cohort(self.course_fixture, self.manual_cohort_name)

        # create a non-instructor who will be registered for the course and in the manual cohort.
        self.student_name, self.student_email = self._generate_unique_user_data()
        self.student_id = AutoAuthPage(
            self.browser, username=self.student_name, email=self.student_email,
            course_id=self.course_id, staff=False
        ).visit().get_user_id()
        self.add_user_to_cohort(self.course_fixture, self.student_name, self.manual_cohort_id)

        # create a second student user
        self.other_student_name, self.other_student_email = self._generate_unique_user_data()
        self.other_student_id = AutoAuthPage(
            self.browser, username=self.other_student_name, email=self.other_student_email,
            course_id=self.course_id, staff=False
        ).visit().get_user_id()

        # login as an instructor
        self.instructor_name, self.instructor_email = self._generate_unique_user_data()
        self.instructor_id = AutoAuthPage(
            self.browser, username=self.instructor_name, email=self.instructor_email,
            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)
        self.instructor_dashboard_page.visit()
        self.cohort_management_page = self.instructor_dashboard_page.select_cohort_management()
Exemple #27
0
    def _delete_section(self, index):
        """ Delete a section at index `index` """

        # Logout and login as staff
        LogoutPage(self.browser).visit()
        AutoAuthPage(
            self.browser, username=self.USERNAME, email=self.EMAIL, course_id=self.course_id, staff=True
        ).visit()

        # Visit course outline page in studio.
        self.studio_course_outline_page.visit()
        self.studio_course_outline_page.wait_for_page()

        self.studio_course_outline_page.section_at(index).delete()

        # Logout and login as a student.
        LogoutPage(self.browser).visit()
        AutoAuthPage(self.browser, username=self.USERNAME, email=self.EMAIL, course_id=self.course_id).visit()

        # Visit courseware as a student.
        self.courseware_page.visit()
        self.courseware_page.wait_for_page()
Exemple #28
0
    def setup_test(self, num_chapters=2):
        """
        Setup test settings.

        Arguments:
            num_chapters: number of chapters to create in course
        """
        self.create_course_fixture(num_chapters)

        # Auto-auth register for the course.
        AutoAuthPage(self.browser, username=self.USERNAME, email=self.EMAIL, course_id=self.course_id).visit()

        self.courseware_page.visit()
 def login_and_verify_visible_problems(username,
                                       email,
                                       expected_problems,
                                       track=None):
     AutoAuthPage(self.browser,
                  username=username,
                  email=email,
                  course_id=self.course_id).visit()
     if track is not None:
         enroll_user_track(self.browser, self.course_id, track)
     courseware_page.visit()
     verify_expected_problem_visibility(self, courseware_page,
                                        expected_problems)
Exemple #30
0
    def test_bookmark_shows_updated_breadcrumb_after_publish(self):
        """
        Scenario: A bookmark breadcrumb trail is updated after publishing the changed display name.

        Given that I am a registered user
        And I visit my courseware page
        And I can see bookmarked unit
        Then I visit unit page in studio
        Then I change unit display_name
        And I publish the changes
        Then I visit my bookmarks page
        When I see the bookmark
        Then I can see the breadcrumb trail has the updated display_name.
        """
        self.setup_test(num_chapters=1)
        self.bookmark_units(num_units=1)

        self.bookmarks_page.visit()
        self._verify_breadcrumbs(num_units=1)

        LogoutPage(self.browser).visit()
        AutoAuthPage(self.browser,
                     username=self.USERNAME,
                     email=self.EMAIL,
                     course_id=self.course_id,
                     staff=True).visit()

        modified_name = "Updated name"
        self.update_and_publish_block_display_name(modified_name)

        LogoutPage(self.browser).visit()
        AutoAuthPage(self.browser,
                     username=self.USERNAME,
                     email=self.EMAIL,
                     course_id=self.course_id).visit()

        self.bookmarks_page.visit()
        self._verify_breadcrumbs(num_units=1, modified_name=modified_name)