Commit 4815adb6 by muhammad-ammar

Merge pull request #4869 from edx/ammar/bok-choy-video-transcript-tests-batch2

Bok-Choy Video Transcript Tests Batch 2
parents 62821c3e 75a0d524
...@@ -298,6 +298,7 @@ class XBlockWrapper(PageObject): ...@@ -298,6 +298,7 @@ class XBlockWrapper(PageObject):
BODY_SELECTOR = '.studio-xblock-wrapper' BODY_SELECTOR = '.studio-xblock-wrapper'
NAME_SELECTOR = '.xblock-display-name' NAME_SELECTOR = '.xblock-display-name'
COMPONENT_BUTTONS = { 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', 'advanced_tab': '.editor-tabs li.inner_tab_wrap:nth-child(2) > a',
'save_settings': '.action-save', 'save_settings': '.action-save',
} }
...@@ -373,6 +374,12 @@ class XBlockWrapper(PageObject): ...@@ -373,6 +374,12 @@ class XBlockWrapper(PageObject):
""" """
self._click_button('advanced_tab') self._click_button('advanced_tab')
def open_basic_tab(self):
"""
Click on Basic Tab.
"""
self._click_button('basic_tab')
def save_settings(self): def save_settings(self):
""" """
Click on settings Save button. Click on settings Save button.
......
...@@ -167,7 +167,6 @@ class VideoComponentPage(VideoPage): ...@@ -167,7 +167,6 @@ class VideoComponentPage(VideoPage):
self.click_button('upload_asset', index) self.click_button('upload_asset', index)
self.q(css=CLASS_SELECTORS['attach_asset']).results[0].send_keys(asset_file_path) self.q(css=CLASS_SELECTORS['attach_asset']).results[0].send_keys(asset_file_path)
self.click_button('asset_submit') self.click_button('asset_submit')
# Only srt format transcript files can be uploaded, If an error # Only srt format transcript files can be uploaded, If an error
# occurs due to incorrect transcript file we will return from here # occurs due to incorrect transcript file we will return from here
if asset_type == 'transcript' and self.q(css='#upload_error').present: if asset_type == 'transcript' and self.q(css='#upload_error').present:
...@@ -284,6 +283,7 @@ class VideoComponentPage(VideoPage): ...@@ -284,6 +283,7 @@ class VideoComponentPage(VideoPage):
is_verified = self._verify_setting_entry(setting, is_verified = self._verify_setting_entry(setting,
DEFAULT_SETTINGS[counter][0], DEFAULT_SETTINGS[counter][0],
DEFAULT_SETTINGS[counter][1]) DEFAULT_SETTINGS[counter][1])
if not is_verified: if not is_verified:
return is_verified return is_verified
...@@ -560,21 +560,41 @@ class VideoComponentPage(VideoPage): ...@@ -560,21 +560,41 @@ class VideoComponentPage(VideoPage):
.trigger('input'); .trigger('input');
""".format(selector=CLASS_SELECTORS['url_inputs']) """.format(selector=CLASS_SELECTORS['url_inputs'])
self.browser.execute_script(script) self.browser.execute_script(script)
time.sleep(DELAY) time.sleep(DELAY)
self.wait_for_ajax() 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. Check if a transcript related button is visible.
Arguments: Arguments:
button_name (str): name of button button_name (str): name of button
field_numbers (tuple or None): field numbers to check status for, None means get status for all. index (int): query index
tuple items will be integers and must start from 1 button_text (str or None): text to match with text on a button, if None then don't match texts
Returns: Returns:
bool: is button visible 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')
...@@ -110,6 +110,13 @@ class CMSVideoBaseTest(UniqueCourseTest): ...@@ -110,6 +110,13 @@ class CMSVideoBaseTest(UniqueCourseTest):
# The 0th entry is the unit page itself. # The 0th entry is the unit page itself.
self.unit_page.xblocks[1].open_advanced_tab() 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): def save_unit_settings(self):
""" """
Save component settings. Save component settings.
......
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