Commit f93e4f27 by Muhammad Ammar

Bok-Choy CMS Video Editor Tests

parent 70d47fb5
@shard_1 @requires_stub_youtube
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
Given I have created a Video component
And I edit the component
And I open tab "Advanced"
Then I can modify video 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
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:
|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
# 18
Scenario: User can see table of content at the first position
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 |
|table |chinese_transcripts.srt|
And I save changes
Then when I view the video it does show the captions
And I see "好 各位同学" text in the captions
And video language menu has "table, uk" translations
And I see video language with code "table" at position "0"
...@@ -301,9 +301,7 @@ class VideoPage(PageObject): ...@@ -301,9 +301,7 @@ class VideoPage(PageObject):
str: Captions Text. str: Captions Text.
""" """
# wait until captions rendered completely self.wait_for_captions()
captions_rendered_selector = self.get_element_selector(CSS_CLASS_NAMES['captions_rendered'])
self.wait_for_element_presence(captions_rendered_selector, 'Captions Rendered')
captions_selector = self.get_element_selector(CSS_CLASS_NAMES['captions_text']) captions_selector = self.get_element_selector(CSS_CLASS_NAMES['captions_text'])
subs = self.q(css=captions_selector).html subs = self.q(css=captions_selector).html
...@@ -535,9 +533,7 @@ class VideoPage(PageObject): ...@@ -535,9 +533,7 @@ class VideoPage(PageObject):
captions_selector = self.get_element_selector(CSS_CLASS_NAMES['captions']) captions_selector = self.get_element_selector(CSS_CLASS_NAMES['captions'])
EmptyPromise(lambda: self.q(css=captions_selector).visible, 'Subtitles Visible').fulfill() EmptyPromise(lambda: self.q(css=captions_selector).visible, 'Subtitles Visible').fulfill()
# wait until captions rendered completely self.wait_for_captions()
captions_rendered_selector = self.get_element_selector(CSS_CLASS_NAMES['captions_rendered'])
self.wait_for_element_presence(captions_rendered_selector, 'Captions Rendered')
return True return True
...@@ -799,3 +795,10 @@ class VideoPage(PageObject): ...@@ -799,3 +795,10 @@ class VideoPage(PageObject):
classes = self.q(css=selector).attrs('class')[0].split() classes = self.q(css=selector).attrs('class')[0].split()
return 'active' in classes return 'active' in classes
def wait_for_captions(self):
"""
Wait until captions rendered completely.
"""
captions_rendered_selector = self.get_element_selector(CSS_CLASS_NAMES['captions_rendered'])
self.wait_for_element_presence(captions_rendered_selector, 'Captions Rendered')
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
""" """
Acceptance tests for CMS Video Module. Acceptance tests for CMS Video Module.
""" """
from nose.plugins.attrib import attr
from unittest import skipIf from unittest import skipIf
from ...pages.studio.auto_auth import AutoAuthPage from ...pages.studio.auto_auth import AutoAuthPage
from ...pages.studio.overview import CourseOutlinePage from ...pages.studio.overview import CourseOutlinePage
...@@ -12,6 +12,7 @@ from ...fixtures.course import CourseFixture, XBlockFixtureDesc ...@@ -12,6 +12,7 @@ from ...fixtures.course import CourseFixture, XBlockFixtureDesc
from ..helpers import UniqueCourseTest, is_youtube_available, YouTubeStubConfig from ..helpers import UniqueCourseTest, is_youtube_available, YouTubeStubConfig
@attr('shard_2')
@skipIf(is_youtube_available() is False, 'YouTube is not available!') @skipIf(is_youtube_available() is False, 'YouTube is not available!')
class CMSVideoBaseTest(UniqueCourseTest): class CMSVideoBaseTest(UniqueCourseTest):
""" """
...@@ -281,9 +282,9 @@ class CMSVideoTest(CMSVideoBaseTest): ...@@ -281,9 +282,9 @@ class CMSVideoTest(CMSVideoBaseTest):
self.open_advanced_tab() self.open_advanced_tab()
self.video.set_settings_field_value('Video Start Time', '00:00:12') self.video.set_field_value('Video Start Time', '00:00:12')
self.video.set_settings_field_value('Video Stop Time', '00:00:24') self.video.set_field_value('Video Stop Time', '00:00:24')
self.save_unit_settings() self.save_unit_settings()
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
""" """
Acceptance tests for Video. Acceptance tests for Video.
""" """
from nose.plugins.attrib import attr
from unittest import skipIf, skip from unittest import skipIf, skip
from ..helpers import UniqueCourseTest, is_youtube_available, YouTubeStubConfig from ..helpers import UniqueCourseTest, is_youtube_available, YouTubeStubConfig
from ...pages.lms.video.video import VideoPage from ...pages.lms.video.video import VideoPage
...@@ -28,6 +28,7 @@ HTML5_SOURCES_INCORRECT = [ ...@@ -28,6 +28,7 @@ HTML5_SOURCES_INCORRECT = [
] ]
@attr('shard_2')
@skipIf(is_youtube_available() is False, 'YouTube is not available!') @skipIf(is_youtube_available() is False, 'YouTube is not available!')
class VideoBaseTest(UniqueCourseTest): class VideoBaseTest(UniqueCourseTest):
""" """
......
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