Example #1
0
class LibraryTabHelpTest(AcceptanceTest):
    """
    Test help links on the library tab present at dashboard.
    """
    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()

    def test_library_tab_nav_help(self):
        """
        Scenario: Help link in navigation bar is working on 'Home'(Courses tab) page.
        Given that I am on the 'Home'(Courses tab) page.
        And I want help about the process
        And I click the 'Help' in the navigation bar
        Then Help link should open.
        And help url should be correct
        """
        self.assertTrue(self.dashboard_page.has_new_library_button)
        click_css(self.dashboard_page, '#course-index-tabs .libraries-tab', 0, False)
        expected_url = _get_expected_documentation_url('/get_started.html')

        # Assert that help link is correct.
        assert_nav_help_link(
            test=self,
            page=self.dashboard_page,
            href=expected_url
        )
Example #2
0
 def setUp(self):
     super(NewProgramHelpTest, self).setUp()
     self.auth_page = AutoAuthPage(self.browser, staff=True)
     self.program_page = DashboardPageWithPrograms(self.browser)
     self.auth_page.visit()
     self.set_programs_api_configuration(True)
     self.program_page.visit()
    def setUp(self):
        """
        Create a unique identifier for the course used in this test.
        """
        # Ensure that the superclass sets up
        super(XBlockAcidBase, self).setUp()

        # Define a unique course identifier
        self.course_info = {
            'org': 'test_org',
            'number': 'course_' + self.unique_id[:5],
            'run': 'test_' + self.unique_id,
            'display_name': 'Test Course ' + self.unique_id
        }

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

        self.course_id = '{org}.{number}.{run}'.format(**self.course_info)

        self.setup_fixtures()

        self.auth_page = AutoAuthPage(self.browser,
                                      staff=False,
                                      username=self.user.get('username'),
                                      email=self.user.get('email'),
                                      password=self.user.get('password'))
        self.auth_page.visit()
class NewProgramHelpTest(ProgramsConfigMixin, AcceptanceTest):
    """
    Test help links on a 'New Program' page
    """
    def setUp(self):
        super(NewProgramHelpTest, self).setUp()
        self.auth_page = AutoAuthPage(self.browser, staff=True)
        self.program_page = DashboardPageWithPrograms(self.browser)
        self.auth_page.visit()
        self.set_programs_api_configuration(True)
        self.program_page.visit()

    def test_program_create_nav_help(self):
        """
        Scenario: Help link in navigation bar is working on 'New Program' page
        Given that I am on the 'New Program' page
        And I want help about the process
        And I click the 'Help' in the navigation bar
        Then Help link should open.
        And help url should end with 'index.html'
        """
        self.program_page.click_new_program_button()
        href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' \
               '/en/open-release-ficus.master/index.html'

        # Assert that help link is correct.
        assert_nav_help_link(
            test=self,
            page=self.program_page,
            href=href,
        )
class LibraryTabHelpTest(AcceptanceTest):
    """
    Test help links on the library tab present at dashboard.
    """
    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()

    @skip(
        "Disabled as edx.org help links are now different than Open edX (@catong can advise)"
    )
    def test_library_tab_nav_help(self):
        """
        Scenario: Help link in navigation bar is working on 'Home'(Courses tab) page.
        Given that I am on the 'Home'(Courses tab) page.
        And I want help about the process
        And I click the 'Help' in the navigation bar
        Then Help link should open.
        And help url should be correct
        """
        self.assertTrue(self.dashboard_page.has_new_library_button)
        click_css(self.dashboard_page, '#course-index-tabs .libraries-tab', 0,
                  False)
        expected_url = _get_expected_documentation_url('/get_started.html')

        # Assert that help link is correct.
        assert_nav_help_link(test=self,
                             page=self.dashboard_page,
                             href=expected_url)
class LibraryTabHelpTest(AcceptanceTest):
    """
    Test help links on the library tab present at dashboard.
    """
    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()

    def test_library_tab_nav_help(self):
        """
        Scenario: Help link in navigation bar is working on 'Home'(Courses tab) page.
        Given that I am on the 'Home'(Courses tab) page.
        And I want help about the process
        And I click the 'Help' in the navigation bar
        Then Help link should open.
        And help url should end with 'getting_started/get_started.html'
        """
        self.assertTrue(self.dashboard_page.has_new_library_button)
        click_css(self.dashboard_page, '#course-index-tabs .libraries-tab', 0, False)
        # The href we want to see in anchor help element.
        href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \
               'en/open-release-ficus.master/getting_started/get_started.html'

        # Assert that help link is correct.
        assert_nav_help_link(
            test=self,
            page=self.dashboard_page,
            href=href
        )
Example #7
0
class LibraryTabHelpTest(AcceptanceTest):
    """
    Test help links on the library tab present at dashboard.
    """
    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()

    def test_library_tab_nav_help(self):
        """
        Scenario: Help link in navigation bar is working on 'Home'(Courses tab) page.
        Given that I am on the 'Home'(Courses tab) page.
        And I want help about the process
        And I click the 'Help' in the navigation bar
        Then Help link should open.
        And help url should end with 'getting_started/get_started.html'
        """
        self.assertTrue(self.dashboard_page.has_new_library_button)
        click_css(self.dashboard_page, '#course-index-tabs .libraries-tab', 0,
                  False)
        # The href we want to see in anchor help element.
        href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \
               'en/latest/getting_started/get_started.html'

        # Assert that help link is correct.
        assert_nav_help_link(test=self, page=self.dashboard_page, href=href)
Example #8
0
class NewProgramHelpTest(ProgramsConfigMixin, AcceptanceTest):
    """
    Test help links on a 'New Program' page
    """
    def setUp(self):
        super(NewProgramHelpTest, self).setUp()
        self.auth_page = AutoAuthPage(self.browser, staff=True)
        self.program_page = DashboardPageWithPrograms(self.browser)
        self.auth_page.visit()
        self.set_programs_api_configuration(True)
        self.program_page.visit()

    def test_program_create_nav_help(self):
        """
        Scenario: Help link in navigation bar is working on 'New Program' page
        Given that I am on the 'New Program' page
        And I want help about the process
        And I click the 'Help' in the navigation bar
        Then Help link should open.
        And help url should end with 'index.html'
        """
        self.program_page.click_new_program_button()
        href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course' \
               '/en/latest/index.html'

        # Assert that help link is correct.
        assert_nav_help_link(
            test=self,
            page=self.program_page,
            href=href,
        )
Example #9
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 learner 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.audit_text, self.everyone_text])

        # Masquerade as learner 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.audit_text, self.everyone_text])
Example #10
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)
Example #11
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()
Example #12
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 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()
class NewLibraryHelpTest(AcceptanceTest):
    """
    Test help links while creating a new library
    """

    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 test_library_create_nav_help(self):
        """
        Scenario: Help link in navigation bar is working on 'Create a New Library' page in the dashboard.
        Given that I am on the 'Create a New Library' page in the dashboard.
        And I want help about the process
        And I click the 'Help' in the navigation bar
        Then Help link should open.
        And help url should end with 'getting_started/get_started.html'
        """
        # The href we want to see in anchor help element.
        href = (
            "http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/"
            "en/latest/getting_started/get_started.html"
        )

        # Assert that help link is correct.
        assert_nav_help_link(test=self, page=self.dashboard_page, href=href)

    def test_library_create_side_bar_help(self):
        """
        Scenario: Help link in sidebar links is working on 'Create a New Library' page in the dashboard.
        Given that I am on the 'Create a New Library' page in the dashboard.
        And I want help about the process
        And I click the 'Getting Started with edX Studio' in the sidebar links
        Then Help link should open.
        And help url should end with 'getting_started/get_started.html'
        """
        # The href we want to see in anchor help element.
        href = (
            "http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/"
            "en/latest/getting_started/get_started.html"
        )

        # Assert that help link is correct.
        assert_side_bar_help_link(
            test=self,
            page=self.dashboard_page,
            href=href,
            help_text="Getting Started with edX Studio",
            as_list_item=True,
        )
Example #15
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"
class NewLibraryHelpTest(AcceptanceTest):
    """
    Test help links while creating a new library
    """
    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()

    @skip(
        "Disabled as edx.org help links are now different than Open edX (@catong can advise)"
    )
    def test_library_create_nav_help(self):
        """
        Scenario: Help link in navigation bar is working on 'Create a New Library' page in the dashboard.
        Given that I am on the 'Create a New Library' page in the dashboard.
        And I want help about the process
        And I click the 'Help' in the navigation bar
        Then Help link should open.
        And help url should be correct
        """
        expected_url = _get_expected_documentation_url('/get_started.html')

        # Assert that help link is correct.
        assert_nav_help_link(test=self,
                             page=self.dashboard_page,
                             href=expected_url)

    @skip(
        "Disabled as edx.org help links are now different than Open edX (@catong can advise)"
    )
    def test_library_create_side_bar_help(self):
        """
        Scenario: Help link in sidebar links is working on 'Create a New Library' page in the dashboard.
        Given that I am on the 'Create a New Library' page in the dashboard.
        And I want help about the process
        And I click the 'Getting Started with edX Studio' in the sidebar links
        Then Help link should open.
        And help url should be correct
        """
        expected_url = _get_expected_documentation_url('/get_started.html')

        # Assert that help link is correct.
        assert_side_bar_help_link(test=self,
                                  page=self.dashboard_page,
                                  href=expected_url,
                                  help_text='Getting Started with edX Studio',
                                  as_list_item=True)
 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()
Example #19
0
class NewLibraryHelpTest(AcceptanceTest):
    """
    Test help links while creating a new library
    """
    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 test_library_create_nav_help(self):
        """
        Scenario: Help link in navigation bar is working on 'Create a New Library' page in the dashboard.
        Given that I am on the 'Create a New Library' page in the dashboard.
        And I want help about the process
        And I click the 'Help' in the navigation bar
        Then Help link should open.
        And help url should be correct
        """
        expected_url = _get_expected_documentation_url('/get_started.html')

        # Assert that help link is correct.
        assert_nav_help_link(
            test=self,
            page=self.dashboard_page,
            href=expected_url
        )

    def test_library_create_side_bar_help(self):
        """
        Scenario: Help link in sidebar links is working on 'Create a New Library' page in the dashboard.
        Given that I am on the 'Create a New Library' page in the dashboard.
        And I want help about the process
        And I click the 'Getting Started with edX Studio' in the sidebar links
        Then Help link should open.
        And help url should be correct
        """
        expected_url = _get_expected_documentation_url('/get_started.html')

        # Assert that help link is correct.
        assert_side_bar_help_link(
            test=self,
            page=self.dashboard_page,
            href=expected_url,
            help_text='Getting Started with edX Studio',
            as_list_item=True
        )
Example #20
0
class CreateLibraryTest(WebAppTest):
    """
    Test that we can create a new content library on the studio home page.
    """
    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)

    @flaky  # TODO: SOL-430
    def test_create_library(self):
        """
        From the home page:
            Click "New Library"
            Fill out the form
            Submit the form
            We should be redirected to the edit view for the library
            Return to the home page
            The newly created library should now appear in the list of libraries
        """
        unique_suffix = uuid4().hex[:4]
        name = "New Library Name " + unique_suffix
        org = "TestOrgX" + unique_suffix
        number = "TESTLIB_" + unique_suffix

        self.auth_page.visit()
        self.dashboard_page.visit()
        self.assertFalse(
            self.dashboard_page.has_library(name=name, org=org, number=number))
        self.assertTrue(self.dashboard_page.has_new_library_button())

        self.dashboard_page.click_new_library()
        self.assertTrue(self.dashboard_page.is_new_library_form_visible())
        self.dashboard_page.fill_new_library_form(name, org, number)
        self.assertTrue(self.dashboard_page.is_new_library_form_valid())
        self.dashboard_page.submit_new_library_form()

        # The next page is the library edit view; make sure it loads:
        lib_page = LibraryEditPage(self.browser, LibraryLocator(org, number))
        lib_page.wait_for_page()

        # Then go back to the home page and make sure the new library is listed there:
        self.dashboard_page.visit()
        self.assertTrue(
            self.dashboard_page.has_library(name=name, org=org, number=number))
class NewLibraryHelpTest(AcceptanceTest):
    """
    Test help links while creating a new library
    """
    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 test_library_create_nav_help(self):
        """
        Scenario: Help link in navigation bar is working on 'Create a New Library' page in the dashboard.
        Given that I am on the 'Create a New Library' page in the dashboard.
        And I want help about the process
        And I click the 'Help' in the navigation bar
        Then Help link should open.
        And help url should end with 'getting_started/get_started.html'
        """
        # The href we want to see in anchor help element.
        href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \
               'en/open-release-ficus.master/getting_started/get_started.html'

        # Assert that help link is correct.
        assert_nav_help_link(test=self, page=self.dashboard_page, href=href)

    def test_library_create_side_bar_help(self):
        """
        Scenario: Help link in sidebar links is working on 'Create a New Library' page in the dashboard.
        Given that I am on the 'Create a New Library' page in the dashboard.
        And I want help about the process
        And I click the 'Getting Started with Edraak Studio' in the sidebar links
        Then Help link should open.
        And help url should end with 'getting_started/get_started.html'
        """
        # The href we want to see in anchor help element.
        href = 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/' \
               'en/open-release-ficus.master/getting_started/get_started.html'

        # Assert that help link is correct.
        assert_side_bar_help_link(
            test=self,
            page=self.dashboard_page,
            href=href,
            help_text='Getting Started with Edraak Studio',
            as_list_item=True)
class CreateLibraryTest(WebAppTest):
    """
    Test that we can create a new content library on the studio home page.
    """

    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)

    @flaky  # TODO: SOL-430
    def test_create_library(self):
        """
        From the home page:
            Click "New Library"
            Fill out the form
            Submit the form
            We should be redirected to the edit view for the library
            Return to the home page
            The newly created library should now appear in the list of libraries
        """
        unique_suffix = uuid4().hex[:4]
        name = "New Library Name " + unique_suffix
        org = "TestOrgX" + unique_suffix
        number = "TESTLIB_" + unique_suffix

        self.auth_page.visit()
        self.dashboard_page.visit()
        self.assertFalse(self.dashboard_page.has_library(name=name, org=org, number=number))
        self.assertTrue(self.dashboard_page.has_new_library_button())

        self.dashboard_page.click_new_library()
        self.assertTrue(self.dashboard_page.is_new_library_form_visible())
        self.dashboard_page.fill_new_library_form(name, org, number)
        self.assertTrue(self.dashboard_page.is_new_library_form_valid())
        self.dashboard_page.submit_new_library_form()

        # The next page is the library edit view; make sure it loads:
        lib_page = LibraryEditPage(self.browser, LibraryLocator(org, number))
        lib_page.wait_for_page()

        # Then go back to the home page and make sure the new library is listed there:
        self.dashboard_page.visit()
        self.assertTrue(self.dashboard_page.has_library(name=name, org=org, number=number))
class NewCourseHelpTest(AcceptanceTest):
    """
    Test help links while creating a new course.
    """
    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 test_course_create_nav_help(self):
        """
        Scenario: Help link in navigation bar is working on 'Create a New Course' page in the dashboard.
        Given that I am on the 'Create a New Course' page in the dashboard.
        And I want help about the process
        And I click the 'Help' in the navigation bar
        Then Help link should open.
        And help url should be correct
        """
        expected_url = _get_expected_documentation_url(
            '/getting_started/CA_get_started_Studio.html')

        # Assert that help link is correct.
        assert_nav_help_link(test=self,
                             page=self.dashboard_page,
                             href=expected_url)

    def test_course_create_side_bar_help(self):
        """
        Scenario: Help link in sidebar links is working on 'Create a New Course' page in the dashboard.
        Given that I am on the 'Create a New Course' page in the dashboard.
        And I want help about the process
        And I click the 'Getting Started with edX Studio' in the sidebar links
        Then Help link should open.
        And help url should be correct
        """
        expected_url = _get_expected_documentation_url(
            '/getting_started/CA_get_started_Studio.html')

        # Assert that help link is correct.
        assert_side_bar_help_link(test=self,
                                  page=self.dashboard_page,
                                  href=expected_url,
                                  help_text='Getting Started with edX Studio',
                                  as_list_item=True)
    def setUp(self):
        super(ProblemStateOnNavigationTest, self).setUp()

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

        # Install a course with section, tabs and multiple choice problems.
        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(
                                      self.create_multiple_choice_problem(
                                          self.problem1_name),
                                      self.create_multiple_choice_problem(
                                          self.problem2_name),
                                  ), ), ).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.problem_page = ProblemPage(self.browser)
Example #25
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(NewProgramHelpTest, self).setUp()
     self.auth_page = AutoAuthPage(self.browser, staff=True)
     self.program_page = DashboardPageWithPrograms(self.browser)
     self.auth_page.visit()
     self.set_programs_api_configuration(True)
     self.program_page.visit()
Example #27
0
    def setUp(self):
        super(ProblemsTest, self).setUp()

        self.username = "******".format(uuid=self.unique_id[0:8])
        self.email = "{username}@example.com".format(username=self.username)
        self.password = "******"

        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'])

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

        # Auto-auth register for the course.
        AutoAuthPage(self.browser,
                     username=self.username,
                     email=self.email,
                     password=self.password,
                     course_id=self.course_id,
                     staff=True).visit()
Example #28
0
 def _auto_auth(self, username, email, staff):
     """
     Logout and login with given credentials.
     """
     LogoutPage(self.browser).visit()
     AutoAuthPage(self.browser, username=username, email=email,
                  staff=staff).visit()
    def _install_course_fixture(self):
        """
        Prepare for tests by creating a course with a section, subsection, and unit.
        Performs the following:
            Create a course with a section, subsection, and unit
            Create a user and make that user a course author
            Log the user into studio
        """
        if self.assets:
            self.course_fixture.add_asset(self.assets)

        # Create course with Video component
        self.course_fixture.add_children(
            XBlockFixtureDesc('chapter', 'Test Section').add_children(
                XBlockFixtureDesc('sequential', 'Test Subsection').add_children(
                    XBlockFixtureDesc('vertical', 'Test Unit').add_children(
                        XBlockFixtureDesc('video', 'Video')
                    )
                )
            )
        ).install()

        # Auto login and register the course
        AutoAuthPage(
            self.browser,
            staff=False,
            username=self.course_fixture.user.get('username'),
            email=self.course_fixture.user.get('email'),
            password=self.course_fixture.user.get('password')
        ).visit()
Example #30
0
 def _auto_auth(self, username, email, staff):
     """
     Logout and login with given credentials.
     """
     self.logout_page.visit()
     AutoAuthPage(self.browser, username=username, email=email,
                  course_id=self.course_id, staff=staff).visit()
    def setUp(self):
        """
        Create a unique identifier for the course used in this test.
        """
        # Ensure that the superclass sets up
        super(XBlockAcidBase, self).setUp()

        # Define a unique course identifier
        self.course_info = {
            'org': 'test_org',
            'number': 'course_' + self.unique_id[:5],
            'run': 'test_' + self.unique_id,
            'display_name': 'Test Course ' + self.unique_id
        }

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

        self.course_id = '{org}.{number}.{run}'.format(**self.course_info)

        self.setup_fixtures()

        self.auth_page = AutoAuthPage(
            self.browser,
            staff=False,
            username=self.user.get('username'),
            email=self.user.get('email'),
            password=self.user.get('password')
        )
        self.auth_page.visit()
    def setUp(self):
        """
        Create a unique identifier for the course used in this test.
        """
        # Ensure that the superclass sets up
        super(XBlockAcidBase, self).setUp()

        # Define a unique course identifier
        self.course_info = {
            "org": "test_org",
            "number": "course_" + self.unique_id[:5],
            "run": "test_" + self.unique_id,
            "display_name": "Test Course " + self.unique_id,
        }

        self.outline = CourseOutlinePage(
            self.browser, self.course_info["org"], self.course_info["number"], self.course_info["run"]
        )

        self.course_id = "{org}.{number}.{run}".format(**self.course_info)

        self.setup_fixtures()

        self.auth_page = AutoAuthPage(
            self.browser,
            staff=False,
            username=self.user.get("username"),
            email=self.user.get("email"),
            password=self.user.get("password"),
        )
        self.auth_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()
Example #34
0
class LoggedInPagesTest(AcceptanceTest):
    """
    Verify the pages in Studio that you can get to when logged in and do not have a course yet.
    """
    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)

    def test_logged_in_no_courses(self):
        """
        Make sure that you can get to the dashboard and home pages without a course.
        """
        self.auth_page.visit()
        self.dashboard_page.visit()
        self.home_page.visit()
    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 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()
    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()
class LoggedInPagesTest(WebAppTest):
    """
    Verify the pages in Studio that you can get to when logged in and do not have a course yet.
    """
    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)

    def test_logged_in_no_courses(self):
        """
        Make sure that you can get to the dashboard and home pages without a course.
        """
        self.auth_page.visit()
        self.dashboard_page.visit()
        self.home_page.visit()
Example #40
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()
Example #41
0
def auto_auth(browser, username, email, staff, course_id):
    """
    Logout and login with given credentials.
    """
    AutoAuthPage(browser,
                 username=username,
                 email=email,
                 course_id=course_id,
                 staff=staff).visit()
 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()
    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
Example #46
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
    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()
class XBlockAcidBase(AcceptanceTest):
    """
    Base class for tests that verify that XBlock integration is working correctly
    """

    __test__ = False

    def setUp(self):
        """
        Create a unique identifier for the course used in this test.
        """
        # Ensure that the superclass sets up
        super(XBlockAcidBase, self).setUp()

        # Define a unique course identifier
        self.course_info = {
            "org": "test_org",
            "number": "course_" + self.unique_id[:5],
            "run": "test_" + self.unique_id,
            "display_name": "Test Course " + self.unique_id,
        }

        self.outline = CourseOutlinePage(
            self.browser, self.course_info["org"], self.course_info["number"], self.course_info["run"]
        )

        self.course_id = "{org}.{number}.{run}".format(**self.course_info)

        self.setup_fixtures()

        self.auth_page = AutoAuthPage(
            self.browser,
            staff=False,
            username=self.user.get("username"),
            email=self.user.get("email"),
            password=self.user.get("password"),
        )
        self.auth_page.visit()

    def validate_acid_block_preview(self, acid_block):
        """
        Validate the Acid Block's preview
        """
        self.assertTrue(acid_block.init_fn_passed)
        self.assertTrue(acid_block.resource_url_passed)
        self.assertTrue(acid_block.scope_passed("user_state"))
        self.assertTrue(acid_block.scope_passed("user_state_summary"))
        self.assertTrue(acid_block.scope_passed("preferences"))
        self.assertTrue(acid_block.scope_passed("user_info"))

    def test_acid_block_preview(self):
        """
        Verify that all expected acid block tests pass in studio preview
        """

        self.outline.visit()
        subsection = self.outline.section("Test Section").subsection("Test Subsection")
        unit = subsection.expand_subsection().unit("Test Unit").go_to()

        acid_block = AcidView(self.browser, unit.xblocks[0].preview_selector)
        self.validate_acid_block_preview(acid_block)

    def test_acid_block_editor(self):
        """
        Verify that all expected acid block tests pass in studio editor
        """

        self.outline.visit()
        subsection = self.outline.section("Test Section").subsection("Test Subsection")
        unit = subsection.expand_subsection().unit("Test Unit").go_to()

        acid_block = AcidView(self.browser, unit.xblocks[0].edit().editor_selector)
        self.assertTrue(acid_block.init_fn_passed)
        self.assertTrue(acid_block.resource_url_passed)
 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()
class XBlockAcidBase(WebAppTest):
    """
    Base class for tests that verify that XBlock integration is working correctly
    """
    __test__ = False

    def setUp(self):
        """
        Create a unique identifier for the course used in this test.
        """
        # Ensure that the superclass sets up
        super(XBlockAcidBase, self).setUp()

        # Define a unique course identifier
        self.course_info = {
            'org': 'test_org',
            'number': 'course_' + self.unique_id[:5],
            'run': 'test_' + self.unique_id,
            'display_name': 'Test Course ' + self.unique_id
        }

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

        self.course_id = '{org}.{number}.{run}'.format(**self.course_info)

        self.setup_fixtures()

        self.auth_page = AutoAuthPage(
            self.browser,
            staff=False,
            username=self.user.get('username'),
            email=self.user.get('email'),
            password=self.user.get('password')
        )
        self.auth_page.visit()

    def validate_acid_block_preview(self, acid_block):
        """
        Validate the Acid Block's preview
        """
        self.assertTrue(acid_block.init_fn_passed)
        self.assertTrue(acid_block.resource_url_passed)
        self.assertTrue(acid_block.scope_passed('user_state'))
        self.assertTrue(acid_block.scope_passed('user_state_summary'))
        self.assertTrue(acid_block.scope_passed('preferences'))
        self.assertTrue(acid_block.scope_passed('user_info'))

    def test_acid_block_preview(self):
        """
        Verify that all expected acid block tests pass in studio preview
        """

        self.outline.visit()
        subsection = self.outline.section('Test Section').subsection('Test Subsection')
        unit = subsection.expand_subsection().unit('Test Unit').go_to()

        acid_block = AcidView(self.browser, unit.xblocks[0].preview_selector)
        self.validate_acid_block_preview(acid_block)

    def test_acid_block_editor(self):
        """
        Verify that all expected acid block tests pass in studio editor
        """

        self.outline.visit()
        subsection = self.outline.section('Test Section').subsection('Test Subsection')
        unit = subsection.expand_subsection().unit('Test Unit').go_to()

        acid_block = AcidView(self.browser, unit.xblocks[0].edit().editor_selector)
        self.assertTrue(acid_block.init_fn_passed)
        self.assertTrue(acid_block.resource_url_passed)
 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)
class StudioCourseTest(UniqueCourseTest):
    """
    Base class for all Studio course tests.
    """

    def setUp(self, is_staff=False, test_xss=True):  # pylint: disable=arguments-differ
        """
        Install a course with no content using a fixture.
        """
        super(StudioCourseTest, self).setUp()
        self.test_xss = test_xss
        self.install_course_fixture(is_staff)

    def install_course_fixture(self, is_staff=False):
        """
        Install a course fixture
        """
        self.course_fixture = CourseFixture(
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run'],
            self.course_info['display_name'],
        )
        if self.test_xss:
            xss_injected_unique_id = XSS_INJECTION + self.unique_id
            test_improper_escaping = {u"value": xss_injected_unique_id}
            self.course_fixture.add_advanced_settings({
                "advertised_start": test_improper_escaping,
                "info_sidebar_name": test_improper_escaping,
                "cert_name_short": test_improper_escaping,
                "cert_name_long": test_improper_escaping,
                "display_organization": test_improper_escaping,
                "display_coursenumber": test_improper_escaping,
            })
            self.course_info['display_organization'] = xss_injected_unique_id
            self.course_info['display_coursenumber'] = xss_injected_unique_id
        self.populate_course_fixture(self.course_fixture)
        self.course_fixture.install()
        self.user = self.course_fixture.user
        self.log_in(self.user, is_staff)

    def populate_course_fixture(self, course_fixture):
        """
        Populate the children of the test course fixture.
        """
        pass

    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(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()
class CreateCourseTest(WebAppTest):
    """
    Test that we can create a new course the studio home page.
    """

    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 test_create_course_with_non_existing_org(self):
        """
        Scenario: Ensure that the course creation with non existing org display proper error message.
        Given I have filled course creation form with a non existing and all required fields
        When I click 'Create' button
        Form validation should pass
        Then I see the error message explaining reason for failure to create course
        """

        self.auth_page.visit()
        self.dashboard_page.visit()
        self.assertFalse(self.dashboard_page.has_course(
            org='testOrg', number=self.course_number, run=self.course_run
        ))
        self.assertTrue(self.dashboard_page.new_course_button.present)

        self.dashboard_page.click_new_course_button()
        self.assertTrue(self.dashboard_page.is_new_course_form_visible())
        self.dashboard_page.fill_new_course_form(
            self.course_name, 'testOrg', self.course_number, self.course_run
        )
        self.assertTrue(self.dashboard_page.is_new_course_form_valid())
        self.dashboard_page.submit_new_course_form()
        self.assertTrue(self.dashboard_page.error_notification.present)
        self.assertIn(
            u'Organization you selected does not exist in the system', self.dashboard_page.error_notification_message
        )

    def test_create_course_with_existing_org(self):
        """
        Scenario: Ensure that the course creation with an existing org should be successful.
        Given I have filled course creation form with an existing org and all required fields
        When I click 'Create' button
        Form validation should pass
        Then I see the course listing page with newly created course
        """

        self.auth_page.visit()
        self.dashboard_page.visit()
        self.assertFalse(self.dashboard_page.has_course(
            org=self.course_org, number=self.course_number, run=self.course_run
        ))
        self.assertTrue(self.dashboard_page.new_course_button.present)

        self.dashboard_page.click_new_course_button()
        self.assertTrue(self.dashboard_page.is_new_course_form_visible())
        self.dashboard_page.fill_new_course_form(
            self.course_name, self.course_org, self.course_number, self.course_run
        )
        self.assertTrue(self.dashboard_page.is_new_course_form_valid())
        self.dashboard_page.submit_new_course_form()

        # Successful creation of course takes user to course outline page
        course_outline_page = CourseOutlinePage(
            self.browser,
            self.course_org,
            self.course_number,
            self.course_run
        )
        course_outline_page.visit()
        course_outline_page.wait_for_page()

        # Go back to dashboard and verify newly created course exists there
        self.dashboard_page.visit()
        self.assertTrue(self.dashboard_page.has_course(
            org=self.course_org, number=self.course_number, run=self.course_run
        ))

    def test_create_course_with_existing_org_via_autocomplete(self):
        """
        Scenario: Ensure that the course creation with an existing org should be successful.
        Given I have filled course creation form with an existing org and all required fields
        And I selected `Course Organization` input via autocomplete
        When I click 'Create' button
        Form validation should pass
        Then I see the course listing page with newly created course
        """

        self.auth_page.visit()
        self.dashboard_page.visit()
        new_org = 'orgX2'
        self.assertFalse(self.dashboard_page.has_course(
            org=new_org, number=self.course_number, run=self.course_run
        ))
        self.assertTrue(self.dashboard_page.new_course_button.present)

        self.dashboard_page.click_new_course_button()
        self.assertTrue(self.dashboard_page.is_new_course_form_visible())
        self.dashboard_page.fill_new_course_form(
            self.course_name, '', self.course_number, self.course_run
        )
        self.dashboard_page.course_org_field.fill('org')
        self.dashboard_page.select_item_in_autocomplete_widget(new_org)
        self.assertTrue(self.dashboard_page.is_new_course_form_valid())
        self.dashboard_page.submit_new_course_form()

        # Successful creation of course takes user to course outline page
        course_outline_page = CourseOutlinePage(
            self.browser,
            new_org,
            self.course_number,
            self.course_run
        )
        course_outline_page.visit()
        course_outline_page.wait_for_page()

        # Go back to dashboard and verify newly created course exists there
        self.dashboard_page.visit()
        self.assertTrue(self.dashboard_page.has_course(
            org=new_org, number=self.course_number, run=self.course_run
        ))
class DashboardProgramsTabTest(ProgramsConfigMixin, CatalogConfigMixin, AcceptanceTest):
    """
    Test the programs tab on the studio home page.
    """

    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 stub_programs_api(self):
        """Stub out the programs API with fake data."""
        self.set_programs_api_configuration(is_enabled=True)
        ProgramsFixture().install_programs([])

    def stub_catalog_api(self):
        """Stub out the catalog API's program endpoint."""
        self.set_catalog_configuration(is_enabled=True)
        CatalogFixture().install_programs([])

    def test_tab_is_disabled(self):
        """
        The programs tab and "new program" button should not appear at all
        unless enabled via the config model.
        """
        self.set_programs_api_configuration()
        self.dashboard_page.visit()
        self.assertFalse(self.dashboard_page.is_programs_tab_present())
        self.assertFalse(self.dashboard_page.is_new_program_button_present())

    def test_tab_is_enabled_with_empty_list(self):
        """
        The programs tab and "new program" button should appear when enabled
        via config.  When the programs list is empty, a button should appear
        that allows creating a new program.
        """
        self.dashboard_page.visit()
        self.assertTrue(self.dashboard_page.is_programs_tab_present())
        self.assertTrue(self.dashboard_page.is_new_program_button_present())
        results = self.dashboard_page.get_program_list()
        self.assertEqual(results, [])
        self.assertTrue(self.dashboard_page.is_empty_list_create_button_present())

    def test_tab_is_enabled_with_nonempty_list(self):
        """
        The programs tab and "new program" button should appear when enabled
        via config, and the results of the program list should display when
        the list is nonempty.
        """
        test_program_values = [('first program', 'org1'), ('second program', 'org2')]

        programs = [
            factories.Program(
                name=name,
                organizations=[
                    factories.Organization(key=org),
                ],
                course_codes=[
                    factories.CourseCode(run_modes=[
                        factories.RunMode(),
                    ]),
                ]
            )
            for name, org in test_program_values
        ]

        ProgramsFixture().install_programs(programs)

        self.dashboard_page.visit()

        self.assertTrue(self.dashboard_page.is_programs_tab_present())
        self.assertTrue(self.dashboard_page.is_new_program_button_present())
        self.assertFalse(self.dashboard_page.is_empty_list_create_button_present())

        results = self.dashboard_page.get_program_list()
        self.assertEqual(results, test_program_values)

    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())