def test_translation_upload_remove_upload(self):
     """
     Scenario: Upload "zh" file "A" -> Remove "zh" -> Upload "zh" file "B"
     Given I have created a Video component
     And I edit the component
     And I open tab "Advanced"
     And I upload transcript file "chinese_transcripts.srt" for "zh" language code
     And I see translations for "zh"
     Then I remove translation for "zh" language code
     And I upload transcript file "uk_transcripts.srt" for "zh" language code
     And I save changes
     Then when I view the video it does show the captions
     And I see "Привіт, edX вітає вас." text in the captions
     """
     self._create_video_component()
     self.edit_component()
     self.open_advanced_tab()
     self.video.upload_translation('chinese_transcripts.srt', 'zh')
     self.assertEqual(self.video.translations(), ['zh'])
     self.video.remove_translation('zh')
     confirm_prompt(self.video)
     self.video.upload_translation('uk_transcripts.srt', 'zh')
     self.save_unit_settings()
     self.assertTrue(self.video.is_captions_visible())
     unicode_text = "Привіт, edX вітає вас.".decode('utf-8')
     self.assertIn(unicode_text, self.video.captions_text)
Example #2
0
 def discard_changes(self):
     """
     Discards draft changes (which will then re-render the page).
     """
     click_css(self, 'a.action-discard', 0, require_notification=False)
     confirm_prompt(self)
     self.wait_for_ajax()
Example #3
0
 def click_delete_button(self, xblock_id, confirm=True):
     """
     Click on the delete button for the given XBlock
     """
     self._action_btn_for_xblock_id(xblock_id, "delete").click()
     if confirm:
         confirm_prompt(self)  # this will also sync_on_notification()
         self.wait_for_ajax()
Example #4
0
 def delete(self, source_index):
     """
     Delete the item with index source_index (based on vertical placement in page).
     Only visible items are counted in the source_index.
     The index of the first item is 0.
     """
     # Click the delete button
     click_css(self, 'a.delete-button', source_index, require_notification=False)
     # Click the confirmation dialog button
     confirm_prompt(self)
 def test_translations_remove_works_w_saving(self):
     """
     Scenario: Translations removing works correctly w/ preliminary saving
     Given I have created a Video component
     And I edit the component
     And I open tab "Advanced"
     And I upload transcript files:
       |lang_code|filename               |
       |uk       |uk_transcripts.srt     |
       |zh       |chinese_transcripts.srt|
     And I save changes
     Then when I view the video it does show the captions
     And I see "Привіт, edX вітає вас." text in the captions
     And video language menu has "uk, zh" translations
     And I edit the component
     And I open tab "Advanced"
     And I see translations for "uk, zh"
     Then I remove translation for "uk" language code
     And I save changes
     Then when I view the video it does show the captions
     And I see "好 各位同学" text in the captions
     And I edit the component
     And I open tab "Advanced"
     And I see translations for "zh"
     Then I remove translation for "zh" language code
     And I save changes
     Then when I view the video it does not show the captions
     """
     self._create_video_component()
     self.edit_component()
     self.open_advanced_tab()
     self.video.upload_translation('uk_transcripts.srt', 'uk')
     self.video.upload_translation('chinese_transcripts.srt', 'zh')
     self.save_unit_settings()
     self.assertTrue(self.video.is_captions_visible())
     unicode_text = "Привіт, edX вітає вас.".decode('utf-8')
     self.assertIn(unicode_text, self.video.captions_text)
     self.assertEqual(self.video.caption_languages.keys(), ['zh', 'uk'])
     self.edit_component()
     self.open_advanced_tab()
     self.assertEqual(self.video.translations(), ['zh', 'uk'])
     self.video.remove_translation('uk')
     confirm_prompt(self.video)
     self.save_unit_settings()
     self.assertTrue(self.video.is_captions_visible())
     unicode_text = "好 各位同学".decode('utf-8')
     self.assertIn(unicode_text, self.video.captions_text)
     self.edit_component()
     self.open_advanced_tab()
     self.assertEqual(self.video.translations(), ['zh'])
     self.video.remove_translation('zh')
     confirm_prompt(self.video)
     self.save_unit_settings()
     self.assertFalse(self.video.is_captions_visible())
Example #6
0
    def click_leave_team_link(self, remaining_members=0, cancel=False):
        """ Click on Leave Team link"""
        self.q(css='.leave-team-link').first.click()
        confirm_prompt(self, cancel, require_notification=False)

        if cancel is False:
            self.wait_for(
                lambda: self.join_team_button_present,
                description="Join Team button did not become present"
            )
            self.wait_for_capacity_text(remaining_members)
Example #7
0
    def click_leave_team_link(self, remaining_members=0, cancel=False):
        """ Click on Leave Team link"""
        leave_team_css = '.leave-team-link'
        self.wait_for_element_visibility(leave_team_css, 'Leave Team link is visible.')
        click_css(self, leave_team_css, require_notification=False)
        confirm_prompt(self, cancel, require_notification=False)

        if cancel is False:
            self.wait_for(
                lambda: self.join_team_button_present,
                description="Join Team button did not become present"
            )
            self.wait_for_capacity_text(remaining_members)
Example #8
0
    def toggle_staff_lock(self, inherits_staff_lock=False):
        """
        Toggles "hide from students" which enables or disables a staff-only lock.

        Returns True if the lock is now enabled, else False.
        """
        was_locked_initially = self.is_staff_locked
        if not was_locked_initially:
            self.q(css='a.action-staff-lock').first.click()
        else:
            click_css(self, 'a.action-staff-lock', 0, require_notification=False)
            if not inherits_staff_lock:
                confirm_prompt(self)
        self.wait_for_ajax()
        return not was_locked_initially
 def test_translations_remove_works_wo_saving(self):
     """
     Scenario: Translations removing works correctly w/o preliminary saving
     Given I have created a Video component
     And I edit the component
     And I open tab "Advanced"
     And I upload transcript file "uk_transcripts.srt" for "uk" language code
     And I see translations for "uk"
     Then I remove translation for "uk" language code
     And I save changes
     Then when I view the video it does not show the captions
     """
     self._create_video_component()
     self.edit_component()
     self.open_advanced_tab()
     self.video.upload_translation('uk_transcripts.srt', 'uk')
     self.assertEqual(self.video.translations(), ['uk'])
     self.video.remove_translation('uk')
     confirm_prompt(self.video)
     self.save_unit_settings()
     self.assertFalse(self.video.is_captions_visible())
Example #10
0
 def confirm_delete_membership_dialog(self):
     """Click 'delete' on the warning dialog."""
     confirm_prompt(self, require_notification=False)
     self.wait_for_ajax()
Example #11
0
 def delete_static_tab(self):
     """
     Deletes a static page
     """
     click_css(self, '.btn-default.delete-button.action-button', require_notification=False)
     confirm_prompt(self)
Example #12
0
 def delete(self):
     """
     Delete the group configuration.
     """
     self.find_css('.actions .delete').first.click()
     confirm_prompt(self.page)
Example #13
0
 def cancel_delete_membership_dialog(self):
     """Click 'delete' on the warning dialog."""
     confirm_prompt(self, cancel=True)
Example #14
0
 def confirm_delete_membership_dialog(self):
     """Click 'delete' on the warning dialog."""
     confirm_prompt(self, require_notification=False)
     self.wait_for_ajax()
Example #15
0
 def cancel_delete_membership_dialog(self):
     """Click 'delete' on the warning dialog."""
     confirm_prompt(self, cancel=True)
Example #16
0
 def delete(self, cancel=False):
     """
     Clicks the delete button, then cancels at the confirmation prompt if cancel is True.
     """
     click_css(self, self._bounded_selector(".delete-button"), require_notification=False)
     confirm_prompt(self, cancel)
Example #17
0
 def click_delete_update_button(self):
     """
     Clicks the delete update post button and confirms the delete notification.
     """
     click_css(self, '.post-preview .delete-button', require_notification=False)
     confirm_prompt(self)
 def click_delete_update_button(self):
     """
     Clicks the delete update post button and confirms the delete notification.
     """
     click_css(self, '.post-preview .delete-button', require_notification=False)
     confirm_prompt(self)
Example #19
0
 def delete(self, cancel=False):
     """
     Clicks the delete button, then cancels at the confirmation prompt if cancel is True.
     """
     click_css(self, self._bounded_selector('.delete-button'), require_notification=False)
     confirm_prompt(self, cancel)
 def delete(self):
     """
     Delete the group configuration.
     """
     self.find_css('.actions .delete').first.click()
     confirm_prompt(self.page)