Esempio n. 1
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()
    def setUp(self):
        super(DashboardProgramsTabTest, self).setUp()
        self.stub_programs_api()
        self.stub_catalog_api()

        self.auth_page = AutoAuthPage(self.browser, staff=True)
        self.dashboard_page = DashboardPageWithPrograms(self.browser)
        self.auth_page.visit()
 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):
     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()
Esempio n. 5
0
    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)
 def test_tab_requires_staff(self):
     """
     The programs tab and "new program" button will not be available, even
     when enabled via config, if the user is not global staff.
     """
     AutoAuthPage(self.browser, staff=False).visit()
     self.dashboard_page.visit()
     self.assertFalse(self.dashboard_page.is_programs_tab_present())
     self.assertFalse(self.dashboard_page.is_new_program_button_present())
    def setUp(self):
        super(ConditionalTest, self).setUp()

        self.courseware_page = CoursewarePage(self.browser, self.course_id)
        AutoAuthPage(
            self.browser,
            course_id=self.course_id,
            staff=False
        ).visit()
Esempio n. 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()
Esempio n. 9
0
 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()
    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"
 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
Esempio n. 12
0
    def test_search(self):
        """
        Make sure that you can search courses.
        """

        search_string = "dashboard"
        html_content = "dashboard search"

        # Enroll student in courses A & B, but not C
        for course_info in [self.courses['A'], self.courses['B']]:
            course_key = generate_course_key(course_info['org'],
                                             course_info['number'],
                                             course_info['run'])
            AutoAuthPage(self.browser,
                         username=self.USERNAME,
                         email=self.EMAIL,
                         course_id=course_key).visit()

        # Create content in studio without publishing.
        self._auto_auth(self.STAFF_USERNAME, self.STAFF_EMAIL, True)
        self._studio_add_content(self.studio_course_outlines['A'],
                                 html_content)
        self._studio_add_content(self.studio_course_outlines['B'],
                                 html_content)
        self._studio_add_content(self.studio_course_outlines['C'],
                                 html_content)

        # Do a search, there should be no results shown.
        self._auto_auth(self.USERNAME, self.EMAIL, False)
        self.dashboard.visit()
        self.dashboard.search_for_term(search_string)
        assert search_string not in self.dashboard.search_results.html[0]

        # Publish in studio to trigger indexing.
        self._auto_auth(self.STAFF_USERNAME, self.STAFF_EMAIL, True)
        self._studio_publish_content(self.studio_course_outlines['A'])
        self._studio_publish_content(self.studio_course_outlines['B'])
        self._studio_publish_content(self.studio_course_outlines['C'])

        # Do the search again, this time we expect results from courses A & B, but not C
        self._auto_auth(self.USERNAME, self.EMAIL, False)
        self.dashboard.visit()

        self.dashboard.search_for_term(search_string)
        assert self.dashboard.search_results.html[0].count(search_string) == 2
        assert self.dashboard.search_results.html[0].count(
            self.courses['A']['display_name']) == 1
        assert self.dashboard.search_results.html[0].count(
            self.courses['B']['display_name']) == 1
Esempio n. 13
0
    def test_as_specific_student(self):
        student_a_username = '******'
        student_b_username = '******'
        AutoAuthPage(self.browser,
                     username=student_a_username,
                     course_id=self.course_id,
                     no_login=True).visit()
        AutoAuthPage(self.browser,
                     username=student_b_username,
                     course_id=self.course_id,
                     no_login=True).visit()
        self.create_cohorts_and_assign_students(student_a_username,
                                                student_b_username)

        # Masquerade as student in alpha cohort:
        course_page = self._goto_staff_page()
        course_page.set_staff_view_mode_specific_student(student_a_username)
        verify_expected_problem_visibility(
            self, course_page, [self.alpha_text, self.everyone_text])

        # Masquerade as student in beta cohort:
        course_page.set_staff_view_mode_specific_student(student_b_username)
        verify_expected_problem_visibility(
            self, course_page, [self.beta_text, self.everyone_text])
Esempio n. 14
0
    def log_in(self, user, is_staff=False):
        """
        Log in as the user that created the course. The user will be given instructor access
        to the course and enrolled in it. By default the user will not have staff access unless
        is_staff is passed as True.

        Args:
            user(dict): dictionary containing user data: {'username': ..., 'email': ..., 'password': ...}
            is_staff(bool): register this user as staff
        """
        self.auth_page = AutoAuthPage(self.browser,
                                      staff=is_staff,
                                      username=user.get('username'),
                                      email=user.get('email'),
                                      password=user.get('password'))
        self.auth_page.visit()
    def setUp(self):
        super(StaffViewTest, self).setUp()

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

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

        self.populate_course_fixture(self.course_fixture)  # pylint: disable=no-member

        self.course_fixture.install()

        # Auto-auth register for the course.
        # Do this as global staff so that you will see the Staff View
        AutoAuthPage(self.browser, username=self.USERNAME, email=self.EMAIL,
                     course_id=self.course_id, staff=True).visit()
Esempio n. 16
0
    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 xrange(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 xrange(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 xrange(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()
Esempio n. 17
0
    def setUp(self):
        super(EntranceExamTest, self).setUp()

        self.xqueue_grade_response = None

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

        # Install a course with a hierarchy and problems
        course_fixture = CourseFixture(self.course_info['org'],
                                       self.course_info['number'],
                                       self.course_info['run'],
                                       self.course_info['display_name'],
                                       settings={
                                           'entrance_exam_enabled': 'true',
                                           'entrance_exam_minimum_score_pct':
                                           '50'
                                       })

        problem = self.get_problem()
        course_fixture.add_children(
            XBlockFixtureDesc('chapter', 'Test Section').add_children(
                XBlockFixtureDesc(
                    'sequential',
                    'Test Subsection').add_children(problem))).install()

        entrance_exam_subsection = None
        outline = course_fixture.course_outline
        for child in outline['child_info']['children']:
            if child.get('display_name') == "Entrance Exam":
                entrance_exam_subsection = child['child_info']['children'][0]

        if entrance_exam_subsection:
            course_fixture.create_xblock(entrance_exam_subsection['id'],
                                         problem)

        # Auto-auth register for the course.
        AutoAuthPage(self.browser,
                     username=self.USERNAME,
                     email=self.EMAIL,
                     course_id=self.course_id,
                     staff=False).visit()
Esempio n. 18
0
    def setUp(self):
        super(CrowdsourcehinterProblemTest, self).setUp()

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

        # 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']
        )
        problem_data = dedent('''
            <problem>
                <p>A text input problem accepts a line of text from the student, and evaluates the input for correctness based on an expected answer.</p>
                <p>The answer is correct if it matches every character of the expected answer. This can be a problem with international spelling, dates, or anything where the format of the answer is not clear.</p>
                <p>Which US state has Lansing as its capital?</p>
                <stringresponse answer="Michigan" type="ci" >
                      <textline label="Which US state has Lansing as its capital?" size="20"/>
                </stringresponse>
                <solution>
                <div class="detailed-solution">
                <p>Explanation</p>
                <p>Lansing is the capital of Michigan, although it is not Michigan's largest city, or even the seat of the county in which it resides.</p>
                </div>
                </solution>
            </problem>
        ''')

        children = XBlockFixtureDesc('chapter', 'Test Section').add_children(
            XBlockFixtureDesc('sequential', 'Test Subsection').add_children(
                XBlockFixtureDesc('vertical', 'Test Unit').add_children(
                    XBlockFixtureDesc('problem', 'text input problem', data=problem_data),
                    XBlockFixtureDesc('crowdsourcehinter', 'test crowdsourcehinter')
                )
            )
        )

        course_fix.add_children(children).install()

        # Auto-auth register for the course.
        AutoAuthPage(self.browser, username=self.USERNAME, email=self.EMAIL,
                     course_id=self.course_id, staff=False).visit()
Esempio n. 19
0
    def setUp(self):
        super(CoursewareMultipleVerticalsTest, self).setUp()

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

        self.course_outline = CourseOutlinePage(self.browser,
                                                self.course_info['org'],
                                                self.course_info['number'],
                                                self.course_info['run'])

        # 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_children(
            XBlockFixtureDesc('chapter', 'Test Section 1').add_children(
                XBlockFixtureDesc(
                    'sequential', 'Test Subsection 1,1').add_children(
                        XBlockFixtureDesc(
                            'problem',
                            'Test Problem 1',
                            data='<problem>problem 1 dummy body</problem>'),
                        XBlockFixtureDesc(
                            'html',
                            'html 1',
                            data="<html>html 1 dummy body</html>"),
                        XBlockFixtureDesc(
                            'problem',
                            'Test Problem 2',
                            data="<problem>problem 2 dummy body</problem>"),
                        XBlockFixtureDesc(
                            'html',
                            'html 2',
                            data="<html>html 2 dummy body</html>"),
                    ),
                XBlockFixtureDesc(
                    'sequential', 'Test Subsection 1,2').add_children(
                        XBlockFixtureDesc(
                            'problem',
                            'Test Problem 3',
                            data='<problem>problem 3 dummy body</problem>'), ),
                XBlockFixtureDesc(
                    'sequential',
                    'Test HIDDEN Subsection',
                    metadata={
                        'visible_to_staff_only': True
                    }).add_children(
                        XBlockFixtureDesc(
                            'problem',
                            'Test HIDDEN Problem',
                            data='<problem>hidden problem</problem>'), ),
            ),
            XBlockFixtureDesc('chapter', 'Test Section 2').add_children(
                XBlockFixtureDesc(
                    'sequential', 'Test Subsection 2,1').add_children(
                        XBlockFixtureDesc(
                            'problem',
                            'Test Problem 4',
                            data='<problem>problem 4 dummy body</problem>'), ),
            ),
            XBlockFixtureDesc(
                'chapter',
                'Test HIDDEN Section',
                metadata={
                    'visible_to_staff_only': True
                }).add_children(
                    XBlockFixtureDesc('sequential',
                                      'Test HIDDEN Subsection'), ),
        ).install()

        # Auto-auth register for the course.
        AutoAuthPage(self.browser,
                     username=self.USERNAME,
                     email=self.EMAIL,
                     course_id=self.course_id,
                     staff=False).visit()
        self.courseware_page.visit()
        self.course_nav = CourseNavPage(self.browser)
Esempio n. 20
0
 def setUp(self):
     super(LoggedInPagesTest, self).setUp()
     self.auth_page = AutoAuthPage(self.browser, staff=True)
     self.dashboard_page = DashboardPage(self.browser)
     self.home_page = HomePage(self.browser)
Esempio n. 21
0
 def setUp(self):
     super(StudioLanguageTest, self).setUp()
     self.dashboard_page = DashboardPage(self.browser)
     self.account_settings = AccountSettingsPage(self.browser)
     AutoAuthPage(self.browser).visit()
Esempio n. 22
0
 def setUp(self):
     """
     Authenticate as staff so we can view and edit courses.
     """
     super(StudioPagePerformanceTest, self).setUp()
     AutoAuthPage(self.browser, staff=True).visit()
Esempio n. 23
0
 def setUp(self):
     super(LibraryTabHelpTest, self).setUp()
     self.auth_page = AutoAuthPage(self.browser, staff=True)
     self.dashboard_page = DashboardPage(self.browser)
     self.auth_page.visit()
     self.dashboard_page.visit()
Esempio n. 24
0
 def setUp(self):
     super(DashboardProgramsTabTest, self).setUp()
     ProgramsFixture().install_programs([])
     self.auth_page = AutoAuthPage(self.browser, staff=True)
     self.dashboard_page = DashboardPageWithPrograms(self.browser)
     self.auth_page.visit()