-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accession Spawn Digital Object step definitions
- Loading branch information
1 parent
814b1bc
commit 4a58f9b
Showing
8 changed files
with
201 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
ORIGINAL_ACCESSION_DATE = '2000-01-01' | ||
ORIGINAL_ACCESSION_RIGHTS_STATEMENT_START_DATE = '2000-01-01' |
41 changes: 10 additions & 31 deletions
41
staff_features/accessions/accession_spawn_digital_object.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,15 @@ | ||
Feature: Digital Object Spawn from an Accession | ||
Feature: Accession spawn Digital Object | ||
Background: | ||
Given an administrator user is logged in | ||
And the "Spawn description for Digital Object instances from linked record" setting is enabled in the Preferences | ||
And the "Spawn description for Digital Object instances from linked record" setting is enabled in the Repository Preferences | ||
And an Accession has been created | ||
And the Accession is opened in edit mode | ||
Scenario: Accession is linked to the spawned Digital Object | ||
When the user scrolls to the "Instances" section | ||
And the user clicks on "Add Digital Object" | ||
And the user selects "Create" | ||
Scenario: Digital Object form is prefilled with Accession data | ||
When the user clicks on "Add Digital Object" in the "Instances" form | ||
And the user clicks on the dropdown in the "Instances" form | ||
And the user clicks on "Create" in the dropdown menu in the "Instances" form | ||
Then the Create Digital Object modal is displayed | ||
And the following Digital Object forms have the same values as the Accession: | ||
| Title | | ||
| Date expression | | ||
| Date Begin | | ||
| Date End | | ||
| Languages | | ||
| Digital Object Note Type | | ||
| Summary | | ||
| Bibliography | | ||
| Biographical/Historical | | ||
| Conditions Governing Access | | ||
| Conditions Governing Use | | ||
| Custodial History | | ||
| Dimensions | | ||
| Existence and Location of Copies | | ||
| Existence and Location of Originals | | ||
| General Note | | ||
| Physical Description | | ||
| Immediate Source of Acquisition | | ||
| Language of Materials | | ||
| Legal Status | | ||
| Preferred Citation | | ||
| Processing Information | | ||
| Related Materials | | ||
| Summary | | ||
And the Digital Object title is filled in with the Accession Title | ||
And the following Digital Object forms have the same values as the Accession | ||
| Languages | | ||
| Dates | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
staff_features/accessions/step_definitions/accession_shared.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# frozen_string_literal: true | ||
|
||
Given 'an Accession has been created' do | ||
visit "#{STAFF_URL}/accessions/new" | ||
|
||
fill_in 'accession_id_0_', with: "Accession #{@uuid}" | ||
fill_in 'Title', with: "Accession Title #{@uuid}" | ||
check 'Publish?' | ||
|
||
fill_in 'accession_content_description_', with: "Content Description #{@uuid}" | ||
fill_in 'accession_condition_description_', with: "Condition Description #{@uuid}" | ||
fill_in 'accession_disposition_', with: "Disposition #{@uuid}" | ||
fill_in 'accession_inventory_', with: "Inventory #{@uuid}" | ||
fill_in 'accession_provenance_', with: "Provenance #{@uuid}" | ||
fill_in 'accession_retention_rule_', with: "Retention Rule #{@uuid}" | ||
fill_in 'accession_general_note_', with: "General Note #{@uuid}" | ||
select 'Deposit', from: 'accession_acquisition_type_' | ||
select 'Collection', from: 'accession_resource_type_' | ||
|
||
fill_in 'accession_language_', with: 'english' | ||
dropdown_items = all('.typeahead.typeahead-long.dropdown-menu') | ||
dropdown_items.first.click | ||
fill_in 'accession_script_', with: 'adlam' | ||
dropdown_items = all('.typeahead.typeahead-long.dropdown-menu') | ||
dropdown_items.first.click | ||
find('#accession_restrictions_apply_').check | ||
find('#accession_access_restrictions_').check | ||
fill_in 'accession_access_restrictions_note_', with: "Access Restrictions Note #{@uuid}" | ||
find('#accession_use_restrictions_').check | ||
fill_in 'accession_use_restrictions_note_', with: "Use Restrictions Note #{@uuid}" | ||
|
||
click_on 'Add Language' | ||
fill_in 'Language', with: 'English' | ||
dropdown_items = all('.typeahead.typeahead-long.dropdown-menu') | ||
dropdown_items.first.click | ||
fill_in 'Script', with: 'adlam' | ||
dropdown_items = all('.typeahead.typeahead-long.dropdown-menu') | ||
dropdown_items.first.click | ||
|
||
click_on 'Add Date' | ||
select 'Single', from: 'accession_dates__0__date_type_' | ||
fill_in 'accession_dates__0__begin_', with: ORIGINAL_ACCESSION_DATE | ||
|
||
click_on 'Add Extent' | ||
fill_in 'Number', with: @uuid | ||
select 'Cassettes', from: 'accession_extents__0__extent_type_' | ||
|
||
click_on 'Add Agent Link' | ||
select 'Creator', from: 'accession_linked_agents__0__role_' | ||
fill_in 'accession_linked_agents__0__title_', with: "Accession #{@uuid} Agent Title" | ||
fill_in 'accession_linked_agents__0__relator_', with: 'annotator' | ||
dropdown_items = all('.typeahead.typeahead-long.dropdown-menu') | ||
dropdown_items.first.click | ||
fill_in 'token-input-accession_linked_agents__0__ref_', with: 'test_agent' | ||
dropdown_items = all('li.token-input-dropdown-item2') | ||
dropdown_items.first.click | ||
|
||
click_on 'Add Subject' | ||
fill_in 'token-input-accession_subjects__0__ref_', with: 'test_subject' | ||
dropdown_items = all('li.token-input-dropdown-item2') | ||
dropdown_items.first.click | ||
|
||
click_on 'Add Rights Statement' | ||
select 'Copyright', from: 'accession_rights_statements__0__rights_type_' | ||
fill_in 'accession_rights_statements__0__jurisdiction_', with: 'andorra' | ||
dropdown_items = all('.typeahead.typeahead-long.dropdown-menu') | ||
dropdown_items.first.click | ||
fill_in 'accession_rights_statements__0__start_date_', with: ORIGINAL_ACCESSION_RIGHTS_STATEMENT_START_DATE | ||
|
||
click_on 'Add Metadata Rights Declaration' | ||
select 'This record is made available under an Universal 1.0 Public Domain Dedication Creative Commons license.', | ||
from: 'accession_metadata_rights_declarations__0__license_' | ||
fill_in 'accession_metadata_rights_declarations__0__descriptive_note_', with: "Descriptive Note #{@uuid}" | ||
fill_in 'accession_metadata_rights_declarations__0__file_uri_', with: "file-uri-#{@uuid}" | ||
select 'onLoad', from: 'accession_metadata_rights_declarations__0__file_version_xlink_actuate_attribute_' | ||
select 'embed', from: 'accession_metadata_rights_declarations__0__file_version_xlink_show_attribute_' | ||
fill_in 'accession_metadata_rights_declarations__0__xlink_title_attribute_', with: "Xlink Title Attribute #{@uuid}" | ||
fill_in 'accession_metadata_rights_declarations__0__xlink_role_attribute_', with: "Xlink Role Attribute #{@uuid}" | ||
fill_in 'accession_metadata_rights_declarations__0__xlink_arcrole_attribute_', with: "Xlink Arcrole Attribute #{@uuid}" | ||
fill_in 'accession_metadata_rights_declarations__0__last_verified_date_', with: '2000-01-01' | ||
|
||
click_on 'Add Classification' | ||
fill_in 'token-input-accession_classifications__0__ref_', with: 'test_classification' | ||
dropdown_items = all('li.token-input-dropdown-item2') | ||
dropdown_items.first.click | ||
|
||
click_on 'Save' | ||
expect(page).to have_text "Accession Accession Title #{@uuid} created" | ||
end | ||
|
||
Given 'the Accession is opened in edit mode' do | ||
visit "#{STAFF_URL}/accessions" | ||
|
||
fill_in 'filter-text', with: @uuid | ||
|
||
within '.search-filter' do | ||
find('button').click | ||
end | ||
|
||
search_result_rows = all('#tabledSearchResults tbody tr') | ||
expect(search_result_rows.length).to eq 1 | ||
|
||
within search_result_rows[0] do | ||
element = find('a', text: 'Edit') | ||
|
||
@accession_id = URI.decode_www_form_component(element[:href]).split('/').pop | ||
end | ||
|
||
click_on 'Edit' | ||
end |
40 changes: 40 additions & 0 deletions
40
staff_features/accessions/step_definitions/accession_spawn_digital_object.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# frozen_string_literal: true | ||
|
||
When 'the {string} setting is enabled in the Repository Preferences' do |repository_setting_checkbox_label| | ||
find('#user-menu-dropdown').click | ||
click_on 'Repository Preferences (admin)' | ||
|
||
check repository_setting_checkbox_label | ||
|
||
click_on 'Save' | ||
end | ||
|
||
Then 'the Create Digital Object modal is displayed' do | ||
expect(page).to have_css '#accession_instances__0__digital_object__ref__modal' | ||
end | ||
|
||
Then 'the Digital Object title is filled in with the Accession Title' do | ||
expect(find('#digital_object_title_').value).to eq "Accession Title #{@uuid}" | ||
end | ||
|
||
Then 'the following Digital Object forms have the same values as the Accession' do |linked_record_forms| | ||
linked_record_forms.raw.each do |form_title| | ||
form_title = form_title[0] | ||
|
||
section_title = find('h3', text: form_title) | ||
section = section_title.ancestor('section') | ||
expect(section[:id]).to_not eq nil | ||
|
||
case form_title | ||
when 'Languages' | ||
expect(find('#digital_object_lang_materials__0__language_and_script__language_').value).to eq 'English, Middle (1100-1500)' | ||
expect(find('#digital_object_lang_materials__0__language_and_script__script_').value).to eq 'Adlam' | ||
when 'Dates' | ||
expect(find('#digital_object_dates__0__label_').value).to eq 'creation' | ||
expect(find('#digital_object_dates__0__date_type_').value).to eq 'single' | ||
expect(find('#digital_object_dates__0__begin_').value).to eq ORIGINAL_ACCESSION_DATE | ||
else | ||
raise "Invalid form provided: #{form_title}" | ||
end | ||
end | ||
end |
4 changes: 0 additions & 4 deletions
4
staff_features/accessions/step_definitions/accessions_search.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters