|
32 | 32 | expect(page).to have_text message |
33 | 33 | end |
34 | 34 |
|
| 35 | +Then 'the Accession page is displayed' do |
| 36 | + expect(current_url).to include "accessions/#{@accession_id}" |
| 37 | +end |
| 38 | + |
35 | 39 | Then 'the Resource title is filled in with the Accession Title' do |
36 | 40 | expect(find('#resource_title_').value).to eq "Accession Title #{@uuid}" |
37 | 41 | end |
38 | 42 |
|
39 | | -Then 'the Accession page is displayed' do |
40 | | - expect(current_url).to include "accessions/#{@accession_id}" |
| 43 | +Then 'the Resource publish is set from the Accession publish' do |
| 44 | + expect(find('#resource_publish_').checked?).to eq true |
| 45 | +end |
| 46 | + |
| 47 | +Then 'the Resource notes are set from the Accession Content Description and Condition Description' do |
| 48 | + notes = all('#resource_notes_ .subrecord-form-wrapper') |
| 49 | + expect(notes.length).to eq 2 |
| 50 | + |
| 51 | + notes[0].click |
| 52 | + expect(find('#resource_notes__0__label_').value).to eq 'Content Description' |
| 53 | + expect(find('#resource_notes__0__type_').value).to eq 'scopecontent' |
| 54 | + expect(find('#resource_notes__0__subnotes__0_ textarea', match: :first, visible: false).value).to eq "Content Description #{@uuid}" |
| 55 | + |
| 56 | + notes[1].click |
| 57 | + expect(find('#resource_notes__1__label_').value).to eq 'Condition Description' |
| 58 | + expect(find('#resource_notes__1__type_').value).to eq 'physdesc' |
| 59 | + expect(find('#resource_notes__1__content__0_ textarea', match: :first, visible: false).value).to eq "Condition Description #{@uuid}" |
| 60 | +end |
| 61 | + |
| 62 | +Then 'the following Resource forms have the same values as the Accession' do |linked_record_forms| |
| 63 | + linked_record_forms.raw.each do |form_title| |
| 64 | + form_title = form_title[0] |
| 65 | + |
| 66 | + section_title = find('h3', text: form_title) |
| 67 | + section = section_title.ancestor('section') |
| 68 | + expect(section[:id]).to_not eq nil |
| 69 | + |
| 70 | + case form_title |
| 71 | + when 'Agent Links' |
| 72 | + expect(find('#resource_linked_agents__0__role_').value).to eq 'creator' |
| 73 | + expect(find('#resource_linked_agents__0__title_').value).to eq "Accession #{@uuid} Agent Title" |
| 74 | + expect(find('#resource_linked_agents__0__relator_').value).to eq 'Annotator' |
| 75 | + expect(find('#resource_linked_agents__0__ref__combobox .token-input-token').text).to include 'test_agent' |
| 76 | + when 'Related Accessions' |
| 77 | + expect(find('#resource_related_accessions__0_ .token-input-token').text).to include "Accession #{@uuid}: Accession Title #{@uuid}" |
| 78 | + when 'Subjects' |
| 79 | + expect(find('#resource_subjects__0_ .token-input-token').text).to include 'test_subject_term' |
| 80 | + when 'Languages' |
| 81 | + expect(find('#resource_lang_materials__0__language_and_script__language_').value).to eq 'English' |
| 82 | + expect(find('#resource_lang_materials__0__language_and_script__script_').value).to eq 'Adlam' |
| 83 | + when 'Dates' |
| 84 | + expect(find('#resource_dates__0__label_').value).to eq 'creation' |
| 85 | + expect(find('#resource_dates__0__date_type_').value).to eq 'single' |
| 86 | + expect(find('#resource_dates__0__begin_').value).to eq ORIGINAL_ACCESSION_DATE |
| 87 | + when 'Extents' |
| 88 | + expect(find('#resource_extents__0__portion_').value).to eq 'whole' |
| 89 | + expect(find('#resource_extents__0__number_').value).to eq @uuid |
| 90 | + expect(find('#resource_extents__0__extent_type_').value).to eq 'cassettes' |
| 91 | + when 'Rights Statements' |
| 92 | + expect(find('#resource_rights_statements__0__rights_type_').value).to eq 'copyright' |
| 93 | + expect(find('#resource_rights_statements__0__status_').value).to eq 'copyrighted' |
| 94 | + expect(find('#resource_rights_statements__0__jurisdiction_').value).to eq 'Andorra' |
| 95 | + expect(find('#resource_rights_statements__0__start_date_').value).to eq ORIGINAL_ACCESSION_DATE |
| 96 | + when 'Metadata Rights Declarations' |
| 97 | + expect(find('#resource_metadata_rights_declarations__0__license_').value).to eq 'public_domain' |
| 98 | + expect(find('#resource_metadata_rights_declarations__0__descriptive_note_').value).to eq "Descriptive Note #{@uuid}" |
| 99 | + expect(find('#resource_metadata_rights_declarations__0__descriptive_note_').value).to eq "Descriptive Note #{@uuid}" |
| 100 | + expect(find('#resource_metadata_rights_declarations__0__file_uri_').value).to eq "file-uri-#{@uuid}" |
| 101 | + expect(find('#resource_metadata_rights_declarations__0__file_version_xlink_actuate_attribute_').value).to eq 'onLoad' |
| 102 | + expect(find('#resource_metadata_rights_declarations__0__file_version_xlink_show_attribute_').value).to eq 'embed' |
| 103 | + expect(find('#resource_metadata_rights_declarations__0__xlink_role_attribute_').value).to eq "Xlink Role Attribute #{@uuid}" |
| 104 | + expect(find('#resource_metadata_rights_declarations__0__xlink_arcrole_attribute_').value).to eq "Xlink Arcrole Attribute #{@uuid}" |
| 105 | + expect(find('#resource_metadata_rights_declarations__0__last_verified_date_').value).to eq '2000-01-01 00:00:00 UTC' |
| 106 | + when 'Classifications' |
| 107 | + expect(find('#resource_classifications__0__ref__combobox .token-input-token').text).to include 'test_classification' |
| 108 | + else |
| 109 | + raise "Invalid form provided: #{form_title}" |
| 110 | + end |
| 111 | + end |
41 | 112 | end |
0 commit comments