-
Notifications
You must be signed in to change notification settings - Fork 79
/
single-file-upload-field.feature
79 lines (74 loc) · 3.84 KB
/
single-file-upload-field.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
@assets @retry
Feature: Single file Upload field
As a cms author
I want to interact with the upload field to select a file
Background:
Given a "page" "About Us" has the "Content" "<p>My awesome content</p>"
And a "image" "folder1/file1.jpg"
And a "image" "folder1/file2.jpg"
And a "folder" "folder1/folder1-1"
And a "employee" "Allen"
And I am logged in with "ADMIN" permissions
And I go to "/admin/test/SilverStripe-FrameworkTest-Model-Employee"
And I click "Allen" in the "#Form_EditForm_SilverStripe-FrameworkTest-Model-Employee" element
And I should see an ".uploadfield" element
Scenario: I can select an existing file
When I click "Choose existing" in the ".uploadfield" element
And I press the "Back" HTML field button
And I select the file named "folder1" in the gallery
When I click on the file named "file1" in the gallery
Then I should see the "Form_fileSelectForm" form
When I press the "Insert" button
Then I should see "file1" in the ".uploadfield-item__title" element
# Required to avoid "unsaved changed" browser dialog
Then I press the "Save" button
Scenario: I can edit and select an existing file
When I click "Choose existing" in the ".uploadfield" element
And I press the "Back" HTML field button
And I select the file named "folder1" in the gallery
And I click on the file named "file1" in the gallery
Then I should see the "Form_fileSelectForm" form
When I press the "Details" button
Then I should see the "Form_fileEditForm" form
And I should see a "Insert" button
When I fill in "Form_fileEditForm_Title" with "file one"
And I click "Save" in the "#Form_fileEditForm" element
Then I should see the "Form_fileSelectForm" form
And I should see "File One" in the ".editor__heading" element
When I press the "Insert" button
Then I should see "File One" in the ".uploadfield-item__title" element
# Required to avoid "unsaved changed" browser dialog
Then I press the "Save" button
Scenario: I can select files
When I click "Choose existing" in the ".uploadfield" element
And I press the "Back" HTML field button
And I select the file named "folder1" in the gallery
And I click on the file named "file1" in the gallery
Then I should see the "Form_fileSelectForm" form
When I press the "Insert" button
Then I should see "file1" in the ".uploadfield-item__title" element
When I click on the ".uploadfield-item__view-btn" element
And I click on the file named "file2" in the gallery
Then I should see the "Form_fileSelectForm" form
When I press the "Insert" button
Then I should see "file2" in the ".uploadfield-item__title" element
# Required to avoid "unsaved changed" browser dialog
Then I press the "Save" button
Scenario: I can use modal breadcrumbs to navigate up levels
When I click "Choose existing" in the ".uploadfield" element
And I press the "Back" HTML field button
And I select the file named "folder1" in the gallery
And I select the file named "folder1-1" in the gallery
Then I should see the breadcrumb link "Files"
And I should see the breadcrumb link "folder1"
And I should not see the breadcrumb link "folder1-1"
When I click on the breadcrumb link "folder1"
Then I should see the file named "folder1-1" in the gallery
And I should not see the breadcrumb link "folder1"
# Validate that we haven't navigated away from the pages admin
And I should see an ".uploadfield" element
When I click on the breadcrumb link "Files"
Then I should see the file named "folder1" in the gallery
And I should not see the breadcrumb link "Files"
# Validate that we haven't navigated away from the pages admin
And I should see an ".uploadfield" element