Commit b1102e8 1 parent e4d8523 commit b1102e8 Copy full SHA for b1102e8
File tree 2 files changed +55
-0
lines changed
staff_features/digital_objects
2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ Feature : Digital Object File versions
2
+ Background :
3
+ Given an administrator user is logged in
4
+ And a Digital Object has been created
5
+ And the Digital Object is opened in the edit mode
6
+ Scenario : Add a single File Version with required fields
7
+ When the user clicks on 'Add File Version' in the 'File Versions' form
8
+ And the user fills in 'File URI' with 'http://example.com/file.pdf'
9
+ And the user clicks on 'Save Digital Object'
10
+ Then the 'Digital Object' updated message is displayed
11
+ And a new File Version is added to the Digital Object with the following values
12
+ | File URI | http ://example .com /file .pdf |
13
+ Scenario : Remove a File Version from a Digital Object
14
+ Given the user has added a File Version to the Digital Object with the following values
15
+ | File URI | http ://example .com /file .pdf |
16
+ When the user clicks on remove icon in the 'File Version' form
17
+ And the user clicks on 'Confirm Removal'
18
+ And the user clicks on 'Save Digital Object'
19
+ And the 'Digital Object' updated message is displayed
20
+ Then the File Version is removed from the Digital Object
Original file line number Diff line number Diff line change 10
10
select 'Single' , from : 'digital_object_dates__0__date_type_'
11
11
fill_in 'digital_object_dates__0__begin_' , with : '2000-01-01'
12
12
13
+ @digital_object_number_of_file_versions = 0
14
+
13
15
click_on 'Save'
14
16
15
17
wait_for_ajax
100
102
101
103
expect ( page ) . to have_field ( 'Identifier' , with : "Digital Object Identifier #{ @uuid } " )
102
104
end
105
+
106
+ Then 'a new File Version is added to the Digital Object with the following values' do |form_values_table |
107
+ subrecords = all ( '#digital_object_file_versions_ .subrecord-form-list li' )
108
+
109
+ expect ( subrecords . length ) . to eq @digital_object_number_of_file_versions + 1
110
+
111
+ created_subrecord = subrecords . last
112
+
113
+ form_values_hash = form_values_table . rows_hash
114
+ form_values_hash . each do |field , value |
115
+ expect ( created_subrecord . find_field ( field ) . value ) . to eq value . downcase . gsub ( ' ' , '_' )
116
+ end
117
+ end
118
+
119
+ Given 'the user has added a File Version to the Digital Object with the following values' do |form_values_table |
120
+ click_on 'Add File Version'
121
+
122
+ form_values_hash = form_values_table . rows_hash
123
+ form_values_hash . each do |field , value |
124
+ fill_in field , with : value
125
+ end
126
+
127
+ click_on 'Save'
128
+ wait_for_ajax
129
+
130
+ @digital_object_number_of_file_versions += 1
131
+ end
132
+
133
+ Then 'the File Version is removed from the Digital Object' do
134
+ subrecords = all ( '#digital_object_file_versions_ .subrecord-form-list li' )
135
+
136
+ expect ( subrecords . length ) . to eq @digital_object_number_of_file_versions - 1
137
+ end
You can’t perform that action at this time.
0 commit comments