'Scenario: Language menu works correctly in Video component
Given the course has a Video component in "Youtube" mode
And I have defined multiple language transcripts for the videos
And I make sure captions are closed
And I see video menu "language" with correct items
And I select language with code "zh"
Then I see "å¥œ åäœåå­Š" text in the captions
And I select language with code "en"
Then I see "Welcome to edX." text in the captions'

def test_video_language_menu_working(self):

    self.assets.extend(['chinese_transcripts.srt', 'subs_3_yD_cEKoCk.srt.sjson'])
    data = {'transcripts': {'zh': 'chinese_transcripts.srt'}, 'sub': '3_yD_cEKoCk'}
    self.metadata = self.metadata_for_mode('youtube', additional_data=data)
    self.navigate_to_video()
    self.video.hide_captions()
    correct_languages = {'en': 'English', 'zh': 'Chinese'}
    self.assertEqual(self.video.caption_languages, correct_languages)
    self.video.select_language('zh')
    unicode_text = '\xe5\xa5\xbd    \xe5\x90\x84\xe4\xbd\x8d\xe5\x90\x8c\xe5\xad\xa6'.decode('utf-8')
    self._verify_caption_text(unicode_text)
    self.video.select_language('en')
    self._verify_caption_text('Welcome    to    edX.')
