|
57 | 57 |
|
58 | 58 | expect(page).to have_field('Identifier', with: "Digital Object Identifier #{@uuid}")
|
59 | 59 | end
|
| 60 | + |
| 61 | +Then 'the Digital Object Component with Label {string} is saved as a child of the Digital Object' do |text| |
| 62 | + records = all('#tree-container .table-row', text:) |
| 63 | + |
| 64 | + expect(records.length).to eq 1 |
| 65 | + expect(records[0][:class]).to include 'indent-level-1 current' |
| 66 | + |
| 67 | + expect(page).to have_css "#tree-container #digital_object_#{@digital_object_id} + .table-row-group #digital_object_component_#{@created_record_id}" |
| 68 | +end |
| 69 | + |
| 70 | +Then 'the Digital Object Component with Title {string} is saved as a sibling of the selected Digital Object Component' do |title| |
| 71 | + records = all('#tree-container .table-row', text: title) |
| 72 | + |
| 73 | + expect(records.length).to eq 1 |
| 74 | + expect(records[0][:class]).to include 'indent-level-1 current' |
| 75 | + expect(page).to have_css "#tree-container #digital_object_#{@digital_object_id} + .table-row-group #digital_object_component_#{@created_record_id}" |
| 76 | +end |
| 77 | + |
| 78 | +Given 'a Digital Object with a Digital Object Component has been created' do |
| 79 | + visit "#{STAFF_URL}/digital_objects/new" |
| 80 | + |
| 81 | + fill_in 'digital_object_digital_object_id_', with: "Digital Object Identifier #{@uuid}" |
| 82 | + fill_in 'digital_object_title_', with: "Digital Object Title #{@uuid}" |
| 83 | + |
| 84 | + click_on 'Add Date' |
| 85 | + select 'Single', from: 'digital_object_dates__0__date_type_' |
| 86 | + fill_in 'digital_object_dates__0__begin_', with: '2000-01-01' |
| 87 | + |
| 88 | + click_on 'Save' |
| 89 | + |
| 90 | + wait_for_ajax |
| 91 | + expect(find('.alert.alert-success.with-hide-alert').text).to have_text "Digital Object Digital Object Title #{@uuid} Created" |
| 92 | + @digital_object_id = current_url.split('::digital_object_').pop |
| 93 | + |
| 94 | + click_on 'Add Child' |
| 95 | + wait_for_ajax |
| 96 | + |
| 97 | + fill_in 'Label', with: "Digital Object Component Label #{@uuid}" |
| 98 | + click_on 'Save' |
| 99 | + wait_for_ajax |
| 100 | + |
| 101 | + expect(find('.alert.alert-success.with-hide-alert').text).to eq "Digital Object Component created on Digital Object Digital Object Title #{@uuid}" |
| 102 | +end |
| 103 | + |
| 104 | +And 'the user selects the Digital Object Component' do |
| 105 | + click_on "Digital Object Component Label #{@uuid}" |
| 106 | +end |
0 commit comments