Skip to content

Commit

Permalink
MDL-63431 atto_media: Fix non-unique id issues and extend tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
kabalin committed Oct 12, 2018
1 parent cb69416 commit 0030362
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 38 deletions.
45 changes: 41 additions & 4 deletions lib/editor/atto/plugins/media/tests/behat/media.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Feature: Add media to Atto
When I click on "Save changes" "button"
Then "//a[. = 'moodle-logo.webm']" "xpath_element" should exist

@javascript
@javascript @atto_media_video
Scenario: Insert some media as a plain video
Given I click on "Video" "link"
And I click on "Browse repositories..." "button" in the "#id_summary_editor_video .atto_media_source.atto_media_media_source" "css_element"
Expand All @@ -46,7 +46,7 @@ Feature: Add media to Atto
When I click on "Insert media" "button"
Then "//video[descendant::source[contains(@src, 'moodle-logo.webm')]][descendant::source[contains(@src, 'moodle-logo.mp4')]]" "xpath_element" should exist

@javascript
@javascript @atto_media_video
Scenario: Insert some media as a video with display settings
Given I click on "Video" "link"
And I click on "Browse repositories..." "button" in the "#id_summary_editor_video .atto_media_source.atto_media_media_source" "css_element"
Expand All @@ -66,7 +66,7 @@ Feature: Add media to Atto
When I click on "Insert media" "button"
Then "//video[descendant::source[contains(@src, 'moodle-logo.webm')]][contains(@poster, 'moodle-logo.png')][@width=420][@height=69][@title='VideoTitle']" "xpath_element" should exist

@javascript
@javascript @atto_media_video
Scenario: Insert some media as a video with advanced settings
Given I click on "Video" "link"
And I click on "Browse repositories..." "button" in the "#id_summary_editor_video .atto_media_source.atto_media_media_source" "css_element"
Expand All @@ -81,7 +81,7 @@ Feature: Add media to Atto
When I click on "Insert media" "button"
Then "//video[descendant::source[contains(@src, 'moodle-logo.webm')]][@controls='true'][@loop='true'][@autoplay='true'][@autoplay='true']" "xpath_element" should exist

@javascript
@javascript @atto_media_video
Scenario: Insert some media as a video with tracks
Given I click on "Video" "link"
And I change window size to "large"
Expand Down Expand Up @@ -165,3 +165,40 @@ Feature: Add media to Atto
And I set the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_default ')])[9]" to "1"
When I click on "Insert media" "button"
Then "//video[descendant::source[contains(@src, 'moodle-logo.webm')]][descendant::track[contains(@src, 'pretty-good-sv.vtt')][@kind='subtitles'][@label='Swedish'][@srclang='sv'][@default='true']][descendant::track[contains(@src, 'pretty-good-en.vtt')][@kind='subtitles'][@label='English'][@srclang='en'][not(@default)]][descendant::track[contains(@src, 'pretty-good-sv.vtt')][@kind='captions'][@label='Swedish'][@srclang='sv'][not(@default)]][descendant::track[contains(@src, 'pretty-good-en.vtt')][@kind='captions'][@label='English'][@srclang='en'][@default='true']][descendant::track[contains(@src, 'pretty-good-sv.vtt')][@kind='descriptions'][@label='Swedish'][@srclang='sv'][@default='true']][descendant::track[contains(@src, 'pretty-good-en.vtt')][@kind='descriptions'][@label='English'][@srclang='en'][not(@default)]][descendant::track[contains(@src, 'pretty-good-sv.vtt')][@kind='chapters'][@label='Swedish'][@srclang='sv'][not(@default)]][descendant::track[contains(@src, 'pretty-good-en.vtt')][@kind='chapters'][@label='English'][@srclang='en'][@default='true']][descendant::track[contains(@src, 'pretty-good-sv.vtt')][@kind='metadata'][@label='Swedish'][@srclang='sv'][@default='true']][descendant::track[contains(@src, 'pretty-good-en.vtt')][@kind='metadata'][@label='English'][@srclang='en'][not(@default)]]" "xpath_element" should exist

@javascript @atto_media_audio
Scenario: Insert some media as a plain audio
Given I click on "Audio" "link"
And I click on "Browse repositories..." "button" in the "#id_summary_editor_audio .atto_media_source.atto_media_media_source" "css_element"
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
And I click on "moodle-logo.mp4" "link"
And I click on "Select this file" "button"
When I click on "Insert media" "button"
Then "//audio[descendant::source[contains(@src, 'moodle-logo.mp4')]]" "xpath_element" should exist

@javascript @atto_media_audio
Scenario: Insert some media as an audio with display settings
Given I click on "Audio" "link"
And I click on "Browse repositories..." "button" in the "#id_summary_editor_audio .atto_media_source.atto_media_media_source" "css_element"
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
And I click on "moodle-logo.mp4" "link"
And I click on "Select this file" "button"
And I click on "Display options" "link" in the "#id_summary_editor_audio" "css_element"
And I set the field "audio_media-title-entry" to "AudioTitle"
When I click on "Insert media" "button"
Then "//audio[descendant::source[contains(@src, 'moodle-logo.mp4')]][@title='AudioTitle']" "xpath_element" should exist

@javascript @atto_media_audio
Scenario: Insert some media as an audio with advanced settings
Given I click on "Audio" "link"
And I click on "Browse repositories..." "button" in the "#id_summary_editor_audio .atto_media_source.atto_media_media_source" "css_element"
And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
And I click on "moodle-logo.mp4" "link"
And I click on "Select this file" "button"
And I click on "Advanced settings" "link" in the "#id_summary_editor_audio" "css_element"
And the field "audio_media-controls-toggle" matches value "1"
And I set the field "audio_media-autoplay-toggle" to "1"
And I set the field "audio_media-mute-toggle" to "1"
And I set the field "audio_media-loop-toggle" to "1"
When I click on "Insert media" "button"
Then "//audio[descendant::source[contains(@src, 'moodle-logo.mp4')]][@controls='true'][@loop='true'][@autoplay='true'][@autoplay='true']" "xpath_element" should exist
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ var COMPONENTNAME = 'atto_media',
'<input name="mform_isexpanded_{{elementid}}_video-advanced-settings" type="hidden">' +
'<legend class="ftoggler">{{get_string "advancedsettings" component}}</legend>' +
'<div class="fcontainer">' +
'{{> form_components.advanced_settings}}' +
'{{renderPartial "form_components.advanced_settings" context=this id=CSS.VIDEO}}' +
'</div>' +
'</fieldset>' +
'<fieldset class="collapsible collapsed" id="{{elementid}}_video-tracks">' +
Expand All @@ -195,7 +195,7 @@ var COMPONENTNAME = 'atto_media',
'<input name="mform_isexpanded_{{elementid}}_audio-advanced-settings" type="hidden">' +
'<legend class="ftoggler">{{get_string "advancedsettings" component}}</legend>' +
'<div class="fcontainer">' +
'{{> form_components.advanced_settings}}' +
'{{renderPartial "form_components.advanced_settings" context=this id=CSS.AUDIO}}' +
'</div>' +
'</fieldset>' +
'<fieldset class="collapsible collapsed" id="{{elementid}}_audio-tracks">' +
Expand Down Expand Up @@ -269,21 +269,29 @@ var COMPONENTNAME = 'atto_media',
'<div class="{{CSS.ADVANCED_SETTINGS}}">' +
'<div class="form-check">' +
'<input type="checkbox" checked="true" class="form-check-input {{CSS.MEDIA_CONTROLS_TOGGLE}}"' +
'id="media-controls-toggle"/>' +
'<label class="form-check-label" for="media-controls-toggle">{{get_string "controls" component}}</label>' +
'id="{{id}}_media-controls-toggle"/>' +
'<label class="form-check-label" for="{{id}}_media-controls-toggle">' +
'{{get_string "controls" component}}' +
'</label>' +
'</div>' +
'<div class="form-check">' +
'<input type="checkbox" class="form-check-input {{CSS.MEDIA_AUTOPLAY_TOGGLE}}"' +
'id="media-autoplay-toggle"/>' +
'<label class="form-check-label" for="media-autoplay-toggle">{{get_string "autoplay" component}}</label>' +
'id="{{id}}_media-autoplay-toggle"/>' +
'<label class="form-check-label" for="{{id}}_media-autoplay-toggle">' +
'{{get_string "autoplay" component}}' +
'</label>' +
'</div>' +
'<div class="form-check">' +
'<input type="checkbox" class="form-check-input {{CSS.MEDIA_MUTE_TOGGLE}}" id="media-mute-toggle"/>' +
'<label class="form-check-label" for="media-mute-toggle">{{get_string "mute" component}}</label>' +
'<input type="checkbox" class="form-check-input {{CSS.MEDIA_MUTE_TOGGLE}}" id="{{id}}_media-mute-toggle"/>' +
'<label class="form-check-label" for="{{id}}_media-mute-toggle">' +
'{{get_string "mute" component}}' +
'</label>' +
'</div>' +
'<div class="form-check">' +
'<input type="checkbox" class="form-check-input {{CSS.MEDIA_LOOP_TOGGLE}}" id="media-loop-toggle"/>' +
'<label class="form-check-label" for="media-loop-toggle">{{get_string "loop" component}}</label>' +
'<input type="checkbox" class="form-check-input {{CSS.MEDIA_LOOP_TOGGLE}}" id="{{id}}_media-loop-toggle"/>' +
'<label class="form-check-label" for="{{id}}_media-loop-toggle">' +
'{{get_string "loop" component}}' +
'</label>' +
'</div>' +
'</div>',
TRACK_TABS: '' +
Expand Down
Loading

0 comments on commit 0030362

Please sign in to comment.