MDL-63431 atto_media: Fix non-unique id issues and extend tests.
[moodle.git] / lib / editor / atto / plugins / media / tests / behat / media.feature
CommitLineData
d27c8d92 1@editor @editor_atto @atto @atto_media @_file_upload
457a9fa6
DW
2Feature: Add media to Atto
3 To write rich text - I need to add media.
4
28e93cc4 5 Background:
57bee542
RT
6 Given I log in as "admin"
7 And I follow "Manage private files..."
8 And I upload "lib/editor/atto/tests/fixtures/moodle-logo.webm" file to "Files" filemanager
9 And I upload "lib/editor/atto/tests/fixtures/moodle-logo.mp4" file to "Files" filemanager
10 And I upload "lib/editor/atto/tests/fixtures/moodle-logo.png" file to "Files" filemanager
11 And I upload "lib/editor/atto/tests/fixtures/pretty-good-en.vtt" file to "Files" filemanager
12 And I upload "lib/editor/atto/tests/fixtures/pretty-good-sv.vtt" file to "Files" filemanager
13 And I click on "Save changes" "button"
14 And I follow "Profile" in the user menu
15 And I follow "Blog entries"
16 And I follow "Add a new entry"
17 And I set the field "Blog entry body" to "<p>Media test</p>"
18 And I select the text in the "Blog entry body" Atto editor
19 And I set the field "Entry title" to "The best video in the entire world (not really)"
1906a735 20 And I click on "Insert or edit an audio/video file" "button"
28e93cc4
CB
21
22 @javascript
23 Scenario: Insert some media as a link
57bee542
RT
24 Given I click on "Browse repositories..." "button" in the "#id_summary_editor_link .atto_media_source.atto_media_link_source" "css_element"
25 And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
26 And I click on "moodle-logo.webm" "link"
27 And I click on "Select this file" "button"
28 And the field "Enter name" matches value "moodle-logo.webm"
29 And I wait until the page is ready
30 And I click on "Insert media" "button"
31 When I click on "Save changes" "button"
32 Then "//a[. = 'moodle-logo.webm']" "xpath_element" should exist
28e93cc4 33
0030362e 34 @javascript @atto_media_video
28e93cc4 35 Scenario: Insert some media as a plain video
57bee542
RT
36 Given I click on "Video" "link"
37 And I click on "Browse repositories..." "button" in the "#id_summary_editor_video .atto_media_source.atto_media_media_source" "css_element"
38 And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
39 And I click on "moodle-logo.webm" "link"
40 And I click on "Select this file" "button"
41 And I click on "Add alternative source" "link"
42 And I click on "Browse repositories..." "button" in the "#id_summary_editor_video .atto_media_source.atto_media_media_source:nth-of-type(2)" "css_element"
43 And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
44 And I click on "moodle-logo.mp4" "link"
45 And I click on "Select this file" "button"
46 When I click on "Insert media" "button"
47 Then "//video[descendant::source[contains(@src, 'moodle-logo.webm')]][descendant::source[contains(@src, 'moodle-logo.mp4')]]" "xpath_element" should exist
28e93cc4 48
0030362e 49 @javascript @atto_media_video
28e93cc4 50 Scenario: Insert some media as a video with display settings
57bee542
RT
51 Given I click on "Video" "link"
52 And I click on "Browse repositories..." "button" in the "#id_summary_editor_video .atto_media_source.atto_media_media_source" "css_element"
53 And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
54 And I click on "moodle-logo.webm" "link"
55 And I click on "Select this file" "button"
56 And I click on "Display options" "link"
57 And I click on "Browse repositories..." "button" in the "#id_summary_editor_video .atto_media_source.atto_media_poster_source" "css_element"
58 And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
59 And I click on "moodle-logo.png" "link"
60 And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
61 And I change window size to "large"
62 And I set the field with xpath "//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_width_entry ')]" to "420"
63 And I set the field with xpath "//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_height_entry ')]" to "69"
cb694168 64 And I set the field "Enter title" to "VideoTitle"
57bee542
RT
65 And I click on "Display options" "link"
66 When I click on "Insert media" "button"
cb694168 67 Then "//video[descendant::source[contains(@src, 'moodle-logo.webm')]][contains(@poster, 'moodle-logo.png')][@width=420][@height=69][@title='VideoTitle']" "xpath_element" should exist
28e93cc4 68
0030362e 69 @javascript @atto_media_video
28e93cc4 70 Scenario: Insert some media as a video with advanced settings
57bee542
RT
71 Given I click on "Video" "link"
72 And I click on "Browse repositories..." "button" in the "#id_summary_editor_video .atto_media_source.atto_media_media_source" "css_element"
73 And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
74 And I click on "moodle-logo.webm" "link"
75 And I click on "Select this file" "button"
76 And I click on "Advanced settings" "link"
77 And the field "Show controls" matches value "1"
78 And I set the field "Play automatically" to "1"
79 And I set the field "Muted" to "1"
80 And I set the field "Loop" to "1"
81 When I click on "Insert media" "button"
82 Then "//video[descendant::source[contains(@src, 'moodle-logo.webm')]][@controls='true'][@loop='true'][@autoplay='true'][@autoplay='true']" "xpath_element" should exist
457a9fa6 83
0030362e 84 @javascript @atto_media_video
28e93cc4 85 Scenario: Insert some media as a video with tracks
57bee542
RT
86 Given I click on "Video" "link"
87 And I change window size to "large"
88 And I click on "Browse repositories..." "button" in the "#id_summary_editor_video .atto_media_source.atto_media_media_source" "css_element"
89 And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
90 And I click on "moodle-logo.webm" "link"
91 And I click on "Select this file" "button"
92 And I click on "Subtitles and captions" "link"
93 And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_subtitles .atto_media_track_source" "css_element"
94 And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
95 And I click on "pretty-good-sv.vtt" "link"
96 And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
97 And the field "Label" matches value "Swedish"
98 And the field "Language" matches value "sv"
99 And I click on "Add subtitle track" "link"
100 And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_subtitles .atto_media_track~.atto_media_track .atto_media_source.atto_media_track_source" "css_element"
101 And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
102 And I click on "pretty-good-en.vtt" "link"
103 And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
104 And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[2]" matches value "English"
105 And I set the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_default ')])[1]" to "1"
106 And I click on "Captions" "link" in the ".nav-item[data-track-kind='captions']" "css_element"
107 And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_captions .atto_media_track_source" "css_element"
108 And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
109 And I click on "pretty-good-sv.vtt" "link"
110 And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
111 And I click on "Overwrite" "button"
112 And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[3]" matches value "Swedish"
113 And I click on "Add caption track" "link"
114 And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_captions .atto_media_track~.atto_media_track .atto_media_source.atto_media_track_source" "css_element"
115 And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
116 And I click on "pretty-good-en.vtt" "link"
117 And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
118 And I click on "Overwrite" "button"
119 And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[4]" matches value "English"
120 And I set the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_default ')])[4]" to "1"
121 And I click on "Descriptions" "link"
122 And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_descriptions .atto_media_track_source" "css_element"
123 And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
124 And I click on "pretty-good-sv.vtt" "link"
125 And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
126 And I click on "Overwrite" "button"
127 And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[5]" matches value "Swedish"
128 And I click on "Add description track" "link"
129 And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_descriptions .atto_media_track~.atto_media_track .atto_media_source.atto_media_track_source" "css_element"
130 And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
131 And I click on "pretty-good-en.vtt" "link"
132 And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
133 And I click on "Overwrite" "button"
134 And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[6]" matches value "English"
135 And I set the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_default ')])[5]" to "1"
136 And I click on "Chapters" "link"
137 And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_chapters .atto_media_track_source" "css_element"
138 And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
139 And I click on "pretty-good-sv.vtt" "link"
140 And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
141 And I click on "Overwrite" "button"
142 And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[7]" matches value "Swedish"
143 And I click on "Add chapter track" "link"
144 And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_chapters .atto_media_track~.atto_media_track .atto_media_source.atto_media_track_source" "css_element"
145 And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
146 And I click on "pretty-good-en.vtt" "link"
147 And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
148 And I click on "Overwrite" "button"
149 And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[8]" matches value "English"
150 And I set the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_default ')])[8]" to "1"
151 And I click on "Metadata" "link"
152 And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_metadata .atto_media_track_source" "css_element"
153 And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
154 And I click on "pretty-good-sv.vtt" "link"
155 And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
156 And I click on "Overwrite" "button"
157 And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[9]" matches value "Swedish"
158 And I click on "Add metadata track" "link"
159 And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_metadata .atto_media_track~.atto_media_track .atto_media_source.atto_media_track_source" "css_element"
160 And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
161 And I click on "pretty-good-en.vtt" "link"
162 And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
163 And I click on "Overwrite" "button"
164 And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[10]" matches value "English"
165 And I set the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_default ')])[9]" to "1"
166 When I click on "Insert media" "button"
167 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
0030362e
RK
168
169 @javascript @atto_media_audio
170 Scenario: Insert some media as a plain audio
171 Given I click on "Audio" "link"
172 And I click on "Browse repositories..." "button" in the "#id_summary_editor_audio .atto_media_source.atto_media_media_source" "css_element"
173 And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
174 And I click on "moodle-logo.mp4" "link"
175 And I click on "Select this file" "button"
176 When I click on "Insert media" "button"
177 Then "//audio[descendant::source[contains(@src, 'moodle-logo.mp4')]]" "xpath_element" should exist
178
179 @javascript @atto_media_audio
180 Scenario: Insert some media as an audio with display settings
181 Given I click on "Audio" "link"
182 And I click on "Browse repositories..." "button" in the "#id_summary_editor_audio .atto_media_source.atto_media_media_source" "css_element"
183 And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
184 And I click on "moodle-logo.mp4" "link"
185 And I click on "Select this file" "button"
186 And I click on "Display options" "link" in the "#id_summary_editor_audio" "css_element"
187 And I set the field "audio_media-title-entry" to "AudioTitle"
188 When I click on "Insert media" "button"
189 Then "//audio[descendant::source[contains(@src, 'moodle-logo.mp4')]][@title='AudioTitle']" "xpath_element" should exist
190
191 @javascript @atto_media_audio
192 Scenario: Insert some media as an audio with advanced settings
193 Given I click on "Audio" "link"
194 And I click on "Browse repositories..." "button" in the "#id_summary_editor_audio .atto_media_source.atto_media_media_source" "css_element"
195 And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
196 And I click on "moodle-logo.mp4" "link"
197 And I click on "Select this file" "button"
198 And I click on "Advanced settings" "link" in the "#id_summary_editor_audio" "css_element"
199 And the field "audio_media-controls-toggle" matches value "1"
200 And I set the field "audio_media-autoplay-toggle" to "1"
201 And I set the field "audio_media-mute-toggle" to "1"
202 And I set the field "audio_media-loop-toggle" to "1"
203 When I click on "Insert media" "button"
204 Then "//audio[descendant::source[contains(@src, 'moodle-logo.mp4')]][@controls='true'][@loop='true'][@autoplay='true'][@autoplay='true']" "xpath_element" should exist