Пример #1
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)
Пример #2
0
    def turn_on_automatic_tasks(self):
        self.logger.info('Turning on automatic task creation')
        #Turn on task autocreation for the team.
        WorkflowFactory.create(team=self.limited_access_team,
                               autocreate_subtitle=True,
                               autocreate_translate=True,
                               review_allowed=10)

        #Add some preferred languages to the team.
        lang_list = ['en', 'ru', 'pt-br']
        for language in lang_list:
            TeamLangPrefFactory(team=self.limited_access_team,
                                language_code=language,
                                preferred=True)
Пример #3
0
    def setUpClass(cls):
        super(TestCaseTeamGuidelines, cls).setUpClass()
        cls.messages_tab = messages_tab.MessagesTab(cls)
        cls.tasks_tab = tasks_tab.TasksTab(cls)
        cls.team_owner = UserFactory.create()

        #CREATE AN OPEN TEAM WITH WORKFLOWS and AUTOTASKS
        cls.team = TeamMemberFactory.create(team__workflow_enabled = True,
                                             user = cls.team_owner).team
        #Turn on Task Autocreation
        WorkflowFactory.create(
            team = cls.team,
            autocreate_subtitle = True,
            autocreate_translate = True,
            review_allowed = 10)
Пример #4
0
    def setUpClass(cls):
        super(TestCaseViewSubtitles, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.video_pg = video_page.VideoPage(cls)
        cls.user = UserFactory.create()
        cls.owner = UserFactory.create()
        cls.basic_team = TeamMemberFactory.create(
            team__workflow_enabled=False,
            team__translate_policy=20,  #any team
            team__subtitle_policy=20,  #any team
            user=cls.owner,
        ).team

        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
        )
        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')
        de = os.path.join(cls.subs_dir, 'Timed_text.rev3.en.srt')

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

        #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.owner)
        cls.data_utils.complete_approve_task(cls.tv, 20, cls.owner)

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

        #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)
Пример #5
0
    def setUpClass(cls):
        super(TestCaseRollbackRevision, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.video_lang_pg = video_language_page.VideoLanguagePage(cls)
        cls.diffing_pg = diffing_page.DiffingPage(cls)
        cls.video_pg = video_page.VideoPage(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.team_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')
Пример #6
0
    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()
    def _create_team(self):
        owner = UserFactory.create()

        team = TeamMemberFactory.create(team__workflow_enabled=True,
                                            team__translate_policy=20,
                                            team__subtitle_policy=20,
                                            user = owner,
                                            ).team
        team_workflow = WorkflowFactory(team = team,
                                            autocreate_subtitle=True,
                                            autocreate_translate=True,
                                            approve_allowed = 10,
                                            review_allowed = 10,
                                           )
        return team, owner
Пример #8
0
    def setUpClass(cls):
        super(TestCaseDraftVideos, cls).setUpClass()
        cls.data_utils = data_helpers.DataHelpers()
        cls.video_pg = video_page.VideoPage(cls)
        cls.video_lang_pg = video_language_page.VideoLanguagePage(cls)
        cls.menu = unisubs_menu.UnisubsMenu(cls)
        cls.create_modal = dialogs.CreateLanguageSelection(cls)

        cls.user = UserFactory(username='******', is_partner=True)
        cls.data_utils.create_user_api_key(cls.user)
        #Add a team with workflows, tasks and preferred languages
        cls.logger.info('setup: Create a team with tasks enabled')
        cls.team = TeamMemberFactory.create(
            team__workflow_enabled=True,
            team__subtitle_policy=20,
            team__translate_policy=20,
            user=cls.user,
        ).team
        cls.team_workflow = WorkflowFactory(
            team=cls.team,
            autocreate_subtitle=True,
            autocreate_translate=True,
            approve_allowed=10,
            review_allowed=10,
        )
        cls.member = TeamContributorMemberFactory.create(
            team=cls.team, user=UserFactory(username='******')).user
        cls.nonmember = UserFactory()

        #Add video to team with draft subtitles
        cls.logger.info('Setup: Add video to team with draft subs.')
        cls.draft = TeamVideoFactory.create(
            team=cls.team,
            video=cls.data_utils.create_video(),
            added_by=cls.user).video
        cls.data_utils.upload_subs(cls.draft,
                                   data=None,
                                   user=dict(username=cls.user.username,
                                             password='******'))

        cls.video_pg.open_video_page(cls.draft.video_id)
        cls.video_pg.set_skiphowto()
Пример #9
0
class TestCaseLangSuggestion(WebdriverTestCase):
    """These dashboard tests need a fresh browser instance to run.
    """
    NEW_BROWSER_PER_TEST_CASE = True

    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 get_task(self, video_id, team, task_type, lang):
        """Return the tasks give a video id, and language via the api.
 
        """
        url_part = 'teams/{0}/tasks?video_id={1}'.format(team.slug, video_id)
        status, response = self.data_utils.api_get_request(self.user, url_part)
        task_objects = response['objects']
        for task in task_objects:
            if task['type'] == task_type and task['language'] == lang:
                return task

    def test_member__language_suggestion(self):
        """Members with no lang pref see the prompt to set language preference.

        """
        mono_glot = TeamContributorMemberFactory.create(
            team=self.team, user=UserFactory()).user
        self.dashboard_tab.open_team_page(self.team.slug)
        self.browser.delete_all_cookies()
        self.dashboard_tab.log_in(mono_glot.username, 'password')

        self.logger.info('Subtitle task for jaws video is assigned to Mono '
                         'Glot via api.')
        jaws_vid = self.vid_obj_list[0]  #see setUp for data details.
        task_resp = self.get_task(jaws_vid.video_id, self.team, 'Subtitle',
                                  'fr')
        url_part = task_resp['resource_uri']
        updated_info = {'assignee': mono_glot.username}
        status, response = self.data_utils.put_api_request(
            self.user, url_part, updated_info)

        self.dashboard_tab.open_team_page(self.team.slug)
        self.assertTrue(
            self.dashboard_tab.suggestion_present(
                suggestion_type='authed_language'))
Пример #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')
Пример #12
0
    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)