diff --git a/common/test/acceptance/pages/studio/container.py b/common/test/acceptance/pages/studio/container.py index 7c524a650a..403e823135 100644 --- a/common/test/acceptance/pages/studio/container.py +++ b/common/test/acceptance/pages/studio/container.py @@ -5,13 +5,14 @@ Container page in Studio from bok_choy.page_object import PageObject from bok_choy.promise import Promise, EmptyPromise from common.test.acceptance.pages.studio import BASE_URL +from common.test.acceptance.pages.studio.utils import HelpMixin from common.test.acceptance.pages.common.utils import click_css, confirm_prompt from common.test.acceptance.pages.studio.utils import type_in_codemirror -class ContainerPage(PageObject): +class ContainerPage(PageObject, HelpMixin): """ Container page in Studio """ diff --git a/common/test/acceptance/pages/studio/course_page.py b/common/test/acceptance/pages/studio/course_page.py index 9d42054c29..a03c0355c4 100644 --- a/common/test/acceptance/pages/studio/course_page.py +++ b/common/test/acceptance/pages/studio/course_page.py @@ -1,14 +1,15 @@ """ Base class for pages specific to a course in Studio. """ - +from abc import abstractmethod import os from opaque_keys.edx.locator import CourseLocator from bok_choy.page_object import PageObject from common.test.acceptance.pages.studio import BASE_URL +from common.test.acceptance.pages.studio.utils import HelpMixin -class CoursePage(PageObject): +class CoursePage(PageObject, HelpMixin): """ Abstract base class for page objects specific to a course in Studio. """ @@ -17,6 +18,15 @@ class CoursePage(PageObject): # Does not need to include the leading forward or trailing slash url_path = "" + @abstractmethod + def is_browser_on_page(self): + """ + Verifies browser is on the correct page. + + Should be implemented in child classes. + """ + pass + def __init__(self, browser, course_org, course_num, course_run): """ Initialize the page object for the course located at diff --git a/common/test/acceptance/pages/studio/index.py b/common/test/acceptance/pages/studio/index.py index a7eac88493..bb378971ef 100644 --- a/common/test/acceptance/pages/studio/index.py +++ b/common/test/acceptance/pages/studio/index.py @@ -31,7 +31,7 @@ class HeaderMixin(object): return next_page.wait_for_page() -class IndexPage(PageObject, HeaderMixin): +class IndexPage(PageObject, HeaderMixin, HelpMixin): """ Home page for Studio when not logged in. """ @@ -322,3 +322,11 @@ class DashboardPageWithPrograms(DashboardPage): element.find_element_by_css_selector('.course-org .value').text, # org key ) return self.q(css='div.programs-tab li.course-item').map(div2info).results + + def click_new_program_button(self): + """ + Click on the new program button. + """ + self.q(css='.button.new-button.new-program-button').click() + self.wait_for_ajax() + self.wait_for_element_visibility(".account-username", "New program page is open") diff --git a/common/test/acceptance/pages/studio/users.py b/common/test/acceptance/pages/studio/users.py index 0f1e5f4359..29c237b282 100644 --- a/common/test/acceptance/pages/studio/users.py +++ b/common/test/acceptance/pages/studio/users.py @@ -1,6 +1,8 @@ """ Page classes to test either the Course Team page or the Library Team page. """ +import os +from opaque_keys.edx.locator import CourseLocator from bok_choy.promise import EmptyPromise from bok_choy.page_object import PageObject from common.test.acceptance.tests.helpers import disable_animations @@ -164,13 +166,27 @@ class LibraryUsersPage(UsersPageMixin, HelpMixin): return "{}/library/{}/team/".format(BASE_URL, unicode(self.locator)) -class CourseTeamPage(CoursePage, UsersPageMixin): +class CourseTeamPage(UsersPageMixin, CoursePage): """ Course Team page in Studio. """ - url_path = "course_team" + @property + def url(self): + """ + Construct a URL to the page within the course. + """ + # TODO - is there a better way to make this agnostic to the underlying default module store? + default_store = os.environ.get('DEFAULT_STORE', 'draft') + course_key = CourseLocator( + self.course_info['course_org'], + self.course_info['course_num'], + self.course_info['course_run'], + deprecated=(default_store == 'draft') + ) + return "/".join([BASE_URL, self.url_path, unicode(course_key)]) + class UserWrapper(PageObject): """ diff --git a/common/test/acceptance/pages/studio/utils.py b/common/test/acceptance/pages/studio/utils.py index b83b74daf2..e3d27753b7 100644 --- a/common/test/acceptance/pages/studio/utils.py +++ b/common/test/acceptance/pages/studio/utils.py @@ -12,7 +12,7 @@ from common.test.acceptance.pages.common.utils import click_css, wait_for_notifi NAV_HELP_NOT_SIGNED_IN_CSS = '.nav-item.nav-not-signedin-help a' NAV_HELP_CSS = '.nav-item.nav-account-help a' SIDE_BAR_HELP_AS_LIST_ITEM = '.bit li.action-item a' -SIDE_BAR_HELP_CSS = '.bit.external-help a' +SIDE_BAR_HELP_CSS = '.external-help a, .external-help-button' @js_defined('window.jQuery') @@ -282,10 +282,10 @@ class HelpMixin(object): else: element_css = NAV_HELP_NOT_SIGNED_IN_CSS - self.q(css=element_css).click() + self.q(css=element_css).first.click() return self.q(css=element_css).results[0] - def get_side_bar_help_element_and_click_help(self, as_list_item=False): + def get_side_bar_help_element_and_click_help(self, as_list_item=False, index=-1): """ Click on the help, and also get the DOM help element. @@ -294,6 +294,8 @@ class HelpMixin(object): Arguments: as_list_item (bool): Indicates whether help element is enclosed in a 'li' DOM element. + index (int): The index of element in case there are more than + one matching elements. Returns: WebElement: Help DOM element in the side bar. @@ -304,5 +306,5 @@ class HelpMixin(object): else: element_css = SIDE_BAR_HELP_CSS - self.q(css=element_css).click() - return self.q(css=element_css).results[0] + self.q(css=element_css).results[index].click() + return self.q(css=element_css).results[index] diff --git a/common/test/acceptance/tests/helpers.py b/common/test/acceptance/tests/helpers.py index f2e352ad67..a71ed7178c 100644 --- a/common/test/acceptance/tests/helpers.py +++ b/common/test/acceptance/tests/helpers.py @@ -839,7 +839,7 @@ def assert_nav_help_link(test, page, href, signed_in=True): assert_opened_help_link_is_correct(test, href) -def assert_side_bar_help_link(test, page, href, help_text, as_list_item=False): +def assert_side_bar_help_link(test, page, href, help_text, as_list_item=False, index=-1): """ Asserts that help link in side bar is correct. @@ -852,13 +852,15 @@ def assert_side_bar_help_link(test, page, href, help_text, as_list_item=False): href (str): The help link which we expect to see when it is opened. as_list_item (bool): Specifies whether help element is in one of the 'li' inside a sidebar list DOM element. + index (int): The index of element in case there are more than + one matching elements. """ expected_link = { 'href': href, 'text': help_text } # Get actual anchor help element from the page. - actual_link = page.get_side_bar_help_element_and_click_help(as_list_item) + actual_link = page.get_side_bar_help_element_and_click_help(as_list_item=as_list_item, index=index) # Assert that 'href' and text are the same as expected. assert_link(test, expected_link, actual_link) # Assert that opened link is correct diff --git a/common/test/acceptance/tests/studio/test_studio_help.py b/common/test/acceptance/tests/studio/test_studio_help.py index 8f3e79e163..c8a2236743 100644 --- a/common/test/acceptance/tests/studio/test_studio_help.py +++ b/common/test/acceptance/tests/studio/test_studio_help.py @@ -5,14 +5,28 @@ Test the Studio help links. from flaky import flaky from bok_choy.web_app_test import WebAppTest -from common.test.acceptance.tests.studio.base_studio_test import StudioCourseTest -from common.test.acceptance.pages.studio.index import DashboardPage +from common.test.acceptance.fixtures.course import XBlockFixtureDesc +from common.test.acceptance.tests.studio.base_studio_test import StudioCourseTest, ContainerBase +from common.test.acceptance.pages.studio.index import DashboardPage, DashboardPageWithPrograms from common.test.acceptance.pages.studio.utils import click_studio_help, studio_help_links from common.test.acceptance.pages.studio.index import IndexPage, HomePage from common.test.acceptance.tests.studio.base_studio_test import StudioLibraryTest +from common.test.acceptance.pages.studio.course_info import CourseUpdatesPage from common.test.acceptance.pages.studio.utils import click_css from common.test.acceptance.pages.studio.library import LibraryPage from common.test.acceptance.pages.studio.users import LibraryUsersPage +from common.test.acceptance.pages.studio.overview import CourseOutlinePage +from common.test.acceptance.pages.studio.asset_index import AssetIndexPage +from common.test.acceptance.pages.studio.edit_tabs import PagesPage +from common.test.acceptance.pages.studio.textbook_upload import TextbookUploadPage +from common.test.acceptance.pages.studio.settings import SettingsPage +from common.test.acceptance.pages.studio.settings_graders import GradingPage +from common.test.acceptance.pages.studio.settings_group_configurations import GroupConfigurationsPage +from common.test.acceptance.pages.studio.settings_advanced import AdvancedSettingsPage +from common.test.acceptance.pages.studio.settings_certificates import CertificatesPage +from common.test.acceptance.pages.studio.import_export import ExportCoursePage, ImportCoursePage +from common.test.acceptance.pages.studio.users import CourseTeamPage +from common.test.acceptance.fixtures.programs import ProgramsConfigMixin from common.test.acceptance.tests.helpers import ( assert_nav_help_link, assert_side_bar_help_link @@ -501,3 +515,754 @@ class LibraryExportHelpTest(StudioLibraryTest): href=href, help_text='Learn more about exporting a library' ) + + +class NewProgramHelpTest(ProgramsConfigMixin, WebAppTest): + """ + 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.org/projects/edx-partner-course-staff' \ + '/en/latest/index.html' + + # Assert that help link is correct. + assert_nav_help_link( + test=self, + page=self.program_page, + href=href, + ) + + +class CourseOutlineHelpTest(StudioCourseTest): + """ + Tests help links on course outline page. + """ + def setUp(self): # pylint: disable=arguments-differ + super(CourseOutlineHelpTest, self).setUp() + self.course_outline_page = CourseOutlinePage( + self.browser, + self.course_info['org'], + self.course_info['number'], + self.course_info['run'] + ) + self.course_outline_page.visit() + + # This scenario depends upon TNL-5460 + # def test_course_outline_nav_help(self): + # """ + # Scenario: Help link in navigation bar is working on Course Outline page + # Given that I am on the Course Outline 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 'developing_course/course_outline.html' + # """ + # href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff' \ + # '/en/latest/developing_course/course_outline.html' + # + # # Assert that help link is correct. + # assert_nav_help_link( + # test=self, + # page=self.course_outline_page, + # href=href + # ) + + def test_course_outline_side_bar_help(self): + """ + Scenario: Help link in sidebar links is working on Course Outline page + Given that I am on the Course Outline page. + And I want help about the process + And I click the 'Learn more about the course outline' in the sidebar links + Then Help link should open. + And help url should end with 'developing_course/course_outline.html' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff' \ + '/en/latest/developing_course/course_outline.html' + + # Assert that help link is correct. + assert_side_bar_help_link( + test=self, + page=self.course_outline_page, + href=href, + help_text='Learn more about the course outline', + index=0 + ) + + +class CourseUpdateHelpTest(StudioCourseTest): + """ + Test help links on Course Update page + """ + def setUp(self): # pylint: disable=arguments-differ + super(CourseUpdateHelpTest, self).setUp() + self.course_update_page = CourseUpdatesPage( + self.browser, + self.course_info['org'], + self.course_info['number'], + self.course_info['run'] + ) + self.course_update_page.visit() + + def test_course_update_nav_help(self): + """ + Scenario: Help link in navigation bar is working on 'Course Update' page + Given that I am on the 'Course Update' 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 'course_assets/handouts_updates.html' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/' \ + 'en/latest/course_assets/handouts_updates.html' + + # Assert that help link is correct. + assert_nav_help_link( + test=self, + page=self.course_update_page, + href=href + ) + + +class AssetIndexHelpTest(StudioCourseTest): + """ + Test help links on Course 'Files & Uploads' page + """ + def setUp(self): # pylint: disable=arguments-differ + super(AssetIndexHelpTest, self).setUp() + self.course_asset_index_page = AssetIndexPage( + self.browser, + self.course_info['org'], + self.course_info['number'], + self.course_info['run'] + ) + self.course_asset_index_page.visit() + + def test_asset_index_nav_help(self): + """ + Scenario: Help link in navigation bar is working on 'Files & Uploads' page + Given that I am on the 'Files & Uploads' 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 'course_assets/course_files.html' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/' \ + 'en/latest/course_assets/course_files.html' + + # Assert that help link is correct. + assert_nav_help_link( + test=self, + page=self.course_asset_index_page, + href=href + ) + + def test_asset_index_side_bar_help(self): + """ + Scenario: Help link in sidebar links is working on 'Files & Uploads' page + Given that I am on the 'Files & Uploads' page. + And I want help about the process + And I click the 'Learn more about managing files' in the sidebar links + Then Help link should open. + And help url should end with 'course_assets/course_files.html' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/' \ + 'en/latest/course_assets/course_files.html' + + # Assert that help link is correct. + assert_side_bar_help_link( + test=self, + page=self.course_asset_index_page, + href=href, + help_text='Learn more about managing files' + ) + + +class CoursePagesHelpTest(StudioCourseTest): + """ + Test help links on Course 'Pages' page + """ + def setUp(self): # pylint: disable=arguments-differ + super(CoursePagesHelpTest, self).setUp() + self.course_pages_page = PagesPage( + self.browser, + self.course_info['org'], + self.course_info['number'], + self.course_info['run'] + ) + self.course_pages_page.visit() + + def test_course_page_nav_help(self): + """ + Scenario: Help link in navigation bar is working on 'Pages' page + Given that I am on the 'Pages' 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 'course_assets/pages.html' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/' \ + 'en/latest/course_assets/pages.html' + + # Assert that help link is correct. + assert_nav_help_link( + test=self, + page=self.course_pages_page, + href=href + ) + + +class UploadTextbookHelpTest(StudioCourseTest): + """ + Test help links on Course 'Textbooks' page + """ + def setUp(self): # pylint: disable=arguments-differ + super(UploadTextbookHelpTest, self).setUp() + self.course_textbook_upload_page = TextbookUploadPage( + self.browser, + self.course_info['org'], + self.course_info['number'], + self.course_info['run'] + ) + self.course_textbook_upload_page.visit() + + def test_course_textbook_upload_nav_help(self): + """ + Scenario: Help link in navigation bar is working on 'Textbooks' page + Given that I am on the 'Textbooks' 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 'course_assets/textbooks.html' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff' \ + '/en/latest/course_assets/textbooks.html' + + # Assert that help link is correct. + assert_nav_help_link( + test=self, + page=self.course_textbook_upload_page, + href=href + ) + + def test_course_textbook_side_bar_help(self): + """ + Scenario: Help link in sidebar links is working on 'Textbooks' page + Given that I am on the 'Textbooks' page + And I want help about the process + And I click the 'Learn more about textbooks' in the sidebar links + Then Help link should open. + And help url should end with 'course_assets/textbooks.html' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff' \ + '/en/latest/course_assets/textbooks.html' + + # Assert that help link is correct. + assert_side_bar_help_link( + test=self, + page=self.course_textbook_upload_page, + href=href, + help_text='Learn more about textbooks' + ) + + +class StudioUnitHelpTest(ContainerBase): + """ + Tests help links on Unit page. + """ + def setUp(self, is_staff=True): + super(StudioUnitHelpTest, self).setUp(is_staff=is_staff) + + def populate_course_fixture(self, course_fixture): + course_fixture.add_advanced_settings( + {u"advanced_modules": {"value": ["split_test"]}} + ) + + course_fixture.add_children( + XBlockFixtureDesc('chapter', 'Test Section').add_children( + XBlockFixtureDesc('sequential', 'Test Subsection').add_children( + XBlockFixtureDesc('vertical', 'Test Unit') + ) + ) + ) + + def test_unit_page_nav_help(self): + """ + Scenario: Help link in navigation bar is working on Unit page. + Given that I am on the Unit 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 'developing_course/course_units.html' + """ + unit_page = self.go_to_unit_page() + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff' \ + '/en/latest/developing_course/course_units.html' + + # Assert that help link is correct. + assert_nav_help_link( + test=self, + page=unit_page, + href=href + ) + + +class SettingsHelpTest(StudioCourseTest): + """ + Tests help links on Schedule and Details Settings page + """ + def setUp(self, is_staff=False, test_xss=True): + super(SettingsHelpTest, self).setUp() + + self.settings_page = SettingsPage( + self.browser, + self.course_info['org'], + self.course_info['number'], + self.course_info['run'] + ) + + self.settings_page.visit() + + def test_settings_page_nav_help(self): + """ + Scenario: Help link in navigation bar is working on Settings page. + Given that I am on the Settings 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 'set_up_course/setting_up_student_view.html' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff' \ + '/en/latest/set_up_course/setting_up_student_view.html' + + # Assert that help link is correct. + assert_nav_help_link( + test=self, + page=self.settings_page, + href=href + ) + + +class GradingPageHelpTest(StudioCourseTest): + """ + Tests help links on Grading page + """ + def setUp(self, is_staff=False, test_xss=True): + super(GradingPageHelpTest, self).setUp() + + self.grading_page = GradingPage( + self.browser, + self.course_info['org'], + self.course_info['number'], + self.course_info['run'] + ) + + self.grading_page.visit() + + def test_grading_page_nav_help(self): + """ + Scenario: Help link in navigation bar is working on Grading page. + Given that I am on the Grading 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 'grading/index.html' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/' \ + 'en/latest/grading/index.html' + + # Assert that help link is correct. + assert_nav_help_link( + test=self, + page=self.grading_page, + href=href + ) + + +class CourseTeamSettingsHelpTest(StudioCourseTest): + """ + Tests help links on Course Team settings page + """ + def setUp(self, is_staff=False, test_xss=True): + super(CourseTeamSettingsHelpTest, self).setUp() + + self.course_team_settings_page = CourseTeamPage( + self.browser, + self.course_info['org'], + self.course_info['number'], + self.course_info['run'] + ) + + self.course_team_settings_page.visit() + + def test_course_course_team_nav_help(self): + """ + Scenario: Help link in navigation bar is working on Course Team settings page + Given that I am on the Course Team settings 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 'set_up_course/course_staffing.html#add-course-team-members' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/' \ + 'en/latest/set_up_course/course_staffing.html#add-course-team-members' + + # Assert that help link is correct. + assert_nav_help_link( + test=self, + page=self.course_team_settings_page, + href=href + ) + + +class CourseGroupConfigurationHelpTest(StudioCourseTest): + """ + Tests help links on course Group Configurations settings page + """ + def setUp(self, is_staff=False, test_xss=True): + super(CourseGroupConfigurationHelpTest, self).setUp() + + self.course_group_configuration_page = GroupConfigurationsPage( + self.browser, + self.course_info['org'], + self.course_info['number'], + self.course_info['run'] + ) + + self.course_group_configuration_page.visit() + + def test_course_group_conf_nav_help(self): + """ + Scenario: Help link in navigation bar is working on + Group Configurations settings page + Given that I am on the Group Configurations settings 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' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/' \ + 'en/latest/index.html' + + # Assert that help link is correct. + assert_nav_help_link( + test=self, + page=self.course_group_configuration_page, + href=href + ) + + def test_course_group_conf_content_group_side_bar_help(self): + """ + Scenario: Help link in side bar under the 'content group' is working + on Group Configurations settings page + Given that I am on the Group Configurations settings page + And I want help about the process + And I click the 'Learn More' in the sidebar links + Then Help link should open. + And help url should end with 'course_features/cohorts/cohorted_courseware.html' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/' \ + 'en/latest/course_features/cohorts/cohorted_courseware.html' + + # Assert that help link is correct. + assert_side_bar_help_link( + test=self, + page=self.course_group_configuration_page, + href=href, + help_text='Learn More' + ) + + +class AdvancedSettingHelpTest(StudioCourseTest): + """ + Tests help links on course Advanced Settings page. + """ + def setUp(self, is_staff=False, test_xss=True): + super(AdvancedSettingHelpTest, self).setUp() + + self.advanced_settings = AdvancedSettingsPage( + self.browser, + self.course_info['org'], + self.course_info['number'], + self.course_info['run'] + ) + + self.advanced_settings.visit() + + def test_advanced_settings_nav_help(self): + """ + Scenario: Help link in navigation bar is working on Advanced Settings page. + Given that I am on the Advanced Settings 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' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff' \ + '/en/latest/index.html' + + # Assert that help link is correct. + assert_nav_help_link( + test=self, + page=self.advanced_settings, + href=href + ) + + +class CertificatePageHelpTest(StudioCourseTest): + """ + Tests help links on course Certificate settings page. + """ + def setUp(self, is_staff=False, test_xss=True): + super(CertificatePageHelpTest, self).setUp() + + self.certificates_page = CertificatesPage( + self.browser, + self.course_info['org'], + self.course_info['number'], + self.course_info['run'] + ) + + self.certificates_page.visit() + + def test_certificate_page_nav_help(self): + """ + Scenario: Help link in navigation bar is working on Certificate settings page + Given that I am on the Certificate settings 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 'set_up_course/creating_course_certificates.html' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff' \ + '/en/latest/set_up_course/creating_course_certificates.html' + + # Assert that help link is correct. + assert_nav_help_link( + test=self, + page=self.certificates_page, + href=href + ) + + def test_certificate_page_side_bar_help(self): + """ + Scenario: Help link in side bar is working Certificate settings page + Given that I am on the Certificate settings page + And I want help about the process + And I click the 'Learn more about certificates' in the sidebar links + Then Help link should open. + And help url should end with 'set_up_course/creating_course_certificates.html' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff' \ + '/en/latest/set_up_course/creating_course_certificates.html' + + # Assert that help link is correct. + assert_side_bar_help_link( + test=self, + page=self.certificates_page, + href=href, + help_text='Learn more about certificates', + ) + + +class GroupExperimentConfigurationHelpTest(ContainerBase): + """ + Tests help links on course Group Configurations settings page + + It is related to Experiment Group Configurations on the page. + """ + def setUp(self): # pylint: disable=arguments-differ + super(GroupExperimentConfigurationHelpTest, self).setUp() + self.group_configuration_page = GroupConfigurationsPage( + self.browser, + self.course_info['org'], + self.course_info['number'], + self.course_info['run'] + ) + # self.create_poorly_configured_split_instance() + self.group_configuration_page.visit() + + def populate_course_fixture(self, course_fixture): + course_fixture.add_advanced_settings( + {u"advanced_modules": {"value": ["split_test"]}} + ) + + def test_course_group_configuration_experiment_side_bar_help(self): + """ + Scenario: Help link in side bar under the 'Experiment Group Configurations' + is working on Group Configurations settings page + Given that I am on the Group Configurations settings page + And I want help about the process + And I click the 'Learn More' in the sidebar links + Then Help link should open. + And help url should end with + 'content_experiments_configure.html#set-up-group-configurations-in-edx-studio' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/en/latest/course_features' \ + '/content_experiments/content_experiments_configure.html#set-up-group-configurations-in-edx-studio' + # Assert that help link is correct. + assert_side_bar_help_link( + test=self, + page=self.group_configuration_page, + href=href, + help_text='Learn More', + ) + + +class ToolsImportHelpTest(StudioCourseTest): + """ + Tests help links on tools import pages. + """ + def setUp(self, is_staff=False, test_xss=True): + + super(ToolsImportHelpTest, self).setUp() + + self.import_page = ImportCoursePage( + self.browser, + self.course_info['org'], + self.course_info['number'], + self.course_info['run'] + ) + self.import_page.visit() + + def test_tools_import_nav_help(self): + """ + Scenario: Help link in navigation bar is working on tools Library import page + Given that I am on the Library import tools 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 'releasing_course/export_import_course.html#import-a-course' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/en/' \ + 'latest/releasing_course/export_import_course.html#import-a-course' + + # Assert that help link is correct. + assert_nav_help_link( + test=self, + page=self.import_page, + href=href + ) + + def test_tools_import_side_bar_help(self): + """ + Scenario: Help link in side bar is working on tools Library import page + Given that I am on the tools Library import page + And I want help about the process + And I click the 'Learn more about importing a course' in the sidebar links + Then Help link should open. + And help url should end with 'releasing_course/export_import_course.html#import-a-course' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/en/' \ + 'latest/releasing_course/export_import_course.html#import-a-course' + + # Assert that help link is correct. + assert_side_bar_help_link( + test=self, + page=self.import_page, + href=href, + help_text='Learn more about importing a course', + ) + + +class ToolsExportHelpTest(StudioCourseTest): + """ + Tests help links on tools export pages. + """ + def setUp(self, is_staff=False, test_xss=True): + + super(ToolsExportHelpTest, self).setUp() + + self.export_page = ExportCoursePage( + self.browser, + self.course_info['org'], + self.course_info['number'], + self.course_info['run'] + ) + self.export_page.visit() + + def test_tools_import_nav_help(self): + """ + Scenario: Help link in navigation bar is working on tools Library export page + Given that I am on the Library export tools 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 'releasing_course/export_import_course.html#export-a-course' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/en/' \ + 'latest/releasing_course/export_import_course.html#export-a-course' + + # Assert that help link is correct. + assert_nav_help_link( + test=self, + page=self.export_page, + href=href + ) + + def test_tools_import_side_bar_help(self): + """ + Scenario: Help link in side bar is working on tools Library export page + Given that I am on the tools Library import page + And I want help about the process + And I click the 'Learn more about exporting a course' in the sidebar links + Then Help link should open. + And help url should end with 'releasing_course/export_import_course.html#export-a-course' + """ + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/en/' \ + 'latest/releasing_course/export_import_course.html#export-a-course' + + # Assert that help link is correct. + assert_side_bar_help_link( + test=self, + page=self.export_page, + href=href, + help_text='Learn more about exporting a course', + ) + + +class StudioWelcomeHelpTest(WebAppTest): + """ + Tests help link on 'Welcome' page ( User not logged in) + """ + def setUp(self): + super(StudioWelcomeHelpTest, self).setUp() + self.index_page = IndexPage(self.browser) + self.index_page.visit() + + def test_welcome_nav_help(self): + """ + Scenario: Help link in navigation bar is working on 'Welcome' page (User not logged in). + Given that I am on the 'Welcome' page. + And I want help about the edx + And I click the 'Help' in the navigation bar + Then Help link should open. + And help url should contain 'getting_started/get_started.html' + """ + # The url we want to see in anchor help element. + href = 'http://edx.readthedocs.org/projects/edx-partner-course-staff/' \ + 'en/latest/getting_started/get_started.html' + + # Assert that help link is correct. + assert_nav_help_link( + test=self, + page=self.index_page, + href=href, + signed_in=False + )