Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ These are notable changes in edx-platform. This is a rolling list of changes,
in roughly chronological order, most recent first. Add your entries at or near
the top. Include a label indicating the component affected.

Blades: Create an upload modal for video transcript translations (BLD-751).

Studio: Add ability to reorder Pages and hide the Wiki page. STUD-1375

Blades: Added template for iFrames. BLD-611.
Expand Down
9 changes: 7 additions & 2 deletions cms/djangoapps/contentstore/features/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,15 @@ def get_codemirror_value(index=0):
return $('div.CodeMirror:eq({})').get(0).CodeMirror.getValue();
""".format(index))

def upload_file(filename):
path = os.path.join(TEST_ROOT, filename)

def attach_file(filename, sub_path):
path = os.path.join(TEST_ROOT, sub_path, filename)
world.browser.execute_script("$('input.file-input').css('display', 'block')")
world.browser.attach_file('file', os.path.abspath(path))


def upload_file(filename, sub_path=''):
attach_file(filename, sub_path)
button_css = '.upload-dialog .action-upload'
world.css_click(button_css)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def verify_setting_entry(setting, display_name, value, explicitly_set):

# Check if the web object is a list type
# If so, we use a slightly different mechanism for determining its value
if setting.has_class('metadata-list-enum') or setting.has_class('metadata-dict'):
if setting.has_class('metadata-list-enum') or setting.has_class('metadata-dict') or setting.has_class('metadata-video-translations'):
list_value = ', '.join(ele.value for ele in setting.find_by_css('.list-settings-item'))
assert_equal(value, list_value)
elif setting.has_class('metadata-videolist-enum'):
Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/features/textbooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def assert_create_new_textbook_msg(_step):

@step(u'I upload the textbook "([^"]*)"$')
def upload_textbook(_step, file_name):
upload_file(file_name)
upload_file(file_name, sub_path="uploads/")


@step(u'I click (on )?the New Textbook button')
Expand Down
24 changes: 12 additions & 12 deletions cms/djangoapps/contentstore/features/transcripts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ Feature: CMS Transcripts
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 "test_transcripts.srt"
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"
Expand All @@ -345,29 +345,29 @@ Feature: CMS Transcripts
And I see button "download_to_edit"
And I see button "upload_new_timed_transcripts"

And I enter a "test_transcripts.webm" source to field number 3
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 "test_transcripts.mp4" source to field number 1
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 "test_transcripts.srt"
And I upload the transcripts file "uk_transcripts.srt"
Then I see status message "uploaded_successfully"
And I see value "test_transcripts" in the field "Transcript (primary)"
And I see value "uk_transcripts" in the field "Transcript (primary)"

And I enter a "t_not_exist.webm" source to field number 2
Then I see status message "replace"

And I see choose button "test_transcripts.mp4" number 1
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 "test_transcripts|t_not_exist" in the field "Transcript (primary)"
And I see value "uk_transcripts|t_not_exist" in the field "Transcript (primary)"

# Flaky test fails occasionally in master. https://edx-wiki.atlassian.net/browse/BLD-927
#21
Expand Down Expand Up @@ -456,7 +456,7 @@ Feature: CMS Transcripts

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 "test_transcripts.srt"
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 "Transcript (primary)"

Expand Down Expand Up @@ -487,7 +487,7 @@ Feature: CMS Transcripts

And I enter a "video_name_2.webm" source to field number 2
And I see status message "not found"
And I upload the transcripts file "test_transcripts.srt"
And I upload the transcripts file "uk_transcripts.srt"
Then I see status message "uploaded_successfully"
And I see value "video_name_1|video_name_2" in the field "Transcript (primary)"

Expand All @@ -503,7 +503,7 @@ Feature: CMS Transcripts
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 "upload_new_timed_transcripts"
And I upload the transcripts file "test_transcripts.srt"
And I upload the transcripts file "uk_transcripts.srt"
Then I see status message "uploaded_successfully"

And I save changes
Expand All @@ -525,7 +525,7 @@ Feature: CMS Transcripts
Then I see status message "not found"
And I see button "upload_new_timed_transcripts"

And I upload the transcripts file "test_transcripts.srt"
And I upload the transcripts file "uk_transcripts.srt"
Then I see status message "uploaded_successfully"
And I clear field number 1
Then I see status message "found"
Expand Down Expand Up @@ -690,7 +690,7 @@ Feature: CMS Transcripts

And I enter a "video_name_1.1.2.mp4" source to field number 1
And I see status message "not found"
And I upload the transcripts file "test_transcripts.srt"
And I upload the transcripts file "uk_transcripts.srt"
Then I see status message "uploaded_successfully"
And I see value "video_name_1.1.2" in the field "Transcript (primary)"

Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/features/transcripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def i_enter_a_source(_step, link, index):
def upload_file(_step, file_name):
path = os.path.join(TEST_ROOT, 'uploads/', file_name.strip())
world.browser.execute_script("$('form.file-chooser').show()")
world.browser.attach_file('file', os.path.abspath(path))
world.browser.attach_file('transcript-file', os.path.abspath(path))
world.wait_for_ajax_complete()


Expand Down
195 changes: 195 additions & 0 deletions cms/djangoapps/contentstore/features/video-editor.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
Feature: CMS Video Component Editor
As a course author, I want to be able to create video components

# 1
Scenario: User can view Video metadata
Given I have created a Video component
And I edit the component
Then I see the correct video settings and default values

# 2
# Safari has trouble saving values on Sauce
@skip_safari
Scenario: User can modify Video display name
Expand All @@ -16,16 +18,209 @@ Feature: CMS Video Component Editor
Then I can modify the display name
And my video display name change is persisted on save

# 3
# Sauce Labs cannot delete cookies
@skip_sauce
Scenario: Captions are hidden when "transcript display" is false
Given I have created a Video component with subtitles
And I have set "transcript display" to False
Then when I view the video it does not show the captions

# 4
# Sauce Labs cannot delete cookies
@skip_sauce
Scenario: Captions are shown when "transcript display" is true
Given I have created a Video component with subtitles
And I have set "transcript display" to True
Then when I view the video it does show the captions

# 5
Scenario: Translations uploading works correctly
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 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"
And I upload transcript file "uk_transcripts.srt" 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused as to why it defaults to uk on the double uploads below but is sticky with the existing zh here. I suppose my real question is whether the double upload tests should do something to ensure the selected language is uk or is it purely a matter of the order in the listing and is that order predictable and guaranteed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused as to why it defaults to uk on the double uploads below but is sticky with the existing zh here. I suppose my real question is whether the double upload tests should do something to ensure the selected language is uk or is it purely a matter of the order in the listing and is that order predictable and guaranteed?

To make sure that after editing previously created video module and adding new translations will not change currently used translation.
As you can see in this test, we have created video module with chinese translation and then edit this module by adding new translation.
Logic is here

And video language menu has "uk, zh" translations

# 6
Scenario: User can upload transcript file with > 1mb size
Given I have created a Video component
And I edit the component
And I open tab "Advanced"
And I upload transcript file "1mb_transcripts.srt" for "uk" 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

# 7
Scenario: Translations downloading 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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this step, it has the zh file already, right? Then this step overwrites that file? Why does this step change the default to uk? (Same question asked above)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this step, it has the zh file already, right? Then this step overwrites that file? Why does this step change the default to uk? (Same question asked above)

For the newly created video module it uses a first translation from uploaded translations sorted by language code(http://loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt according to http://en.wikipedia.org/wiki/ISO_639-1) as primary.
After merging sub and transcripts fields, we'll add possibility to choose primary translation, but it's a part of another PR.
Code is here

|lang_code|filename |
|uk |uk_transcripts.srt |
|zh |chinese_transcripts.srt|
And I save changes
And I edit the component
And I open tab "Advanced"
And I see translations for "uk, zh"
And video language menu has "uk, zh" translations
Then I can download transcript for "zh" language code, that contains text "好 各位同学"
And I can download transcript for "uk" language code, that contains text "Привіт, edX вітає вас."

# 8
Scenario: Translations downloading 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 files:
|lang_code|filename |
|uk |uk_transcripts.srt |
|zh |chinese_transcripts.srt|
Then I can download transcript for "zh" language code, that contains text "好 各位同学"
And I can download transcript for "uk" language code, that contains text "Привіт, edX вітає вас."

# 9
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

# 10
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

# 11
Scenario: Translations clearing 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"
And I click button "Clear"
And I save changes
Then when I view the video it does not show the captions

# 12
Scenario: Translations clearing 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 files:
|lang_code|filename |
|uk |uk_transcripts.srt |
|zh |chinese_transcripts.srt|
And I click button "Clear"
And I save changes
Then when I view the video it does not show the captions

# 13
Scenario: User cannot upload translations in sjson format
Given I have created a Video component
And I edit the component
And I open tab "Advanced"
And I click button "Add"
And I choose "uk" language code
And I try to upload transcript file "uk_transcripts.sjson"
Then I see validation error "Only SRT files can be uploaded. Please select a file ending in .srt to upload."

# 14
Scenario: User can easy replace the translation by another one w/ preliminary saving
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 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"
And I replace transcript file for "zh" language code by "uk_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

# 15
Scenario: User can easy replace the translation by another one 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 "chinese_transcripts.srt" for "zh" language code
And I see translations for "zh"
And I replace transcript file for "zh" language code by "uk_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

# 16
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

# 17
Scenario: User cannot select the same language twice
Given I have created a Video component
And I edit the component
And I open tab "Advanced"
And I click button "Add"
And I choose "zh" language code
And I click button "Add"
Then I cannot choose "zh" language code

Loading