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.io/projects/open-edx-building-and-running-a-course/' \ 'en/open-release-ficus.master/course_assets/pages.html' # Assert that help link is correct. assert_nav_help_link( test=self, page=self.course_pages_page, href=href )
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.io/projects/open-edx-building-and-running-a-course/' \ '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 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 be correct """ expected_url = _get_expected_documentation_url( '/course_assets/pages.html') # Assert that help link is correct. assert_nav_help_link( test=self, page=self.course_pages_page, href=expected_url, )
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 be correct """ expected_url = _get_expected_documentation_url('/course_assets/pages.html') # Assert that help link is correct. assert_nav_help_link( test=self, page=self.course_pages_page, href=expected_url, )
class PagesTest(StudioCourseTest): """ Test that Pages functionality is working properly on studio side """ def setUp(self, is_staff=True): # pylint: disable=arguments-differ """ Install a course with no content using a fixture. """ super(PagesTest, self).setUp(is_staff) self.pages_page = PagesPage( self.browser, self.course_info['org'], self.course_info['number'], self.course_info['run'] ) self.pages_page.visit() def test_user_can_add_static_tab(self): """ Scenario: Users can add static pages Given I have opened the pages page in a new course Then I should not see any static pages When I add a new static page Then I should see a static page named "Empty" """ self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page for a newly created course' ) self.pages_page.add_static_page() self.assertTrue( self.pages_page.is_static_page_present(), 'Static tab should be present on the page' ) def test_user_can_delete_static_tab(self): """ Scenario: Users can delete static pages Given I have created a static page When I "delete" the static page Then I am shown a prompt When I confirm the prompt Then I should not see any static pages """ self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page for a newly created course' ) self.pages_page.add_static_page() self.pages_page.delete_static_tab() self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page after the deletion' ) def test_user_can_edit_static_tab(self): """ Scenario: Users can edit static pages Given I have created a static page When I "edit" the static page And I change the name to "New" Then I should see static page named "New" """ self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page for a newly created course' ) self.pages_page.add_static_page() self.assertNotEqual(self.pages_page.static_tab_titles[0], "New") self.pages_page.click_edit_static_page() self.pages_page.open_settings_tab() self.pages_page.set_field_val("Display Name", "New") self.pages_page.save() self.assertEqual(self.pages_page.static_tab_titles[0], "New", "The title of the tab is not updated") def test_user_can_reorder_static_tabs(self): """ Scenario: Users can reorder static pages Given I have created two different static pages When I drag the first static page to the last Then the static pages are switched And I reload the page Then the static pages are switched """ self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page for a newly created course' ) self.pages_page.add_static_page() self.pages_page.click_edit_static_page() self.pages_page.set_field_val("Display Name", "First") self.pages_page.save() self.pages_page.add_static_page() self.pages_page.drag_and_drop_first_static_page_to_last() self.pages_page.refresh_and_wait_for_load() static_tab_titles = self.pages_page.static_tab_titles self.assertEqual( static_tab_titles, ['Empty', 'First'], 'Order should be:["Empty", "First] but getting {} from the page'.format(static_tab_titles) )
class PagesTest(StudioCourseTest): """ Test that Pages functionality is working properly on studio side """ shard = 23 def setUp(self, is_staff=True): # pylint: disable=arguments-differ """ Install a course with no content using a fixture. """ super(PagesTest, self).setUp(is_staff) self.pages_page = PagesPage( self.browser, self.course_info['org'], self.course_info['number'], self.course_info['run'] ) self.pages_page.visit() def test_user_can_add_static_tab(self): """ Scenario: Users can add static pages Given I have opened the pages page in a new course Then I should not see any static pages When I add a new static page Then I should see a static page named "Empty" """ self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page for a newly created course' ) self.pages_page.add_static_page() self.assertTrue( self.pages_page.is_static_page_present(), 'Static tab should be present on the page' ) def test_user_can_delete_static_tab(self): """ Scenario: Users can delete static pages Given I have created a static page When I "delete" the static page Then I am shown a prompt When I confirm the prompt Then I should not see any static pages """ self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page for a newly created course' ) self.pages_page.add_static_page() self.pages_page.delete_static_tab() self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page after the deletion' ) def test_user_can_edit_static_tab(self): """ Scenario: Users can edit static pages Given I have created a static page When I "edit" the static page And I change the name to "New" Then I should see static page named "New" """ self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page for a newly created course' ) self.pages_page.add_static_page() self.assertNotEqual(self.pages_page.static_tab_titles[0], "New") self.pages_page.click_edit_static_page() self.pages_page.open_settings_tab() self.pages_page.set_field_val("Display Name", "New") self.pages_page.save() self.assertEqual(self.pages_page.static_tab_titles[0], "New", "The title of the tab is not updated") def test_user_can_reorder_static_tabs(self): """ Scenario: Users can reorder static pages Given I have created two different static pages When I drag the first static page to the last Then the static pages are switched And I reload the page Then the static pages are switched """ self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page for a newly created course' ) self.pages_page.add_static_page() self.pages_page.click_edit_static_page() self.pages_page.set_field_val("Display Name", "First") self.pages_page.save() self.pages_page.add_static_page() self.pages_page.drag_and_drop() self.pages_page.refresh_and_wait_for_load() static_tab_titles = self.pages_page.static_tab_titles self.assertEqual( static_tab_titles, ['Empty', 'First'], u'Order should be:["Empty", "First] but getting {} from the page'.format(static_tab_titles) ) def test_user_can_reorder_builtin_tabs(self): """ Scenario: Users can reorder built-in pages Given I have opened the pages page in a new course Then the built-in pages are in the default order When I drag the first page to the last Then the built-in pages are switched And I reload the page Then the built-in pages are switched """ default_order = ['Home', 'Course', 'Discussion', 'Wiki', 'Progress'] new_order = ['Home', 'Course', 'Wiki', 'Progress', 'Discussion'] self.assertEqual( self.pages_page.built_in_page_titles, default_order, 'Tabs are not in the default order' ) self.pages_page.drag_and_drop(default_tab=True) built_in_page_titles = self.pages_page.built_in_page_titles self.assertEqual( built_in_page_titles, new_order, 'Tabs are not in the new order' ) self.pages_page.refresh_and_wait_for_load() self.assertEqual( built_in_page_titles, new_order, 'Tabs are not in the new order' ) def test_users_can_toggle_visibility(self): """ Scenario: Users can toggle visibility on hideable pages Given I have opened the pages page in a new course Then I should see the "wiki" page as "visible" When I toggle the visibility of the "wiki" page Then I should see the "wiki" page as "hidden" And I reload the page Then I should see the "wiki" page as "hidden" When I toggle the visibility of the "wiki" page Then I should see the "wiki" page as "visible" And I reload the page Then I should see the "wiki" page as "visible" """ tab = 'wiki' self.assertTrue(self.pages_page.is_tab_visible(tab)) self.pages_page.toggle_tab(tab) self.assertFalse(self.pages_page.is_tab_visible(tab)) self.pages_page.refresh_and_wait_for_load() self.assertFalse(self.pages_page.is_tab_visible(tab)) self.pages_page.toggle_tab(tab) self.assertTrue(self.pages_page.is_tab_visible(tab)) self.pages_page.refresh_and_wait_for_load() self.assertTrue(self.pages_page.is_tab_visible(tab)) def test_default_order_with_static_pages(self): """ Scenario: Users can reorder built-in pages amongst static pages Given I have created two different static pages Then the pages are in the default order """ expected_order = ['Home', 'Course', 'Discussion', 'Wiki', 'Progress', 'First', 'Empty'] self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page for a newly created course' ) self.pages_page.add_static_page() self.pages_page.click_edit_static_page() self.pages_page.set_field_val("Display Name", "First") self.pages_page.save() self.pages_page.add_static_page() tab_names = self.pages_page.built_in_page_titles + self.pages_page.static_tab_titles self.assertEqual(tab_names, expected_order)
class PagesTest(StudioCourseTest): """ Test that Pages functionality is working properly on studio side """ shard = 23 def setUp(self, is_staff=True): # pylint: disable=arguments-differ """ Install a course with no content using a fixture. """ super(PagesTest, self).setUp(is_staff) self.pages_page = PagesPage( self.browser, self.course_info['org'], self.course_info['number'], self.course_info['run'] ) self.pages_page.visit() def test_user_can_add_static_tab(self): """ Scenario: Users can add static pages Given I have opened the pages page in a new course Then I should not see any static pages When I add a new static page Then I should see a static page named "Empty" """ self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page for a newly created course' ) self.pages_page.add_static_page() self.assertTrue( self.pages_page.is_static_page_present(), 'Static tab should be present on the page' ) def test_user_can_delete_static_tab(self): """ Scenario: Users can delete static pages Given I have created a static page When I "delete" the static page Then I am shown a prompt When I confirm the prompt Then I should not see any static pages """ self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page for a newly created course' ) self.pages_page.add_static_page() self.pages_page.delete_static_tab() self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page after the deletion' ) def test_user_can_edit_static_tab(self): """ Scenario: Users can edit static pages Given I have created a static page When I "edit" the static page And I change the name to "New" Then I should see static page named "New" """ self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page for a newly created course' ) self.pages_page.add_static_page() self.assertNotEqual(self.pages_page.static_tab_titles[0], "New") self.pages_page.click_edit_static_page() self.pages_page.open_settings_tab() self.pages_page.set_field_val("Display Name", "New") self.pages_page.save() self.assertEqual(self.pages_page.static_tab_titles[0], "New", "The title of the tab is not updated") def test_user_can_reorder_static_tabs(self): """ Scenario: Users can reorder static pages Given I have created two different static pages When I drag the first static page to the last Then the static pages are switched And I reload the page Then the static pages are switched """ self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page for a newly created course' ) self.pages_page.add_static_page() self.pages_page.click_edit_static_page() self.pages_page.set_field_val("Display Name", "First") self.pages_page.save() self.pages_page.add_static_page() self.pages_page.drag_and_drop() self.pages_page.refresh_and_wait_for_load() static_tab_titles = self.pages_page.static_tab_titles self.assertEqual( static_tab_titles, ['Empty', 'First'], u'Order should be:["Empty", "First] but getting {} from the page'.format(static_tab_titles) ) def test_users_can_toggle_visibility(self): """ Scenario: Users can toggle visibility on hideable pages Given I have opened the pages page in a new course Then I should see the "wiki" page as "visible" When I toggle the visibility of the "wiki" page Then I should see the "wiki" page as "hidden" And I reload the page Then I should see the "wiki" page as "hidden" When I toggle the visibility of the "wiki" page Then I should see the "wiki" page as "visible" And I reload the page Then I should see the "wiki" page as "visible" """ tab = 'wiki' self.assertTrue(self.pages_page.is_tab_visible(tab)) self.pages_page.toggle_tab(tab) self.assertFalse(self.pages_page.is_tab_visible(tab)) self.pages_page.refresh_and_wait_for_load() self.assertFalse(self.pages_page.is_tab_visible(tab)) self.pages_page.toggle_tab(tab) self.assertTrue(self.pages_page.is_tab_visible(tab)) self.pages_page.refresh_and_wait_for_load() self.assertTrue(self.pages_page.is_tab_visible(tab)) def test_default_order_with_static_pages(self): """ Scenario: Users can reorder built-in pages amongst static pages Given I have created two different static pages Then the pages are in the default order """ expected_order = ['Home', 'Course', 'Discussion', 'Wiki', 'Progress', 'First', 'Empty'] self.assertFalse( self.pages_page.is_static_page_present(), 'Static tab should not be present on the page for a newly created course' ) self.pages_page.add_static_page() self.pages_page.click_edit_static_page() self.pages_page.set_field_val("Display Name", "First") self.pages_page.save() self.pages_page.add_static_page() tab_names = self.pages_page.built_in_page_titles + self.pages_page.static_tab_titles self.assertEqual(tab_names, expected_order)