Commit 2d64a277 by polesye

Fix acceptance tests.

parent 83988724
...@@ -17,12 +17,13 @@ TEST_ROOT = settings.COMMON_TEST_DATA_ROOT ...@@ -17,12 +17,13 @@ TEST_ROOT = settings.COMMON_TEST_DATA_ROOT
DELAY = 0.5 DELAY = 0.5
ERROR_MESSAGES = { ERROR_MESSAGES = {
'url_format': u'Incorrect URL format.', 'url_format': u'Incorrect url format.',
'file_type': u'Video file types must be unique.', 'file_type': u'Link types should be unique.',
} }
STATUSES = { STATUSES = {
'found': u'Timed Transcript Found', 'found': u'Timed Transcript Found',
'not found on edx': u'No EdX Timed Transcript',
'not found': u'No Timed Transcript', 'not found': u'No Timed Transcript',
'replace': u'Timed Transcript Conflict', 'replace': u'Timed Transcript Conflict',
'uploaded_successfully': u'Timed Transcript Uploaded Successfully', 'uploaded_successfully': u'Timed Transcript Uploaded Successfully',
...@@ -39,13 +40,13 @@ SELECTORS = { ...@@ -39,13 +40,13 @@ SELECTORS = {
# button type , button css selector, button message # button type , button css selector, button message
TRANSCRIPTS_BUTTONS = { TRANSCRIPTS_BUTTONS = {
'import': ('.setting-import', 'Import YouTube Transcript'), 'import': ('.setting-import', 'Import YouTube Transcript'),
'download_to_edit': ('.setting-download', 'Download Transcript for Editing'), 'download_to_edit': ('.setting-download', 'Download Transcript for Editing'),
'disabled_download_to_edit': ('.setting-download.is-disabled', 'Download Transcript for Editing'), 'disabled_download_to_edit': ('.setting-download.is-disabled', 'Download Transcript for Editing'),
'upload_new_timed_transcripts': ('.setting-upload', 'Upload New Timed Transcript'), 'upload_new_timed_transcripts': ('.setting-upload', 'Upload New Transcript'),
'replace': ('.setting-replace', 'Yes, replace the edX transcript with the YouTube transcript'), 'replace': ('.setting-replace', 'Yes, replace the edX transcript with the YouTube transcript'),
'choose': ('.setting-choose', 'Timed Transcript from {}'), 'choose': ('.setting-choose', 'Timed Transcript from {}'),
'use_existing': ('.setting-use-existing', 'Use Existing Timed Transcript'), 'use_existing': ('.setting-use-existing', 'Use Current Transcript'),
} }
...@@ -210,7 +211,8 @@ def check_text_in_the_captions(_step, text): ...@@ -210,7 +211,8 @@ def check_text_in_the_captions(_step, text):
@step('I see value "([^"]*)" in the field "([^"]*)"$') @step('I see value "([^"]*)" in the field "([^"]*)"$')
def check_transcripts_field(_step, values, field_name): def check_transcripts_field(_step, values, field_name):
world.select_editor_tab('Advanced') world.select_editor_tab('Advanced')
field_id = '#' + world.browser.find_by_xpath('//label[text()="%s"]' % field_name.strip())[0]['for'] tab = world.css_find('#settings-tab').first;
field_id = '#' + tab.find_by_xpath('.//label[text()="%s"]' % field_name.strip())[0]['for']
values_list = [i.strip() == world.css_value(field_id) for i in values.split('|')] values_list = [i.strip() == world.css_value(field_id) for i in values.split('|')]
assert any(values_list) assert any(values_list)
world.select_editor_tab('Basic') world.select_editor_tab('Basic')
...@@ -228,8 +230,9 @@ def open_tab(_step, tab_name): ...@@ -228,8 +230,9 @@ def open_tab(_step, tab_name):
@step('I set value "([^"]*)" to the field "([^"]*)"$') @step('I set value "([^"]*)" to the field "([^"]*)"$')
def set_value_transcripts_field(_step, value, field_name): def set_value_transcripts_field(_step, value, field_name):
XPATH = '//label[text()="{name}"]'.format(name=field_name) tab = world.css_find('#settings-tab').first;
SELECTOR = '#' + world.browser.find_by_xpath(XPATH)[0]['for'] XPATH = './/label[text()="{name}"]'.format(name=field_name)
SELECTOR = '#' + tab.find_by_xpath(XPATH)[0]['for']
element = world.css_find(SELECTOR).first element = world.css_find(SELECTOR).first
if element['type'] == 'text': if element['type'] == 'text':
SCRIPT = '$("{selector}").val("{value}").change()'.format( SCRIPT = '$("{selector}").val("{value}").change()'.format(
......
...@@ -72,8 +72,8 @@ Feature: CMS Video Component ...@@ -72,8 +72,8 @@ Feature: CMS Video Component
And Make sure captions are closed And Make sure captions are closed
And I edit the component And I edit the component
And I open tab "Advanced" And I open tab "Advanced"
And I set value "00:00:12" to the field "Start Time" And I set value "00:00:12" to the field "Video Start Time"
And I set value "00:00:24" to the field "End Time" And I set value "00:00:24" to the field "Video Stop Time"
And I save changes And I save changes
And I click video button "play" And I click video button "play"
Then I see a range on slider Then I see a range on slider
...@@ -85,8 +85,8 @@ Feature: CMS Video Component ...@@ -85,8 +85,8 @@ Feature: CMS Video Component
# And Make sure captions are closed # And Make sure captions are closed
# And I edit the component # And I edit the component
# And I open tab "Advanced" # And I open tab "Advanced"
# And I set value "00:00:12" to the field "Start Time" # And I set value "00:00:12" to the field "Video Start Time"
# And I set value "00:00:24" to the field "End Time" # And I set value "00:00:24" to the field "Video Stop Time"
# And I save changes # And I save changes
# And I click video button "play" # And I click video button "play"
# Then I see a range on slider # Then I see a range on slider
...@@ -103,8 +103,8 @@ Feature: CMS Video Component ...@@ -103,8 +103,8 @@ Feature: CMS Video Component
# And Make sure captions are closed # And Make sure captions are closed
# And I edit the component # And I edit the component
# And I open tab "Advanced" # And I open tab "Advanced"
# And I set value "00:00:12" to the field "Start Time" # And I set value "00:00:12" to the field "Video Start Time"
# And I set value "00:00:24" to the field "End Time" # And I set value "00:00:24" to the field "Video Stop Time"
# And I save changes # And I save changes
# And I click video button "play" # And I click video button "play"
# Then I see a range on slider # Then I see a range on slider
...@@ -121,8 +121,8 @@ Feature: CMS Video Component ...@@ -121,8 +121,8 @@ Feature: CMS Video Component
# And Make sure captions are closed # And Make sure captions are closed
# And I edit the component # And I edit the component
# And I open tab "Advanced" # And I open tab "Advanced"
# And I set value "00:00:12" to the field "Start Time" # And I set value "00:00:12" to the field "Video Start Time"
# And I set value "00:00:24" to the field "End Time" # And I set value "00:00:24" to the field "Video Stop Time"
# And I save changes # And I save changes
# And I click video button "play" # And I click video button "play"
# Then I see a range on slider # Then I see a range on slider
......
...@@ -15,7 +15,7 @@ Feature: CMS Video Component Editor ...@@ -15,7 +15,7 @@ Feature: CMS Video Component Editor
Given I have created a Video component Given I have created a Video component
And I edit the component And I edit the component
And I open tab "Advanced" And I open tab "Advanced"
Then I can modify the display name Then I can modify video display name
And my video display name change is persisted on save And my video display name change is persisted on save
# 3 # 3
......
...@@ -11,6 +11,7 @@ from common import upload_file, attach_file ...@@ -11,6 +11,7 @@ from common import upload_file, attach_file
TEST_ROOT = settings.COMMON_TEST_DATA_ROOT TEST_ROOT = settings.COMMON_TEST_DATA_ROOT
DISPLAY_NAME = "Component Display Name"
NATIVE_LANGUAGES = {lang: label for lang, label in settings.LANGUAGES if len(lang) == 2} NATIVE_LANGUAGES = {lang: label for lang, label in settings.LANGUAGES if len(lang) == 2}
LANGUAGES = { LANGUAGES = {
lang: NATIVE_LANGUAGES.get(lang, display) lang: NATIVE_LANGUAGES.get(lang, display)
...@@ -76,7 +77,7 @@ def success_upload_file(filename): ...@@ -76,7 +77,7 @@ def success_upload_file(filename):
def get_translations_container(): def get_translations_container():
return world.browser.find_by_xpath('//label[text()="Transcript Translations"]/following-sibling::div') return world.browser.find_by_xpath('//label[text()="Transcript Languages"]/following-sibling::div')
def get_setting_container(lang_code): def get_setting_container(lang_code):
...@@ -114,7 +115,7 @@ def set_show_captions(step, setting): ...@@ -114,7 +115,7 @@ def set_show_captions(step, setting):
world.edit_component() world.edit_component()
world.select_editor_tab('Advanced') world.select_editor_tab('Advanced')
world.browser.select('Transcript Display', setting) world.browser.select('Show Transcript', setting)
world.save_component() world.save_component()
...@@ -136,25 +137,25 @@ def shows_captions(_step, show_captions): ...@@ -136,25 +137,25 @@ def shows_captions(_step, show_captions):
def correct_video_settings(_step): def correct_video_settings(_step):
expected_entries = [ expected_entries = [
# basic # basic
['Display Name', 'Video', False], [DISPLAY_NAME, 'Video', False],
['Video URL', 'http://youtu.be/OEoXaMPEzfM, , ', False], ['Default Video URL', 'http://youtu.be/OEoXaMPEzfM, , ', False],
# advanced # advanced
['Display Name', 'Video', False], [DISPLAY_NAME, 'Video', False],
['Download Transcript', '', False], ['Default Timed Transcript', '', False],
['End Time', '00:00:00', False], ['Download Transcript Allowed', 'False', False],
['Start Time', '00:00:00', False], ['Downloadable Transcript URL', '', False],
['Transcript (primary)', '', False], ['Show Transcript', 'True', False],
['Transcript Display', 'True', False], ['Transcript Languages', '', False],
['Transcript Download Allowed', 'False', False],
['Transcript Translations', '', False],
['Upload Handout', '', False], ['Upload Handout', '', False],
['Video Download Allowed', 'False', False], ['Video Download Allowed', 'False', False],
['Video Sources', '', False], ['Video File URLs', '', False],
['Youtube ID', 'OEoXaMPEzfM', False], ['Video Start Time', '00:00:00', False],
['Youtube ID for .75x speed', '', False], ['Video Stop Time', '00:00:00', False],
['Youtube ID for 1.25x speed', '', False], ['YouTube ID', 'OEoXaMPEzfM', False],
['Youtube ID for 1.5x speed', '', False] ['YouTube ID for .75x speed', '', False],
['YouTube ID for 1.25x speed', '', False],
['YouTube ID for 1.5x speed', '', False]
] ]
world.verify_all_setting_entries(expected_entries) world.verify_all_setting_entries(expected_entries)
...@@ -167,11 +168,18 @@ def video_name_persisted(step): ...@@ -167,11 +168,18 @@ def video_name_persisted(step):
world.edit_component() world.edit_component()
world.verify_setting_entry( world.verify_setting_entry(
world.get_setting_entry('Display Name'), world.get_setting_entry(DISPLAY_NAME),
'Display Name', '3.4', True DISPLAY_NAME, '3.4', True
) )
@step('I can modify video display name')
def i_can_modify_video_display_name(_step):
index = world.get_setting_entry_index(DISPLAY_NAME)
world.set_field_value(index, '3.4')
world.verify_setting_entry(world.get_setting_entry(DISPLAY_NAME), DISPLAY_NAME, '3.4', True)
@step('I upload transcript file(?:s)?:$') @step('I upload transcript file(?:s)?:$')
def upload_transcript(step): def upload_transcript(step):
input_hidden = '.metadata-video-translations .input' input_hidden = '.metadata-video-translations .input'
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
<%= gettext("Error.") %> <%= gettext("Error.") %>
</p> </p>
<div class="wrapper-transcripts-buttons"> <div class="wrapper-transcripts-buttons">
<button class="action setting-upload" type="button" name="setting-upload" value="<%= gettext("Upload New Timed Transcript") %>" data-tooltip="<%= gettext("Upload New Timed Transcript") %>"> <button class="action setting-upload" type="button" name="setting-upload" value="<%= gettext("Upload New Transcript") %>" data-tooltip="<%= gettext("Upload New Transcript") %>">
<%= gettext("Upload New Timed Transcript") %> <%= gettext("Upload New Transcript") %>
</button> </button>
<a class="action setting-download is-disabled" href="javascropt: void(0);" data-tooltip="<%= gettext("Download Transcript for Editing") %>"> <a class="action setting-download is-disabled" href="javascropt: void(0);" data-tooltip="<%= gettext("Download Transcript for Editing") %>">
<%= gettext("Download Transcript for Editing") %> <%= gettext("Download Transcript for Editing") %>
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
<%= gettext("Error.") %> <%= gettext("Error.") %>
</p> </p>
<div class="wrapper-transcripts-buttons"> <div class="wrapper-transcripts-buttons">
<button class="action setting-upload" type="button" name="setting-upload" value="<%= gettext("Upload New Timed Transcript") %>" data-tooltip="<%= gettext("Upload New Timed Transcript") %>"> <button class="action setting-upload" type="button" name="setting-upload" value="<%= gettext("Upload New Transcript") %>" data-tooltip="<%= gettext("Upload New Transcript") %>">
<span><%= gettext("Upload New Timed Transcript") %></span> <span><%= gettext("Upload New Transcript") %></span>
</button> </button>
<a class="action setting-download" href="/transcripts/download?locator=<%= component_locator %>&subs_id=<%= subs_id %>" data-tooltip="<%= gettext("Download Transcript for Editing") %>"> <a class="action setting-download" href="/transcripts/download?locator=<%= component_locator %>&subs_id=<%= subs_id %>" data-tooltip="<%= gettext("Download Transcript for Editing") %>">
<span><%= gettext("Download Transcript for Editing") %></span> <span><%= gettext("Download Transcript for Editing") %></span>
......
...@@ -18,22 +18,22 @@ ...@@ -18,22 +18,22 @@
class="action setting-use-existing" class="action setting-use-existing"
type="button" type="button"
name="setting-use-existing" name="setting-use-existing"
value="<%= gettext("Use Current Timed Transcript") %>" value="<%= gettext("Use Current Transcript") %>"
data-tooltip="<%= gettext("Use Current Timed Transcript") %>" data-tooltip="<%= gettext("Use Current Transcript") %>"
> >
<span> <span>
<%= gettext("Use Current Timed Transcript") %> <%= gettext("Use Current Transcript") %>
</span> </span>
</button> </button>
<button <button
class="action setting-upload" class="action setting-upload"
type="button" type="button"
name="setting-upload" name="setting-upload"
value="<%= gettext("Upload New Timed Transcript") %>" value="<%= gettext("Upload New Transcript") %>"
data-tooltip="<%= gettext("Upload New Timed Transcript") %>" data-tooltip="<%= gettext("Upload New Transcript") %>"
> >
<span> <span>
<%= gettext("Upload New Timed Transcript") %> <%= gettext("Upload New Transcript") %>
</span> </span>
</button> </button>
</div> </div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment