cirandas.net

ref: master

features/media_panel_upload_files.feature


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
Feature: uploads items on media panel
  As a noosfero user
  I want to uploads items when creating or editing articles

  Background:
    Given the following users
      | login     | name       |
      | joaosilva | Joao Silva |
    And feature "media_panel" is enabled on environment
    And I am logged in as "joaosilva"
    And I am on /myprofile/joaosilva/cms/new?type=TextArticle

  Scenario: see media panel collapsed
    Then I should see "Insert media"
      And I should not see an element ".show-media-panel"

  @selenium
  Scenario: expand media panel
    When I follow "Show/Hide"
    Then I should see an element ".show-media-panel"

  @selenium
  Scenario: upload file showing percentage and name
    When I follow "Show/Hide"
      And I attach the file "public/images/rails.png" to "file"
    Then I should see "100%"
      And I should see "rails.png"

  @selenium
  Scenario: upload multiple files
    When I follow "Show/Hide"
      And I attach the file "public/images/rails.png" to "file"
      And I attach the file "public/503.jpg" to "file"
    Then I should see "rails.png" within "#file-1"
      And I should see "503.jpg" within "#file-2"

  @selenium
  Scenario: show error when upload fails
    When I follow "Show/Hide"
      And I attach the file "public/images/rails.png" to "file"
      # uploads the same file twice to induce error (unique name validation)
      And I attach the file "public/images/rails.png" to "file"
    Then I should see "rails.png" within "#file-1"
      And I should see "100%" within "#file-1"
      But I should see "Validation failed: Slug The title (article name) is already being used by another article, please use another title." within "#file-2"
      And The page should contain "div.error-message"

  @selenium
  Scenario: select destination folder
    When I follow "Show/Hide"
      And I attach the file "public/images/rails.png" to "file"
      And I select "joaosilva" from "parent_id" within "#media-upload-form"
      And I attach the file "public/503.jpg" to "file"
      And I go to joaosilva's cms
    Then I should not see "rails.png"
      But I should see "503.jpg"
    When I follow "Gallery"
    Then I should see "rails.png"
      But I should not see "503.jpg"

  @selenium
  Scenario: create new folder with parent
    Given I follow "Show/Hide"
      And I should see "joaosilva" within "#media-upload-form"
      And I should see "joaosilva/Gallery" within "#media-upload-form"
      And I should see "joaosilva" within "#published-media"
      And I should see "joaosilva/Gallery" within "#published-media"

    When I follow "New folder"
      And I select "joaosilva" from "parent_id" within "#new-folder-dialog"
      And I fill in "Name" with "Main folder" within "#new-folder-dialog"
      And I press "Create"
    Then I should see "joaosilva" within "#media-upload-form"
      And I should see "joaosilva/Gallery" within "#media-upload-form"
      And I should see "joaosilva/Main folder" within "#media-upload-form"
      And "joaosilva/Main folder" should be selected for "parent_id" within "#media-upload-form"
      And I should see "joaosilva" within "#published-media"
      And I should see "joaosilva/Gallery" within "#published-media"
      And I should see "joaosilva/Main folder" within "#published-media"

    When I follow "New folder"
      And I select "joaosilva/Gallery" from "parent_id" within "#new-folder-dialog"
      And I fill in "Name" with "Gallery folder" within "#new-folder-dialog"
      And I press "Create"
    Then I should see "joaosilva" within "#media-upload-form"
      And I should see "joaosilva/Gallery" within "#media-upload-form"
      And I should see "joaosilva/Main folder" within "#media-upload-form"
      And I should see "joaosilva/Gallery/Gallery folder" within "#media-upload-form"
      And "joaosilva/Gallery/Gallery folder" should be selected for "parent_id" within "#media-upload-form"
      And I should see "joaosilva" within "#published-media"
      And I should see "joaosilva/Gallery" within "#published-media"
      And I should see "joaosilva/Main folder" within "#published-media"
      And I should see "joaosilva/Gallery/Gallery folder" within "#published-media"

  @selenium
  Scenario: select type when create new folder
    Given I follow "Show/Hide"
    And I follow "New folder"
    And I choose "Folder" within "#new-folder-dialog"
    And I fill in "Name" with "Main new folder" within "#new-folder-dialog"
    When I press "Create"
    Then I should see "joaosilva/Gallery/Main new folder" within "#parent_id"
    Given I follow "New folder"
    And I choose "Gallery" within "#new-folder-dialog"
    And I fill in "Name" with "Gallery new folder" within "#new-folder-dialog"
    When I press "Create"
    Then I should see "joaosilva/Gallery/Gallery new folder" within "#parent_id"

  @selenium
  Scenario: hide and show upload list
    When I follow "Show/Hide"
      And I attach the file "public/images/rails.png" to "file"
      And I attach the file "public/503.jpg" to "file"
      And I follow "Hide all uploads"
    Then I should not see "503.jpg"
      And I should not see "rails.png"
    When I follow "Show all uploads"
    Then I should see "503.jpg"
      And I should see "rails.png"

  @selenium
  Scenario: update recent media after file upload
    Given the following files
      | owner     | file          | mime       |
      | joaosilva | other-pic.jpg | image/jpeg |
    When I go to /myprofile/joaosilva/cms/new?type=TextArticle
      And I follow "Show/Hide"
      And I select "Recent media" from "parent_id" within "#published-media"
    Then I should see div with title "other-pic.jpg" within ".items"
    When I select "joaosilva" from "parent_id" within "#media-upload-form"
      And I attach the file "public/503.jpg" to "file"
    Then I should see div with title "503.jpg" within ".items"
      And I should see div with title "other-pic.jpg" within ".items"
    When I select "joaosilva/Gallery" from "parent_id" within "#media-upload-form"
      And I attach the file "public/images/rails.png" to "file"
      And I attach the file "public/robots.txt" to "file"
    Then I should see div with title "rails.png" within ".items"
      And I should see div with title "503.jpg" within ".items"
      And I should see div with title "other-pic.jpg" within ".items"
      And I should see "robots.txt" link

  @selenium
  Scenario: select folder to show items
    Given the following galleries
      | owner      | name          |
      | joaosilva  | other-gallery |
    And the following files
      | owner      | file          | mime       | parent        |
      | joaosilva  | rails.png     | image/png  | other-gallery |
      | joaosilva  | other-pic.jpg | image/jpeg | gallery       |
    When I go to /myprofile/joaosilva/cms/new?type=TextArticle
      And I follow "Show/Hide"
      And I select "joaosilva/Gallery" from "parent_id" within "#published-media"
    Then I should see div with title "other-pic.jpg" within ".items"
      And I should not see div with title "rails.png" within ".items"
    When I select "joaosilva/other-gallery" from "parent_id" within "#published-media"
    Then I should see div with title "rails.png" within ".items"
      And I should not see div with title "other-pic.jpg" within ".items"

  @selenium
  Scenario: update selected folder content when upload file to same folder
    Given the following galleries
      | owner      | name          |
      | joaosilva  | other-gallery |
    And the following files
      | owner      | file          | mime       | parent        |
      | joaosilva  | other-pic.jpg | image/jpeg | gallery       |
    When I go to /myprofile/joaosilva/cms/new?type=TextArticle
      And I follow "Show/Hide"
      And I select "joaosilva/Gallery" from "parent_id" within "#published-media"
      And I select "joaosilva/Gallery" from "parent_id" within "#media-upload-form"
      And I attach the file "public/503.jpg" to "file"
    Then I should see div with title "other-pic.jpg" within ".items"
      And I should see div with title "503.jpg" within ".items"

    When I select "joaosilva/other-gallery" from "parent_id" within "#media-upload-form"
      And I attach the file "public/robots.txt" to "file"
    Then I should see div with title "other-pic.jpg" within ".items"
      And I should see div with title "503.jpg" within ".items"
      And I should not see "robots.txt" within ".items"

  @selenium
  Scenario: filter media with search
    Given the following galleries
      | owner      | name          |
      | joaosilva  | other-gallery |
    And the following files
      | owner      | file          | mime       | parent        |
      | joaosilva  | rails.png     | image/png  | other-gallery |
    When I go to /myprofile/joaosilva/cms/new?type=TextArticle
      And I follow "Show/Hide"
      And I select "Recent media" from "parent_id" within "#published-media"
      And I fill in "Search" with "rails" within "#published-media"
    Then I should see div with title "rails.png" within ".items"
    When I select "joaosilva/Gallery" from "parent_id" within "#published-media"
      And I fill in "Search" with "rails" within "#published-media"
    Then I should not see div with title "rails.png" within ".items"
    When I select "joaosilva/other-gallery" from "parent_id" within "#published-media"
      And I fill in "Search" with "rails" within "#published-media"
    Then I should see div with title "rails.png" within ".items"

  @selenium
  Scenario: separete images from non-images
    When I follow "Show/Hide"
    Then I should not see "Images"
      And I should not see "Files"
    When I attach the file "public/robots.txt" to "file"
      And I attach the file "public/images/rails.png" to "file"
    Then I should see "Files"
      And I should see "robots.txt" within ".generics"
      But I should not see "rails.png" within ".generics"
      And I should see "Images"
      And I should see div with title "rails.png" within ".images"
      But I should not see div with title "robots.txt" within ".images"

  @selenium
  Scenario: view all media button if there are too many uploads
    Given the following galleries
      | owner      | name          |
      | joaosilva  | other-gallery |
      | joaosilva  | my-gallery    |
    And the following files
      | owner      | file          | mime       | parent        |
      | joaosilva  | rails.png     | image/png  | other-gallery |
      | joaosilva  | other-pic.jpg | image/jpeg | other-gallery |
      | joaosilva  | rails.png     | image/png  | my-gallery    |
      | joaosilva  | other-pic.jpg | image/jpeg | my-gallery    |
      | joaosilva  | rails.png     | image/png  | gallery       |
      | joaosilva  | other-pic.jpg | image/jpeg | gallery       |
    When I go to /myprofile/joaosilva/cms/new?type=TextArticle
      And I follow "Show/Hide"
      And I should not see "View all"
      And I attach the file "public/503.jpg" to "file"
    Then I should see "View all" link
      And I should see div with title "503.jpg" within ".images"