Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Commit 2d2982c

Browse files
Accession spawn Archival Object
1 parent 59131d0 commit 2d2982c

File tree

11 files changed

+301
-79
lines changed

11 files changed

+301
-79
lines changed

.rubocop.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ AllCops:
66
Metrics/AbcSize:
77
Max: 50
88

9+
Metrics/BlockLength:
10+
Max: 60
11+
12+
Layout/LineLength:
13+
Max: 200
14+
915
Metrics/MethodLength:
1016
Max: 50
1117

helpers/helpers.rb

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,39 @@ def ensure_test_user_exists
107107
visit STAFF_URL
108108
end
109109

110+
def ensure_test_agent_exists
111+
visit STAFF_URL
112+
113+
fill_in 'global-search-box', with: 'test_agent'
114+
find('#global-search-button').click
115+
116+
begin
117+
find 'tr', text: 'test_agent'
118+
rescue Capybara::ElementNotFound
119+
visit "#{STAFF_URL}/agents/agent_person/new"
120+
check 'Publish'
121+
fill_in 'Primary Part of Name', with: 'test_agent'
122+
click_on 'Save'
123+
end
124+
end
125+
126+
def ensure_test_subject_exists
127+
visit STAFF_URL
128+
129+
fill_in 'global-search-box', with: 'test_subject'
130+
find('#global-search-button').click
131+
132+
begin
133+
find 'tr', text: 'test_subject'
134+
rescue Capybara::ElementNotFound
135+
visit "#{STAFF_URL}/subjects/new"
136+
select 'Art & Architecture Thesaurus', from: 'subject_source_'
137+
fill_in 'subject_terms__0__term_', with: 'test_subject_term'
138+
select 'Cultural context', from: 'subject_terms__0__term_type_'
139+
click_on 'Save'
140+
end
141+
end
142+
110143
def find_user_table_row_in_manage_user_access_page(username)
111144
loop do
112145
begin
@@ -148,6 +181,23 @@ def create_resource(uuid)
148181
find('button', text: 'Save Resource', match: :first).click
149182

150183
expect(page).to have_text "Resource Resource #{uuid} created"
184+
185+
uri_parts = current_url.split('/')
186+
uri_parts.pop
187+
@resource_id = uri_parts.pop
188+
189+
create_resource_archival_object(uuid)
190+
end
191+
192+
def create_resource_archival_object(uuid)
193+
click_on 'Add Child'
194+
sleep 3
195+
fill_in 'Title', with: "Archival Object #{uuid}"
196+
fill_in 'Component Unique Identifier', with: uuid
197+
select 'Class', from: 'Level of Description'
198+
199+
find('button', text: 'Save Archival Object', match: :first).click
200+
expect(page).to have_text "Archival Object Archival Object #{uuid} on Resource Resource #{uuid} created"
151201
end
152202

153203
def create_accession(uuid)

helpers/original_values.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# frozen_string_literal: true
22

33
ORIGINAL_ACCESSION_DATE = '2000-01-01'
4+
ORIGINAL_ACCESSION_RIGHTS_STATEMENT_START_DATE = '2000-01-01'
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Feature: Archival Object Spawn from an Accession
2+
Background:
3+
Given an administrator user is logged in
4+
And an Accession has been created
5+
And a Resource has been created
6+
And the Accession is opened in edit mode
7+
Scenario: Accession is linked to the spawned Archival Object
8+
When the user clicks on 'Spawn'
9+
And the user clicks on 'Archival Object' in the spawn dropdown menu
10+
And the user selects Resource in the modal
11+
And the user clicks on an Archival Object in the Component Position modal
12+
And the user clicks on 'Insert spawned component before'
13+
And the user clicks on 'Select Component Position'
14+
Then the New Archival Object page is displayed
15+
And the Archival Object has been spawned from Accession info message is displayed
16+
And the Archival Object title is filled in with the Accession Title
17+
And the Archival Object publish is set from the Accession publish
18+
And the Archival Object notes are set from the Accession Content Description and Condition Description
19+
And the following Archival Object forms have the same values as the Accession
20+
| Agent Links |
21+
| Accession Links |
22+
| Subjects |
23+
| Languages |
24+
| Dates |
25+
| Extents |
26+
| Rights Statements |

staff_features/accessions/accessions_archival_object_spawn.feature

Lines changed: 0 additions & 40 deletions
This file was deleted.

staff_features/accessions/step_definitions/accession_edit.rb

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,6 @@
4040
click_on 'View'
4141
end
4242

43-
Given 'the Accession is opened in edit mode' do
44-
visit "#{STAFF_URL}/accessions"
45-
46-
fill_in 'filter-text', with: @uuid
47-
48-
within '.search-filter' do
49-
find('button').click
50-
end
51-
52-
search_result_rows = all('#tabledSearchResults tbody tr')
53-
expect(search_result_rows.length).to eq 1
54-
55-
within search_result_rows[0] do
56-
element = find('a', text: 'Edit')
57-
58-
@accession_id = URI.decode_www_form_component(element[:href]).split('/').pop
59-
end
60-
61-
click_on 'Edit'
62-
end
63-
6443
Then 'the Accession is updated with the new {string} as {string}' do |field, value|
6544
fill_in field, with: value
6645
end
@@ -76,7 +55,7 @@
7655
end
7756

7857
Then 'the field {string} has value {string}' do |field, value|
79-
expect(page).to have_field(field, with: value)
58+
expect(page).to have_field(field, with: value, match: :first)
8059
end
8160

8261
Then 'the Accession Title field has the original value' do
@@ -88,7 +67,7 @@
8867
Then 'the Accession Date field has the original value' do
8968
visit "#{STAFF_URL}/accessions/#{@accession_id}/edit"
9069

91-
expect(page).to have_field('Accession Date', with: ORIGINAL_ACCESSION_DATE)
70+
expect(find('#accession_accession_date_').value).to eq ORIGINAL_ACCESSION_DATE
9271
end
9372

9473
When 'the Accession Identifier field has the original value' do
@@ -143,11 +122,11 @@
143122
end
144123

145124
When 'User A changes the {string} field' do |field|
146-
fill_in field, with: SecureRandom.uuid
125+
fill_in field, with: SecureRandom.uuid, match: :first
147126
end
148127

149128
When 'User B changes the {string} field' do |field|
150-
@user_b_session.fill_in field, with: SecureRandom.uuid
129+
@user_b_session.fill_in field, with: SecureRandom.uuid, match: :first
151130
end
152131

153132
When 'User B clicks on {string}' do |string|
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# frozen_string_literal: true
2+
3+
Given 'an Accession has been created' do
4+
visit "#{STAFF_URL}/accessions/new"
5+
6+
fill_in 'accession_id_0_', with: "Accession #{@uuid}"
7+
fill_in 'Title', with: "Accession Title #{@uuid}"
8+
fill_in 'accession_accession_date_', with: ORIGINAL_ACCESSION_DATE
9+
check 'Publish?'
10+
11+
fill_in 'accession_content_description_', with: "Content Description #{@uuid}"
12+
fill_in 'accession_condition_description_', with: "Condition Description #{@uuid}"
13+
fill_in 'accession_disposition_', with: "Disposition #{@uuid}"
14+
fill_in 'accession_inventory_', with: "Inventory #{@uuid}"
15+
fill_in 'accession_provenance_', with: "Provenance #{@uuid}"
16+
fill_in 'accession_retention_rule_', with: "Retention Rule #{@uuid}"
17+
fill_in 'accession_general_note_', with: "General Note #{@uuid}"
18+
select 'Deposit', from: 'accession_acquisition_type_'
19+
select 'Collection', from: 'accession_resource_type_'
20+
21+
fill_in 'accession_language_', with: 'english'
22+
dropdown_items = all('.typeahead.typeahead-long.dropdown-menu')
23+
dropdown_items.first.click
24+
fill_in 'accession_script_', with: 'adlam'
25+
dropdown_items = all('.typeahead.typeahead-long.dropdown-menu')
26+
dropdown_items.first.click
27+
find('#accession_restrictions_apply_').check
28+
find('#accession_access_restrictions_').check
29+
fill_in 'accession_access_restrictions_note_', with: "Access Restrictions Note #{@uuid}"
30+
find('#accession_use_restrictions_').check
31+
fill_in 'accession_use_restrictions_note_', with: "Use Restrictions Note #{@uuid}"
32+
33+
click_on 'Add Language'
34+
fill_in 'Language', with: 'English'
35+
dropdown_items = all('.typeahead.typeahead-long.dropdown-menu')
36+
dropdown_items.first.click
37+
fill_in 'Script', with: 'adlam'
38+
dropdown_items = all('.typeahead.typeahead-long.dropdown-menu')
39+
dropdown_items.first.click
40+
41+
click_on 'Add Date'
42+
select 'Single', from: 'accession_dates__0__date_type_'
43+
fill_in 'accession_dates__0__begin_', with: ORIGINAL_ACCESSION_DATE
44+
45+
click_on 'Add Extent'
46+
fill_in 'Number', with: @uuid
47+
select 'Cassettes', from: 'accession_extents__0__extent_type_'
48+
49+
click_on 'Add Agent Link'
50+
select 'Creator', from: 'accession_linked_agents__0__role_'
51+
fill_in 'accession_linked_agents__0__title_', with: "Accession #{@uuid} Agent Title"
52+
fill_in 'accession_linked_agents__0__relator_', with: 'annotator'
53+
dropdown_items = all('.typeahead.typeahead-long.dropdown-menu')
54+
dropdown_items.first.click
55+
fill_in 'token-input-accession_linked_agents__0__ref_', with: 'test_agent'
56+
dropdown_items = all('li.token-input-dropdown-item2')
57+
dropdown_items.first.click
58+
59+
click_on 'Add Subject'
60+
fill_in 'token-input-accession_subjects__0__ref_', with: 'test_subject'
61+
dropdown_items = all('li.token-input-dropdown-item2')
62+
dropdown_items.first.click
63+
64+
click_on 'Add Rights Statement'
65+
select 'Copyright', from: 'accession_rights_statements__0__rights_type_'
66+
fill_in 'accession_rights_statements__0__jurisdiction_', with: 'andorra'
67+
dropdown_items = all('.typeahead.typeahead-long.dropdown-menu')
68+
dropdown_items.first.click
69+
fill_in 'accession_rights_statements__0__start_date_', with: ORIGINAL_ACCESSION_RIGHTS_STATEMENT_START_DATE
70+
71+
click_on 'Save'
72+
expect(page).to have_text "Accession Accession Title #{@uuid} created"
73+
end
74+
75+
Given 'the Accession is opened in edit mode' do
76+
visit "#{STAFF_URL}/accessions"
77+
78+
fill_in 'filter-text', with: @uuid
79+
80+
within '.search-filter' do
81+
find('button').click
82+
end
83+
84+
search_result_rows = all('#tabledSearchResults tbody tr')
85+
expect(search_result_rows.length).to eq 1
86+
87+
within search_result_rows[0] do
88+
element = find('a', text: 'Edit')
89+
90+
@accession_id = URI.decode_www_form_component(element[:href]).split('/').pop
91+
end
92+
93+
click_on 'Edit'
94+
end

0 commit comments

Comments
 (0)