Exemple #1
0
    def test_edit(self):
        """Uploaded subtitles can be opened in the editor and saved.

        """
        video_language_pg = video_language_page.VideoLanguagePage(self)
        test_file = 'Untimed_text.srt'
        verification_file = os.path.join(self.subs_data_dir,
                                         'Untimed_lines.txt')
        expected_list = [
            line.strip()
            for line in codecs.open(verification_file, encoding='utf-8')
        ]

        sub_file = os.path.join(self.subs_data_dir, test_file)
        self.video_pg.upload_subtitles('English', sub_file)

        #Open the language page for the video and click Edit Subtitles
        video_language_pg.open_video_lang_page(self.test_video.video_id, 'en')
        video_language_pg.edit_subtitles()
        sub_editor = subtitle_editor.SubtitleEditor(self)
        sub_editor.continue_past_help()
        editor_sub_list = sub_editor.subtitles_list()

        #Verify uploaded subs are displayed in the Editor
        #self.assertEqual(expected_list, editor_sub_list)
        typed_subs = sub_editor.edit_subs()

        sub_editor.save_and_exit()
        video_language_pg.open_video_lang_page(self.test_video.video_id, 'en')
        displayed_list = video_language_pg.displayed_lines()
        #Verify the edited text is in the sub list
        self.assertIn("Under the sea", displayed_list)

        #Verify the origal unedited text is still present in the sub list.
        self.assertIn(expected_list[-1], displayed_list)
Exemple #2
0
    def setUpClass(cls):
        super(TestCaseSubmittable, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()

        cls.video_pg = video_page.VideoPage(cls)
        cls.video_language_pg = video_language_page.VideoLanguagePage(cls)

        cls.user = UserFactory.create(username='******')
        cls.create_modal = dialogs.CreateLanguageSelection(cls)
        cls.sub_editor = subtitle_editor.SubtitleEditor(cls)
        cls.unisubs_menu = unisubs_menu.UnisubsMenu(cls)
        td = {'url': ('http://qa.pculture.org/amara_tests/' 'Birds_short.mp4')}
        cls.test_video = cls.data_utils.create_video(**td)
        cls.video_pg.open_video_page(cls.test_video.video_id)
        cls.video_pg.log_in(cls.user.username, 'password')
        cls.video_pg.set_skiphowto()

        #Open the video page and sync the first 3 subs
        cls.video_pg.add_subtitles()
        cls.create_modal.create_original_subs('English', 'English')

        cls.logger.info('typing subs')
        cls.typed_subs = cls.sub_editor.type_subs()
        cls.sub_editor.continue_to_next_step()
        cls.logger.info('syncing subs')
        cls.sub_editor.sync_subs(len(cls.typed_subs) + 2)
        cls.timing_list = cls.sub_editor.sub_timings()
        cls.sub_editor.save_and_exit()
Exemple #3
0
    def setUp(self):
        super(TestCaseIncomplete, self).setUp()
        self.data_utils = data_helpers.DataHelpers()
        self.video_pg = video_page.VideoPage(self)
        self.user = UserFactory.create(username='******')
        self.create_modal = dialogs.CreateLanguageSelection(self)
        self.sub_editor = subtitle_editor.SubtitleEditor(self)
        self.unisubs_menu = unisubs_menu.UnisubsMenu(self)
        td = {
            'url': ('http://qa.pculture.org/amara_tests/'
                    'Birds_short.webmsd.webm')
        }

        self.test_video = self.data_utils.create_video(**td)
        self.video_pg.open_video_page(self.test_video.video_id)
        self.video_pg.log_in(self.user.username, 'password')
        self.video_pg.set_skiphowto()

        #Open the video page and sync the first 3 subs
        self.video_pg.add_subtitles()
        self.create_modal.create_original_subs('English', 'English')

        self.logger.info('typing subs')
        self.typed_subs = self.sub_editor.type_subs()
        self.sub_editor.continue_to_next_step()

        self.logger.info('syncing subs')
        self.sub_editor.sync_subs(len(self.typed_subs) + 2)
        self.timing_list = self.sub_editor.sub_timings()
        self.sub_editor.continue_to_next_step()
        self.logger.info('continue to description screen')
        self.sub_editor.continue_to_next_step()
        self.logger.info('continue to review screen')
        self.sub_editor.continue_to_next_step()
 def setUpClass(cls):
     super(TestCaseEditUploaded, cls).setUpClass()
     cls.data_utils = data_helpers.DataHelpers()
     cls.user = UserFactory.create(username='******')
     cls.video_language_pg = video_language_page.VideoLanguagePage(cls)
     cls.sub_editor = subtitle_editor.SubtitleEditor(cls)
     cls.subs_data_dir = os.path.join(os.getcwd(), 'apps',
                                      'webdriver_testing', 'subtitle_data')
    def setUpClass(cls):
        super(TestCaseEntryExit, cls).setUpClass()
        fixt_data = [
            'apps/webdriver_testing/fixtures/editor_auth.json',
            'apps/webdriver_testing/fixtures/editor_videos.json',
            'apps/webdriver_testing/fixtures/editor_subtitles.json'
        ]
        for f in fixt_data:
            management.call_command('loaddata', f, verbosity=0)
        cls.logger.info("""Default Test Data - loaded from fixtures

                        English, source primary v2 -> v6
                                 v1 -> deleted

                        Chinese v1 -> v3
                                v3 {"zh-cn": 2, "en": 6}

                        Danish v1 --> v4
                               v4 {"en": 5, "da": 3}
                               
                        Swedish v1 --> v3 FORKED
                                v3 {"sv": 2}
                                v1 --> private

                        Turkish (tr) v1 incomplete {"en": 5}
                       """)

        cls.create_modal = dialogs.CreateLanguageSelection(cls)
        cls.sub_editor = subtitle_editor.SubtitleEditor(cls)
        cls.unisubs_menu = unisubs_menu.UnisubsMenu(cls)
        cls.editor_pg = editor_page.EditorPage(cls)
        cls.video_pg = video_page.VideoPage(cls)
        cls.video_lang_pg = video_language_page.VideoLanguagePage(cls)
        cls.tasks_tab = TasksTab(cls)

        cls.user = UserFactory.create()
        cls.video_pg.open_page('auth/login/')
        cls.video_pg.log_in(cls.user.username, 'password')

        #Create a workflow enabled team to check review/approve dialog switching.
        cls.team = TeamMemberFactory.create(
            team__workflow_enabled=True,
            team__translate_policy=20,  #any team
            team__subtitle_policy=20,  #any team
            team__task_assign_policy=10,  #any team
            user=cls.user,
        ).team
        cls.workflow = WorkflowFactory(
            team=cls.team,
            autocreate_subtitle=True,
            autocreate_translate=True,
            approve_allowed=10,  # manager
            review_allowed=10,  # peer
        )
        cls.user = UserFactory.create()
Exemple #6
0
    def setUp(self):
        super(TestCaseLangSuggestion, self).setUp()
        self.data_utils = data_helpers.DataHelpers()
        self.sub_editor = subtitle_editor.SubtitleEditor(self)
        self.create_modal = dialogs.CreateLanguageSelection(self)
        self.dashboard_tab = dashboard_tab.DashboardTab(self)
        self.user = UserFactory(username='******', is_partner=True)
        self.data_utils.create_user_api_key(self.user)

        #Add a team with workflows, tasks and preferred languages
        self.logger.info('setup: Create a team with tasks enabled')
        self.team = TeamMemberFactory.create(
            team__name='Tasks Enabled',
            team__slug='tasks-enabled',
            team__workflow_enabled=True,
            user=self.user,
        ).team
        self.team_workflow = WorkflowFactory(
            team=self.team,
            autocreate_subtitle=True,
            autocreate_translate=True,
        )
        self.team_workflow.review_allowed = 10
        self.team_workflow.save()
        self.logger.info('setup: Add some preferred languages to the team.')
        lang_list = ['en', 'ru', 'pt-br', 'fr', 'de', 'es']
        for language in lang_list:
            TeamLangPrefFactory.create(team=self.team,
                                       language_code=language,
                                       preferred=True)

        #Add some videos with various languages required.
        self.logger.info('setup: Add some videos and set primary audio lang.')
        d = {
            'url': 'http://qa.pculture.org/amara_tests/Birds_short.mp4',
            'video__title': 'Short Birds MP4',
            'video__primary_audio_language_code': 'en'
        }
        self.non_team_video = self.data_utils.create_video(**d)
        test_videos = [('jaws.mp4', 'fr'), ('trailer.webm', 'en')]
        self.vid_obj_list = []
        for vid in test_videos:
            vidurl_data = {
                'url': ('http://qa.pculture.org/amara_tests/%s' % vid[0]),
                'video__title': vid[0]
            }

            video = self.data_utils.create_video(**vidurl_data)
            if vid[1] is not None:
                video.primary_audio_language_code = vid[1]
                video.save()
            self.vid_obj_list.append(video)
            team_video = TeamVideoFactory(video=video,
                                          team=self.team,
                                          added_by=self.user)
    def test_editable(self):
        """Uploaded translation can be opened in the editor.

        """
        test_file = 'Timed_text.sv.dfxp'
        sub_file = os.path.join(self.subs_data_dir, test_file)
        self._upload_and_verify(self.tv, sub_file, 'Swedish', 'sv')

        #Open the language page for the video and click Edit Subtitles
        self.video_language_pg.open_video_lang_page(self.tv.video_id, 'sv')
        self.video_language_pg.edit_subtitles()
        sub_editor = subtitle_editor.SubtitleEditor(self)
        self.assertEqual('Adding a New Translation', sub_editor.dialog_title())
Exemple #8
0
 def setUp(self):
     super(TestCaseTranscribing, self).setUp()
     self.data_utils = data_helpers.DataHelpers()
     td = {
         'url': ('http://qa.pculture.org/amara_tests/'
                 'Birds_short.webmsd.webm')
     }
     self.test_video = self.data_utils.create_video(**td)
     self.video_pg = video_page.VideoPage(self)
     self.user = UserFactory.create()
     self.video_pg.open_video_page(self.test_video.video_id)
     self.video_pg.log_in(self.user.username, 'password')
     self.video_pg.set_skiphowto()
     self.create_modal = dialogs.CreateLanguageSelection(self)
     self.sub_editor = subtitle_editor.SubtitleEditor(self)
     self.unisubs_menu = unisubs_menu.UnisubsMenu(self)
     self.video_pg.log_in(self.user.username, 'password')
     self.video_pg.add_subtitles()
     self.create_modal.create_original_subs('English', 'English')
     self.typed_subs = self.sub_editor.type_subs()
    def setUp(self):
        super(TestCaseSyncBrowserError, self).setUp()
        self.data_utils = data_helpers.DataHelpers()
        self.user = UserFactory.create(username='******')
        self.create_modal = dialogs.CreateLanguageSelection(self)
        self.sub_editor = subtitle_editor.SubtitleEditor(self)
        self.unisubs_menu = unisubs_menu.UnisubsMenu(self)
        self.video_pg = video_page.VideoPage(self)
        self.video_language_pg = video_language_page.VideoLanguagePage(self)

        td = {'url': ('http://qa.pculture.org/amara_tests/' 'Birds_short.mp4')}
        self.test_video = self.data_utils.create_video(**td)
        self.video_pg.open_video_page(self.test_video.video_id)
        self.video_pg.log_in(self.user.username, 'password')
        self.video_pg.set_skiphowto()
        #Open the video page and sync the first 3 subs
        self.video_pg.add_subtitles()
        self.create_modal.create_original_subs('English', 'English')
        self.typed_subs = self.sub_editor.type_subs()
        self.sub_editor.continue_to_next_step()
        num_synced_subs = 3
        self.sub_editor.sync_subs(num_synced_subs)
Exemple #10
0
    def setUpClass(cls):
        super(TestCaseTasksEnabledDashboard, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.sub_editor = subtitle_editor.SubtitleEditor(cls)
        cls.create_modal = dialogs.CreateLanguageSelection(cls)
        cls.dashboard_tab = dashboard_tab.DashboardTab(cls)
        cls.user = UserFactory(username='******', is_partner=True)
        cls.data_utils.create_user_api_key(cls.user)
        cls.subs_file = os.path.join(
            os.path.dirname(os.path.abspath(__file__)), 'oneline.txt')

        #Add a team with workflows, tasks and preferred languages
        cls.logger.info('setup: Create a team with tasks enabled')
        cls.team = TeamMemberFactory.create(
            team__name='Tasks Enabled',
            team__slug='tasks-enabled',
            team__workflow_enabled=True,
            user=cls.user,
        ).team
        cls.team_workflow = WorkflowFactory(
            team=cls.team,
            autocreate_subtitle=True,
            autocreate_translate=True,
        )
        cls.team_workflow.review_allowed = 10
        cls.team_workflow.save()
        cls.logger.info('setup: Add some preferred languages to the team.')
        lang_list = ['en', 'ru', 'pt-br', 'fr', 'de', 'es']
        for language in lang_list:
            TeamLangPrefFactory.create(team=cls.team,
                                       language_code=language,
                                       preferred=True)

        #Create some users with different roles and languages.
        polly_speaks = ['en', 'fr', 'ru', 'ar']
        cls.logger.info("setup: Create user Polly who speaks: %s" %
                        polly_speaks)
        cls.polly_glott = TeamContributorMemberFactory.create(
            team=cls.team, user=UserFactory(username='******')).user
        cls.logger.info("setup: Create manager reviewer who speaks: %s" %
                        polly_speaks)
        cls.reviewer = TeamManagerMemberFactory.create(
            team=cls.team, user=UserFactory(username='******')).user
        for lang in polly_speaks:
            UserLangFactory(user=cls.polly_glott, language=lang)
            UserLangFactory(user=cls.reviewer, language=lang)

        #Add some videos with various languages required.
        cls.logger.info('setup: Add some videos and set primary audio lang.')
        d = {
            'url': 'http://qa.pculture.org/amara_tests/Birds_short.mp4',
            'video__title': 'Short Birds MP4',
            'video__primary_audio_language_code': 'en'
        }
        cls.non_team_video = cls.data_utils.create_video(**d)
        test_videos = [('jaws.mp4', 'fr'), ('Birds_short.oggtheora.ogg', 'de'),
                       ('fireplace.mp4', 'en'), ('penguins.webm', None),
                       ('trailer.webm', 'en')]
        cls.vid_obj_list = []
        for vid in test_videos:
            vidurl_data = {
                'url': 'http://qa.pculture.org/amara_tests/%s' % vid[0],
                'video__title': vid[0]
            }

            video = cls.data_utils.create_video(**vidurl_data)
            if vid[1] is not None:
                video.primary_audio_language_code = vid[1]
                video.save()
            cls.vid_obj_list.append(video)
            team_video = TeamVideoFactory(video=video,
                                          team=cls.team,
                                          added_by=cls.polly_glott)
    def setUpClass(cls):
        super(TestCaseDeletion, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.video_lang_pg = video_language_page.VideoLanguagePage(cls)
        cls.video_pg = video_page.VideoPage(cls)
        cls.tasks_tab = TasksTab(cls)
        cls.watch_pg = watch_page.WatchPage(cls)
        cls.sub_editor = subtitle_editor.SubtitleEditor(cls)

        cls.user = UserFactory.create()
        cls.owner = UserFactory.create()
        cls.team = TeamMemberFactory.create(
            team__workflow_enabled=True,
            team__translate_policy=20,  #any team
            team__subtitle_policy=20,  #any team
            team__task_assign_policy=10,  #any team
            user=cls.owner,
        ).team
        cls.workflow = WorkflowFactory(
            team=cls.team,
            autocreate_subtitle=True,
            autocreate_translate=True,
            approve_allowed=10,  # manager
            review_allowed=10,  # peer
        )
        lang_list = ['en', 'ru', 'pt-br', 'de', 'sv']
        for language in lang_list:
            TeamLangPrefFactory.create(team=cls.team,
                                       language_code=language,
                                       preferred=True)

        cls.admin = TeamAdminMemberFactory(team=cls.team).user
        cls.contributor = TeamContributorMemberFactory(team=cls.team).user
        cls.subs_dir = os.path.join(os.getcwd(), 'apps', 'webdriver_testing',
                                    'subtitle_data')
        cls.rev1 = os.path.join(cls.subs_dir, 'Timed_text.en.srt')
        cls.rev2 = os.path.join(cls.subs_dir, 'Timed_text.rev2.en.srt')

        cls.sv = os.path.join(cls.subs_dir, 'Timed_text.sv.dfxp')
        ru = os.path.join(cls.subs_dir, 'less_lines.ssa')

        cls.logger.info("""
                         Create video with en as primary audio lang.
                            Subtitle, review and approve.
                            Translate to: 
                                sv: reviewed
                                de: complete, needs review
                                ru: incomplete
                         Delete Subtitle Language en + sv and de.
                         """)

        #Create en source language 2 revisions - approved.
        cls.video, cls.tv = cls._add_team_video()
        cls._upload_subtitles(cls.video,
                              'en',
                              cls.rev1,
                              cls.contributor,
                              complete=False)
        cls._upload_subtitles(cls.video, 'en', cls.rev2, cls.contributor)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.admin)
        cls.data_utils.complete_approve_task(cls.tv, 20, cls.admin)

        #Add sv translation, reviewed
        cls._upload_translation(cls.video, 'sv', cls.sv, cls.contributor)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.admin)

        #Add it translation, reviewed
        cls._upload_translation(cls.video, 'it', cls.sv, cls.contributor)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.admin)

        #Add hr translation, needs review
        cls._upload_translation(cls.video, 'hr', cls.sv, cls.contributor)

        #Add de translation complete waiting review
        cls._upload_translation(cls.video, 'de', cls.sv, cls.contributor)

        #Add ru translation, incomplete.
        cls._upload_translation(cls.video,
                                'ru',
                                cls.sv,
                                cls.contributor,
                                complete=False)

        cls.video_lang_pg.open_video_lang_page(cls.video.video_id, 'en')
        cls.video_lang_pg.log_in(cls.owner.username, 'password')
        cls.video_lang_pg.page_refresh()

        #Delete English subtitle language + Swedish and German
        cls.video_lang_pg.delete_subtitle_language(['Swedish', 'German'])
        management.call_command('update_index', interactive=False)
        management.call_command('update_video_metadata')
    def setUpClass(cls):
        super(TestCaseUnpublishLast, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.create_modal = dialogs.CreateLanguageSelection(cls)
        cls.sub_editor = subtitle_editor.SubtitleEditor(cls)
        cls.tasks_tab = TasksTab(cls)
        cls.video_pg = video_page.VideoPage(cls)
        cls.watch_pg = watch_page.WatchPage(cls)
        cls.user = UserFactory.create()
        cls.owner = UserFactory.create()
        cls.team = TeamMemberFactory.create(
            team__workflow_enabled=True,
            team__translate_policy=20,  #any team
            team__subtitle_policy=20,  #any team
            team__task_assign_policy=10,  #any team
            user=cls.owner,
        ).team
        cls.workflow = WorkflowFactory(
            team=cls.team,
            autocreate_subtitle=True,
            autocreate_translate=True,
            approve_allowed=10,  # manager
            review_allowed=10,  # peer
        )
        lang_list = ['en', 'ru', 'pt-br', 'de', 'sv']
        for language in lang_list:
            TeamLangPrefFactory.create(team=cls.team,
                                       language_code=language,
                                       preferred=True)

        cls.admin = TeamAdminMemberFactory(team=cls.team).user
        cls.contributor = TeamMemberFactory(team=cls.team).user
        cls.subs_dir = os.path.join(os.getcwd(), 'apps', 'webdriver_testing',
                                    'subtitle_data')
        cls.video, cls.tv = cls.create_source_with_multiple_revisions()
        translation = os.path.join(cls.subs_dir, 'Timed_text.sv.dfxp')

        #Upload subs - sv - incomplete, de - reviewed, ru - complete needs review
        cls.logger.info("""Uploading subs to get tasks in various stages: """)
        cls.logger.info("""
                         sv: translation started, incomplete
                         ru: translation submitted, needs review
                         de: translation reviewed, needs approve
                         pt-br: not started
                         """)

        cls._upload_lang(cls.video, translation, 'sv', cls.contributor)
        cls._upload_lang(cls.video,
                         translation,
                         'de',
                         cls.contributor,
                         complete=True)
        cls.data_utils.complete_review_task(cls.tv, 20, cls.admin)
        cls._upload_lang(cls.video,
                         translation,
                         'ru',
                         cls.contributor,
                         complete=True)

        cls.logger.info('Setting visibility override on v3 to private')
        cls.en = cls.video.subtitle_language('en')
        en_v3 = cls.en.get_tip(full=True)
        en_v3.visibility_override = 'private'
        en_v3.save()
        cls.tasks_tab.open_page('teams/%s/tasks/?lang=all&assignee=anyone' %
                                cls.team.slug)