diff --git a/cms/djangoapps/contentstore/features/transcripts.feature b/cms/djangoapps/contentstore/features/transcripts.feature index 4e5e0a10f8..9313b75a1a 100644 --- a/cms/djangoapps/contentstore/features/transcripts.feature +++ b/cms/djangoapps/contentstore/features/transcripts.feature @@ -56,193 +56,6 @@ Feature: CMS Transcripts # Then I see status message "found" # And I see value "t__eq_exist" in the field "Default Timed Transcript" - #12 - Scenario: Entering youtube (no importing), and 2 html5 sources without transcripts - "Not Found" - Given I have created a Video component - And I edit the component - And I enter a "http://youtu.be/t_not_exist" source to field number 1 - Then I see status message "not found" - And I see button "disabled_download_to_edit" - And I see button "upload_new_timed_transcripts" - And I enter a "t_not_exist.mp4" source to field number 2 - Then I see status message "not found" - And I see button "upload_new_timed_transcripts" - And I see button "disabled_download_to_edit" - And I enter a "t_not_exist.webm" source to field number 3 - Then I see status message "not found" - And I see button "disabled_download_to_edit" - And I see button "upload_new_timed_transcripts" - - #13 - Scenario: Entering youtube with imported transcripts, and 2 html5 sources without transcripts - "Found" - Given I have created a Video component - And I edit the component - - And I enter a "http://youtu.be/t__eq_exist" source to field number 1 - Then I see status message "not found on edx" - And I see button "import" - And I click transcript button "import" - Then I see status message "found" - And I see button "upload_new_timed_transcripts" - - And I enter a "t_not_exist.mp4" source to field number 2 - Then I see status message "found" - And I see button "download_to_edit" - And I see button "upload_new_timed_transcripts" - - And I enter a "t_not_exist.webm" source to field number 3 - Then I see status message "found" - And I see button "download_to_edit" - And I see button "upload_new_timed_transcripts" - - #14 - Scenario: Entering youtube w/o transcripts - html5 w/o transcripts - html5 with transcripts - Given I have created a Video component with subtitles "t_neq_exist" - And I edit the component - - And I enter a "http://youtu.be/t_not_exist" source to field number 1 - Then I see status message "not found" - And I see button "disabled_download_to_edit" - And I see button "upload_new_timed_transcripts" - - And I enter a "t_not_exist.mp4" source to field number 2 - Then I see status message "not found" - And I see button "disabled_download_to_edit" - And I see button "upload_new_timed_transcripts" - - And I enter a "t_neq_exist.webm" source to field number 3 - Then I see status message "found" - And I see button "download_to_edit" - And I see button "upload_new_timed_transcripts" - - #15 - Scenario: Entering youtube w/o imported transcripts - html5 w/o transcripts w/o import - html5 with transcripts - Given I have created a Video component with subtitles "t_neq_exist" - And I edit the component - - And I enter a "http://youtu.be/t__eq_exist" source to field number 1 - Then I see status message "not found on edx" - And I see button "import" - And I see button "upload_new_timed_transcripts" - - And I enter a "t_not_exist.mp4" source to field number 2 - Then I see status message "not found on edx" - And I see button "import" - And I see button "upload_new_timed_transcripts" - - And I enter a "t_neq_exist.webm" source to field number 3 - Then I see status message "not found on edx" - And I see button "import" - And I see button "upload_new_timed_transcripts" - - #16 - Scenario: Entering youtube w/o imported transcripts - html5 with transcripts - html5 w/o transcripts w/o import - Given I have created a Video component with subtitles "t_neq_exist" - And I edit the component - - And I enter a "http://youtu.be/t__eq_exist" source to field number 1 - Then I see status message "not found on edx" - And I see button "import" - And I see button "upload_new_timed_transcripts" - - And I enter a "t_neq_exist.mp4" source to field number 2 - Then I see status message "not found on edx" - And I see button "import" - And I see button "upload_new_timed_transcripts" - - And I enter a "t_not_exist.webm" source to field number 3 - Then I see status message "not found on edx" - And I see button "import" - And I see button "upload_new_timed_transcripts" - - #17 - Scenario: Entering youtube with imported transcripts - html5 with transcripts - html5 w/o transcripts - Given I have created a Video component with subtitles "t_neq_exist" - And I edit the component - - And I enter a "http://youtu.be/t__eq_exist" source to field number 1 - Then I see status message "not found on edx" - And I see button "import" - And I click transcript button "import" - Then I see status message "found" - And I see button "upload_new_timed_transcripts" - - And I enter a "t_neq_exist.mp4" source to field number 2 - Then I see status message "found" - And I see button "download_to_edit" - And I see button "upload_new_timed_transcripts" - - And I enter a "t_not_exist.webm" source to field number 3 - Then I see status message "found" - And I see button "download_to_edit" - And I see button "upload_new_timed_transcripts" - - #18 - Scenario: Entering youtube with imported transcripts - html5 w/o transcripts - html5 with transcripts - Given I have created a Video component with subtitles "t_neq_exist" - And I edit the component - - And I enter a "http://youtu.be/t__eq_exist" source to field number 1 - Then I see status message "not found on edx" - And I see button "import" - And I click transcript button "import" - Then I see status message "found" - And I see button "upload_new_timed_transcripts" - - And I enter a "t_not_exist.mp4" source to field number 2 - Then I see status message "found" - And I see button "download_to_edit" - And I see button "upload_new_timed_transcripts" - - And I enter a "t_neq_exist.webm" source to field number 3 - Then I see status message "found" - And I see button "download_to_edit" - And I see button "upload_new_timed_transcripts" - - #19 - Scenario: Entering html5 with transcripts - upload - youtube w/o transcripts - Given I have created a Video component with subtitles "t__eq_exist" - And I edit the component - - And I enter a "t__eq_exist.mp4" source to field number 1 - Then I see status message "found" - And I see button "download_to_edit" - And I see button "upload_new_timed_transcripts" - And I upload the transcripts file "uk_transcripts.srt" - Then I see status message "uploaded_successfully" - And I see button "download_to_edit" - And I see button "upload_new_timed_transcripts" - And I see value "t__eq_exist" in the field "Default Timed Transcript" - - And I enter a "http://youtu.be/t_not_exist" source to field number 2 - Then I see status message "found" - And I see button "download_to_edit" - And I see button "upload_new_timed_transcripts" - - And I enter a "uk_transcripts.webm" source to field number 3 - Then I see status message "found" - - #20 - Scenario: Enter 2 HTML5 sources with transcripts, they are not the same, choose - Given I have created a Video component with subtitles "t_not_exist" - And I edit the component - - And I enter a "uk_transcripts.mp4" source to field number 1 - Then I see status message "not found" - And I see button "download_to_edit" - And I see button "upload_new_timed_transcripts" - And I upload the transcripts file "uk_transcripts.srt" - Then I see status message "uploaded_successfully" - And I see value "uk_transcripts" in the field "Default Timed Transcript" - - And I enter a "t_not_exist.webm" source to field number 2 - Then I see status message "replace" - - And I see choose button "uk_transcripts.mp4" number 1 - And I see choose button "t_not_exist.webm" number 2 - And I click transcript button "choose" number 2 - And I see value "uk_transcripts|t_not_exist" in the field "Default Timed Transcript" - # Flaky test fails occasionally in master. https://openedx.atlassian.net/browse/BLD-892 #21 #Scenario: Work with 1 field only: Enter HTML5 source with transcripts - save - > change it to another one HTML5 source w/o #transcripts - click on use existing - > change it to another one HTML5 source w/o transcripts - click on use existing @@ -270,87 +83,6 @@ Feature: CMS Transcripts # And I click transcript button "use_existing" # And I see value "video_name_3" in the field "Default Timed Transcript" - #22 - Scenario: Work with 1 field only: Enter HTML5 source with transcripts - save -> change it to another one HTML5 source w/o transcripts - click on use existing -> change it to another one HTML5 source w/o transcripts - do not click on use existing -> change it to another one HTML5 source w/o transcripts - click on use existing - Given I have created a Video component with subtitles "t_not_exist" - And I edit the component - - And I enter a "t_not_exist.mp4" source to field number 1 - Then I see status message "found" - And I see button "download_to_edit" - And I see button "upload_new_timed_transcripts" - And I see value "t_not_exist" in the field "Default Timed Transcript" - - And I save changes - And I edit the component - - And I enter a "video_name_2.mp4" source to field number 1 - Then I see status message "use existing" - And I see button "use_existing" - And I click transcript button "use_existing" - And I see value "video_name_2" in the field "Default Timed Transcript" - - And I enter a "video_name_3.mp4" source to field number 1 - Then I see status message "use existing" - And I see button "use_existing" - - And I enter a "video_name_4.mp4" source to field number 1 - Then I see status message "use existing" - And I see button "use_existing" - And I click transcript button "use_existing" - And I see value "video_name_4" in the field "Default Timed Transcript" - - #23 - Scenario: Work with 2 fields: Enter HTML5 source with transcripts - save -> change it to another one HTML5 source w/o transcripts - do not click on use existing -> add another one HTML5 source w/o transcripts - click on use existing - Given I have created a Video component with subtitles "t_not_exist" - And I edit the component - - And I enter a "t_not_exist.mp4" source to field number 1 - Then I see status message "found" - And I see button "download_to_edit" - And I see button "upload_new_timed_transcripts" - - And I save changes - And I edit the component - - And I enter a "video_name_2.mp4" source to field number 1 - Then I see status message "use existing" - And I see button "use_existing" - - And I enter a "video_name_3.webm" source to field number 2 - Then I see status message "use existing" - And I see button "use_existing" - And I click transcript button "use_existing" - And I see value "video_name_2|video_name_3" in the field "Default Timed Transcript" - - #24 Uploading subtitles with different file name than file - Scenario: File name and name of subs are different - Given I have created a Video component - And I edit the component - - And I enter a "video_name_1.mp4" source to field number 1 - And I see status message "not found" - And I upload the transcripts file "uk_transcripts.srt" - Then I see status message "uploaded_successfully" - And I see value "video_name_1" in the field "Default Timed Transcript" - - And I save changes - Then when I view the video it does show the captions - - And I edit the component - Then I see status message "found" - - #25 - # Video can have filled item.sub, but doesn't have subs file. - # In this case, after changing this video by another one without subs - # `Not found` message should appear ( not `use existing`). - Scenario: Video w/o subs - another video w/o subs - Not found message - Given I have created a Video component - And I edit the component - - And I enter a "video_name_1.mp4" source to field number 1 - Then I see status message "not found" - #26 Scenario: Subtitles are copied for every html5 video source Given I have created a Video component diff --git a/common/test/acceptance/pages/studio/container.py b/common/test/acceptance/pages/studio/container.py index b4eb6a498e..92ec076f1a 100644 --- a/common/test/acceptance/pages/studio/container.py +++ b/common/test/acceptance/pages/studio/container.py @@ -298,6 +298,7 @@ class XBlockWrapper(PageObject): BODY_SELECTOR = '.studio-xblock-wrapper' NAME_SELECTOR = '.xblock-display-name' COMPONENT_BUTTONS = { + 'basic_tab': '.editor-tabs li.inner_tab_wrap:nth-child(1) > a', 'advanced_tab': '.editor-tabs li.inner_tab_wrap:nth-child(2) > a', 'save_settings': '.action-save', } @@ -373,6 +374,12 @@ class XBlockWrapper(PageObject): """ self._click_button('advanced_tab') + def open_basic_tab(self): + """ + Click on Basic Tab. + """ + self._click_button('basic_tab') + def save_settings(self): """ Click on settings Save button. diff --git a/common/test/acceptance/pages/studio/video/video.py b/common/test/acceptance/pages/studio/video/video.py index 780ceced42..f009365514 100644 --- a/common/test/acceptance/pages/studio/video/video.py +++ b/common/test/acceptance/pages/studio/video/video.py @@ -167,7 +167,6 @@ class VideoComponentPage(VideoPage): self.click_button('upload_asset', index) self.q(css=CLASS_SELECTORS['attach_asset']).results[0].send_keys(asset_file_path) self.click_button('asset_submit') - # Only srt format transcript files can be uploaded, If an error # occurs due to incorrect transcript file we will return from here if asset_type == 'transcript' and self.q(css='#upload_error').present: @@ -284,6 +283,7 @@ class VideoComponentPage(VideoPage): is_verified = self._verify_setting_entry(setting, DEFAULT_SETTINGS[counter][0], DEFAULT_SETTINGS[counter][1]) + if not is_verified: return is_verified @@ -560,21 +560,41 @@ class VideoComponentPage(VideoPage): .trigger('input'); """.format(selector=CLASS_SELECTORS['url_inputs']) self.browser.execute_script(script) - time.sleep(DELAY) self.wait_for_ajax() - def is_transcript_button_visible(self, button_name): + def is_transcript_button_visible(self, button_name, index=0, button_text=None): """ Check if a transcript related button is visible. Arguments: button_name (str): name of button - field_numbers (tuple or None): field numbers to check status for, None means get status for all. - tuple items will be integers and must start from 1 + index (int): query index + button_text (str or None): text to match with text on a button, if None then don't match texts Returns: bool: is button visible """ - return self.q(css=BUTTON_SELECTORS[button_name]).visible + is_visible = self.q(css=BUTTON_SELECTORS[button_name]).nth(index).visible + + is_text_matched = True + if button_text and button_text != self.q(css=BUTTON_SELECTORS[button_name]).nth(index).text[0]: + is_text_matched = False + + return is_visible and is_text_matched + + def upload_transcript(self, transcript_filename): + """ + Upload a Transcript + + Arguments: + transcript_filename (str): name of transcript file + + """ + # Show the Browse Button + self.browser.execute_script("$('form.file-chooser').show()") + asset_file_path = self.file_path(transcript_filename) + self.q(css=CLASS_SELECTORS['attach_transcript']).results[0].send_keys(asset_file_path) + # confirm upload completion + self._wait_for(lambda: not self.q(css=CLASS_SELECTORS['attach_transcript']).visible, 'Upload Completed') diff --git a/common/test/acceptance/tests/video/test_studio_video_module.py b/common/test/acceptance/tests/video/test_studio_video_module.py index 34220e5bd4..83abdf2aed 100644 --- a/common/test/acceptance/tests/video/test_studio_video_module.py +++ b/common/test/acceptance/tests/video/test_studio_video_module.py @@ -110,6 +110,13 @@ class CMSVideoBaseTest(UniqueCourseTest): # The 0th entry is the unit page itself. self.unit_page.xblocks[1].open_advanced_tab() + def open_basic_tab(self): + """ + Open components basic tab. + """ + # The 0th entry is the unit page itself. + self.unit_page.xblocks[1].open_basic_tab() + def save_unit_settings(self): """ Save component settings. diff --git a/common/test/acceptance/tests/video/test_studio_video_transcript.py b/common/test/acceptance/tests/video/test_studio_video_transcript.py index 1164f17319..2dc32e8b78 100644 --- a/common/test/acceptance/tests/video/test_studio_video_transcript.py +++ b/common/test/acceptance/tests/video/test_studio_video_transcript.py @@ -231,3 +231,380 @@ class VideoTranscriptTest(CMSVideoBaseTest): self.assertEqual(self.video.message('status'), 'No EdX Timed Transcript') self.assertTrue(self.video.is_transcript_button_visible('import')) self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + + def test_youtube_no_import(self): + """ + Scenario: Entering youtube (no importing), and 2 html5 sources without transcripts - "Not Found" + Given I have created a Video component + urls = ['http://youtu.be/t_not_exist', 't_not_exist.mp4', 't_not_exist.webm'] + for each url in urls do the following +            Enter `url` to field number `n` +            Status message `No Timed Transcript` is shown +            `disabled_download_to_edit` and `upload_new_timed_transcripts` buttons are shown + """ + self._create_video_component() + self.edit_component() + urls = ['http://youtu.be/t_not_exist', 't_not_exist.mp4', 't_not_exist.webm'] + for index, url in enumerate(urls, 1): + self.video.set_url_field(url, index) + self.assertEqual(self.video.message('status'), 'No Timed Transcript') + self.assertTrue(self.video.is_transcript_button_visible('disabled_download_to_edit')) + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + + def test_youtube_with_import(self): + """ + Scenario: Entering youtube with imported transcripts, and 2 html5 sources without transcripts - "Found" + Given I have created a Video component + And I enter a "http://youtu.be/t__eq_exist" source to field number 1 + Then I see status message "No EdX Timed Transcript" + And I see button "import" + And I click transcript button "import" + Then I see status message "Timed Transcript Found" + And I see button "upload_new_timed_transcripts" + urls = ['t_not_exist.mp4', 't_not_exist.webm'] + for each url in urls do the following +            Enter `url` to field number `n` +            Status message `Timed Transcript Found` is shown +            `download_to_edit` and `upload_new_timed_transcripts` buttons are shown + """ + self._create_video_component() + self.edit_component() + self.video.set_url_field('http://youtu.be/t__eq_exist', 1) + self.assertEqual(self.video.message('status'), 'No EdX Timed Transcript') + self.assertTrue(self.video.is_transcript_button_visible('import')) + self.video.click_button('import') + self.assertEqual(self.video.message('status'), 'Timed Transcript Found') + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + urls = ['t_not_exist.mp4', 't_not_exist.webm'] + for index, url in enumerate(urls, 2): + self.video.set_url_field(url, index) + self.assertEqual(self.video.message('status'), 'Timed Transcript Found') + self.assertTrue(self.video.is_transcript_button_visible('download_to_edit')) + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + + def test_youtube_wo_transcripts(self): + """ + Scenario: Entering youtube w/o transcripts - html5 w/o transcripts - html5 with transcripts + Given I have created a Video component with subtitles "t_neq_exist" + urls = ['http://youtu.be/t_not_exist', 't_not_exist.mp4'] + for each url in urls do the following +            Enter `url` to field number `n` +            Status message `No Timed Transcript` is shown +            `disabled_download_to_edit` and `upload_new_timed_transcripts` buttons are shown + + And I enter a "t_neq_exist.webm" source to field number 3 + Then I see status message "Timed Transcript Found" + `download_to_edit` and `upload_new_timed_transcripts` buttons are shown + """ + self._create_video_component(subtitles=True, subtitle_id='t_neq_exist') + self.edit_component() + urls = ['http://youtu.be/t_not_exist', 't_not_exist.mp4'] + for index, url in enumerate(urls, 1): + self.video.set_url_field(url, index) + self.assertEqual(self.video.message('status'), 'No Timed Transcript') + self.assertTrue(self.video.is_transcript_button_visible('disabled_download_to_edit')) + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + + self.video.set_url_field('t_neq_exist.webm', 3) + self.assertEqual(self.video.message('status'), 'Timed Transcript Found') + self.assertTrue(self.video.is_transcript_button_visible('download_to_edit')) + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + + def test_youtube_wo_imported_transcripts(self): + """ + Scenario: Entering youtube w/o imported transcripts - html5 w/o transcripts w/o import - html5 with transcripts + Given I have created a Video component with subtitles "t_neq_exist" + urls = ['http://youtu.be/t__eq_exist', 't_not_exist.mp4', 't_neq_exist.webm'] + for each url in urls do the following +            Enter `url` to field number `n` +            Status message `No EdX Timed Transcript` is shown +            `import` and `upload_new_timed_transcripts` buttons are shown + """ + self._create_video_component(subtitles=True, subtitle_id='t_neq_exist') + self.edit_component() + urls = ['http://youtu.be/t__eq_exist', 't_not_exist.mp4', 't_neq_exist.webm'] + for index, url in enumerate(urls, 1): + self.video.set_url_field(url, index) + self.assertEqual(self.video.message('status'), 'No EdX Timed Transcript') + self.assertTrue(self.video.is_transcript_button_visible('import')) + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + + def test_youtube_wo_imported_transcripts2(self): + """ + Scenario: Entering youtube w/o imported transcripts - html5 with transcripts - html5 w/o transcripts w/o import + Given I have created a Video component with subtitles "t_neq_exist" + urls = ['http://youtu.be/t__eq_exist', 't_neq_exist.mp4', 't_not_exist.webm'] + for each url in urls do the following +            Enter `url` to field number `n` +            Status message `No EdX Timed Transcript` is shown +            `import` and `upload_new_timed_transcripts` buttons are shown + """ + self._create_video_component(subtitles=True, subtitle_id='t_neq_exist') + self.edit_component() + urls = ['http://youtu.be/t__eq_exist', 't_neq_exist.mp4', 't_not_exist.webm'] + for index, url in enumerate(urls, 1): + self.video.set_url_field(url, index) + self.assertEqual(self.video.message('status'), 'No EdX Timed Transcript') + self.assertTrue(self.video.is_transcript_button_visible('import')) + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + + def test_youtube_w_imported_transcripts(self): + """ + Scenario: Entering youtube with imported transcripts - html5 with transcripts - html5 w/o transcripts + Given I have created a Video component with subtitles "t_neq_exist" + And I enter a "http://youtu.be/t__eq_exist" source to field number 1 + Then I see status message "No EdX Timed Transcript" + And I see button "import" + And I click transcript button "import" + Then I see status message "Timed Transcript Found" + And I see button "upload_new_timed_transcripts" + urls = ['t_neq_exist.mp4', 't_not_exist.webm'] + for each url in urls do the following +            Enter `url` to field number `n` +            Status message `Timed Transcript Found` is shown +            `download_to_edit` and `upload_new_timed_transcripts` buttons are shown + """ + self._create_video_component(subtitles=True, subtitle_id='t_neq_exist') + self.edit_component() + self.video.set_url_field('http://youtu.be/t__eq_exist', 1) + self.assertEqual(self.video.message('status'), 'No EdX Timed Transcript') + self.assertTrue(self.video.is_transcript_button_visible('import')) + self.video.click_button('import') + self.assertEqual(self.video.message('status'), 'Timed Transcript Found') + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + urls = ['t_neq_exist.mp4', 't_not_exist.webm'] + for index, url in enumerate(urls, 2): + self.video.set_url_field(url, index) + self.assertEqual(self.video.message('status'), 'Timed Transcript Found') + self.assertTrue(self.video.is_transcript_button_visible('download_to_edit')) + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + + def test_youtube_w_imported_transcripts2(self): + """ + Scenario: Entering youtube with imported transcripts - html5 w/o transcripts - html5 with transcripts + Given I have created a Video component with subtitles "t_neq_exist" + And I enter a "http://youtu.be/t__eq_exist" source to field number 1 + Then I see status message "No EdX Timed Transcript" + And I see button "import" + And I click transcript button "import" + Then I see status message "Timed Transcript Found" + And I see button "upload_new_timed_transcripts" + urls = ['t_not_exist.mp4', 't_neq_exist.webm'] + for each url in urls do the following +            Enter `url` to field number `n` +            Status message `Timed Transcript Found` is shown +            `download_to_edit` and `upload_new_timed_transcripts` buttons are shown + """ + self._create_video_component(subtitles=True, subtitle_id='t_neq_exist') + self.edit_component() + self.video.set_url_field('http://youtu.be/t__eq_exist', 1) + self.assertEqual(self.video.message('status'), 'No EdX Timed Transcript') + self.assertTrue(self.video.is_transcript_button_visible('import')) + self.video.click_button('import') + self.assertEqual(self.video.message('status'), 'Timed Transcript Found') + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + urls = ['t_not_exist.mp4', 't_neq_exist.webm'] + for index, url in enumerate(urls, 2): + self.video.set_url_field(url, index) + self.assertEqual(self.video.message('status'), 'Timed Transcript Found') + self.assertTrue(self.video.is_transcript_button_visible('download_to_edit')) + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + + def test_html5_with_transcripts(self): + """ + Scenario: Entering html5 with transcripts - upload - youtube w/o transcripts + Given I have created a Video component with subtitles "t__eq_exist" + And I enter a "t__eq_exist.mp4" source to field number 1 + Then I see status message "Timed Transcript Found" + `download_to_edit` and `upload_new_timed_transcripts` buttons are shown + And I upload the transcripts file "uk_transcripts.srt" + Then I see status message "Timed Transcript Uploaded Successfully" + `download_to_edit` and `upload_new_timed_transcripts` buttons are shown + And I see value "t__eq_exist" in the field "Default Timed Transcript" + And I enter a "http://youtu.be/t_not_exist" source to field number 2 + Then I see status message "Timed Transcript Found" + `download_to_edit` and `upload_new_timed_transcripts` buttons are shown + And I enter a "uk_transcripts.webm" source to field number 3 + Then I see status message "Timed Transcript Found" + """ + self._create_video_component(subtitles=True, subtitle_id='t__eq_exist') + self.edit_component() + self.video.set_url_field('t__eq_exist.mp4', 1) + self.assertEqual(self.video.message('status'), 'Timed Transcript Found') + self.assertTrue(self.video.is_transcript_button_visible('download_to_edit')) + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + self.video.upload_transcript('uk_transcripts.srt') + self.assertEqual(self.video.message('status'), 'Timed Transcript Uploaded Successfully') + self.assertTrue(self.video.is_transcript_button_visible('download_to_edit')) + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + self.open_advanced_tab() + self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 't__eq_exist')) + self.open_basic_tab() + self.video.set_url_field('http://youtu.be/t_not_exist', 2) + self.assertEqual(self.video.message('status'), 'Timed Transcript Found') + self.assertTrue(self.video.is_transcript_button_visible('download_to_edit')) + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + self.video.set_url_field('uk_transcripts.webm', 3) + self.assertEqual(self.video.message('status'), 'Timed Transcript Found') + + def test_two_html5_sources_w_transcripts(self): + """ + Scenario: Enter 2 HTML5 sources with transcripts, they are not the same, choose + Given I have created a Video component with subtitles "t_not_exist" + And I enter a "uk_transcripts.mp4" source to field number 1 + Then I see status message "No Timed Transcript" + `download_to_edit` and `upload_new_timed_transcripts` buttons are shown + And I upload the transcripts file "uk_transcripts.srt" + Then I see status message "Timed Transcript Uploaded Successfully" + And I see value "uk_transcripts" in the field "Default Timed Transcript" + And I enter a "t_not_exist.webm" source to field number 2 + Then I see status message "Timed Transcript Conflict" + `Timed Transcript from uk_transcripts.mp4` and `Timed Transcript from t_not_exist.webm` buttons are shown + And I click transcript button "Timed Transcript from t_not_exist.webm" + And I see value "uk_transcripts|t_not_exist" in the field "Default Timed Transcript" + """ + self._create_video_component(subtitles=True, subtitle_id='t_not_exist') + self.edit_component() + self.video.set_url_field('uk_transcripts.mp4', 1) + self.assertEqual(self.video.message('status'), 'No Timed Transcript') + self.assertTrue(self.video.is_transcript_button_visible('download_to_edit')) + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + self.video.upload_transcript('uk_transcripts.srt') + self.assertEqual(self.video.message('status'), 'Timed Transcript Uploaded Successfully') + self.open_advanced_tab() + self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 'uk_transcripts')) + self.open_basic_tab() + self.video.set_url_field('t_not_exist.webm', 2) + self.assertEqual(self.video.message('status'), 'Timed Transcript Conflict') + self.assertTrue( + self.video.is_transcript_button_visible('choose', button_text='Timed Transcript from uk_transcripts.mp4')) + self.assertTrue(self.video.is_transcript_button_visible('choose', index=1, + button_text='Timed Transcript from t_not_exist.webm')) + + def test_one_field_only(self): + """ + Scenario: Work with 1 field only: Enter HTML5 source with transcripts - save -> change it to another one HTML5 + source w/o transcripts - click on use existing -> change it to another one HTML5 source w/o transcripts - do + not click on use existing -> change it to another one HTML5 source w/o transcripts - click on use existing + Given I have created a Video component with subtitles "t_not_exist" + If i enter "t_not_exist.mp4" source to field number 1 Then I see status message "Timed Transcript Found" + `download_to_edit` and `upload_new_timed_transcripts` buttons are shown + And I see value "t_not_exist" in the field "Default Timed Transcript" + And I save changes And then edit the component + If i enter "video_name_2.mp4" source to field number 1 Then I see status message "Confirm Timed Transcript" + I see button "use_existing" And I click on it + And I see value "video_name_2" in the field "Default Timed Transcript" + If i enter "video_name_3.mp4" source to field number 1 Then I see status message "Confirm Timed Transcript" + And I see button "use_existing" + If i enter a "video_name_4.mp4" source to field number 1 Then I see status message "Confirm Timed Transcript" + I see button "use_existing" And I click on it + And I see value "video_name_4" in the field "Default Timed Transcript" + """ + self._create_video_component(subtitles=True, subtitle_id='t_not_exist') + self.edit_component() + self.video.set_url_field('t_not_exist.mp4', 1) + self.assertEqual(self.video.message('status'), 'Timed Transcript Found') + self.assertTrue(self.video.is_transcript_button_visible('download_to_edit')) + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + self.open_advanced_tab() + self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 't_not_exist')) + self.open_basic_tab() + self.save_unit_settings() + self.edit_component() + self.video.set_url_field('video_name_2.mp4', 1) + self.assertEqual(self.video.message('status'), 'Confirm Timed Transcript') + self.assertTrue(self.video.is_transcript_button_visible('use_existing')) + self.video.click_button('use_existing') + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + self.open_advanced_tab() + self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 'video_name_2')) + self.open_basic_tab() + self.video.set_url_field('video_name_3.mp4', 1) + self.assertEqual(self.video.message('status'), 'Confirm Timed Transcript') + self.assertTrue(self.video.is_transcript_button_visible('use_existing')) + self.video.set_url_field('video_name_4.mp4', 1) + self.assertEqual(self.video.message('status'), 'Confirm Timed Transcript') + self.assertTrue(self.video.is_transcript_button_visible('use_existing')) + self.video.click_button('use_existing') + self.open_advanced_tab() + self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 'video_name_4')) + + def test_two_fields_only(self): + """ + Scenario: Work with 2 fields: Enter HTML5 source with transcripts - save -> change it to another one HTML5 + source w/o transcripts - do not click on use existing -> add another one HTML5 source w/o transcripts - + click on use existing + Given I have created a Video component with subtitles "t_not_exist" + And I enter a "t_not_exist.mp4" source to field number 1 + Then I see status message "Timed Transcript Found" + `download_to_edit` and `upload_new_timed_transcripts` buttons are shown + And I save changes + And I edit the component + And I enter a "video_name_2.mp4" source to field number 1 + Then I see status message "Confirm Timed Transcript" + And I see button "use_existing" + And I enter a "video_name_3.webm" source to field number 2 + Then I see status message "Confirm Timed Transcript" + And I see button "use_existing" + And I click transcript button "use_existing" + And I see value "video_name_3" in the field "Default Timed Transcript" + """ + self._create_video_component(subtitles=True, subtitle_id='t_not_exist') + self.edit_component() + self.video.set_url_field('t_not_exist.mp4', 1) + self.assertEqual(self.video.message('status'), 'Timed Transcript Found') + self.assertTrue(self.video.is_transcript_button_visible('download_to_edit')) + self.assertTrue(self.video.is_transcript_button_visible('upload_new_timed_transcripts')) + self.save_unit_settings() + self.edit_component() + self.video.set_url_field('video_name_2.mp4', 1) + self.assertEqual(self.video.message('status'), 'Confirm Timed Transcript') + self.assertTrue(self.video.is_transcript_button_visible('use_existing')) + self.video.set_url_field('video_name_3.webm', 2) + self.assertEqual(self.video.message('status'), 'Confirm Timed Transcript') + self.assertTrue(self.video.is_transcript_button_visible('use_existing')) + self.video.click_button('use_existing') + self.open_advanced_tab() + self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 'video_name_3')) + + def test_upload_subtitles(self): + """ + Scenario: File name and name of subs are different (Uploading subtitles with different file name than file) + Given I have created a Video component + And I enter a "video_name_1.mp4" source to field number 1 + And I see status message "No Timed Transcript" + And I upload the transcripts file "uk_transcripts.srt" + Then I see status message "Timed Transcript Uploaded Successfully" + And I see value "video_name_1" in the field "Default Timed Transcript" + And I save changes + Then when I view the video it does show the captions + And I edit the component + Then I see status message "Timed Transcript Found" + """ + self._create_video_component() + self.edit_component() + self.video.set_url_field('video_name_1.mp4', 1) + self.assertEqual(self.video.message('status'), 'No Timed Transcript') + self.video.upload_transcript('uk_transcripts.srt') + self.assertEqual(self.video.message('status'), 'Timed Transcript Uploaded Successfully') + self.open_advanced_tab() + self.assertTrue(self.video.verify_field_value('Default Timed Transcript', 'video_name_1')) + self.save_unit_settings() + self.video.is_captions_visible() + self.edit_component() + self.assertEqual(self.video.message('status'), 'Timed Transcript Found') + + def test_video_wo_subtitles(self): + """ + Video can have filled item.sub, but doesn't have subs file. + In this case, after changing this video by another one without subs + `No Timed Transcript` message should appear ( not `Confirm Timed Transcript`). + Scenario: Video w/o subs - another video w/o subs - Not found message + Given I have created a Video component + And I enter a "video_name_1.mp4" source to field number 1 + Then I see status message "No Timed Transcript" + """ + self._create_video_component() + self.edit_component() + self.video.set_url_field('video_name_1.mp4', 1) + self.assertEqual(self.video.message('status'), 'No Timed Transcript')