|
158 | 158 | expect(page).to have_text "Digital Object Title #{@uuid}"
|
159 | 159 | end
|
160 | 160 |
|
161 |
| -Then 'the Assessment is linked to the Digital Object in the {string} form' do |form_title| |
162 |
| - section_title = find('h3', text: form_title) |
163 |
| - section = section_title.ancestor('section') |
164 |
| - expect(section[:id]).to_not eq nil |
| 161 | +Then 'the Digital Object Component with Label {string} is saved as a child of the Digital Object' do |text| |
| 162 | + records = all('#tree-container .table-row', text:) |
165 | 163 |
|
166 |
| - related_accessions_elements = section.all('li.token-input-token') |
| 164 | + expect(records.length).to eq 1 |
| 165 | + expect(records[0][:class]).to include 'indent-level-1 current' |
167 | 166 |
|
168 |
| - expect(related_accessions_elements.length).to eq 1 |
169 |
| - related_accession = related_accessions_elements[0].find('.digital_object') |
| 167 | + expect(page).to have_css "#tree-container #digital_object_#{@digital_object_id} + .table-row-group #digital_object_component_#{@created_record_id}" |
| 168 | +end |
| 169 | + |
| 170 | +Then 'the Digital Object Component with Title {string} is saved as a sibling of the selected Digital Object Component' do |title| |
| 171 | + records = all('#tree-container .table-row', text: title) |
| 172 | + |
| 173 | + expect(records.length).to eq 1 |
| 174 | + expect(records[0][:class]).to include 'indent-level-1 current' |
| 175 | + expect(page).to have_css "#tree-container #digital_object_#{@digital_object_id} + .table-row-group #digital_object_component_#{@created_record_id}" |
| 176 | +end |
| 177 | + |
| 178 | +Given 'a Digital Object with a Digital Object Component has been created' do |
| 179 | + visit "#{STAFF_URL}/digital_objects/new" |
| 180 | + |
| 181 | + fill_in 'digital_object_digital_object_id_', with: "Digital Object Identifier #{@uuid}" |
| 182 | + fill_in 'digital_object_title_', with: "Digital Object Title #{@uuid}" |
| 183 | + |
| 184 | + click_on 'Add Date' |
| 185 | + select 'Single', from: 'digital_object_dates__0__date_type_' |
| 186 | + fill_in 'digital_object_dates__0__begin_', with: '2000-01-01' |
| 187 | + |
| 188 | + click_on 'Save' |
| 189 | + |
| 190 | + wait_for_ajax |
| 191 | + expect(find('.alert.alert-success.with-hide-alert').text).to have_text "Digital Object Digital Object Title #{@uuid} Created" |
| 192 | + @digital_object_id = current_url.split('::digital_object_').pop |
| 193 | + |
| 194 | + click_on 'Add Child' |
| 195 | + wait_for_ajax |
| 196 | + |
| 197 | + fill_in 'Label', with: "Digital Object Component Label #{@uuid}" |
| 198 | + click_on 'Save' |
| 199 | + wait_for_ajax |
| 200 | + |
| 201 | + expect(find('.alert.alert-success.with-hide-alert').text).to eq "Digital Object Component created on Digital Object Digital Object Title #{@uuid}" |
| 202 | +end |
170 | 203 |
|
171 |
| - expect(related_accession[:'data-content']).to include "digital_objects/#{@digital_object_id}" |
| 204 | +And 'the user selects the Digital Object Component' do |
| 205 | + click_on "Digital Object Component Label #{@uuid}" |
172 | 206 | end
|
0 commit comments