Skip to content

Commit 3506790

Browse files
authored
Accession container instance (#99)
1 parent 1321d8c commit 3506790

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Feature: Accession Container Instance
2+
Background:
3+
Given an administrator user is logged in
4+
And an Accession has been created
5+
And the Accession is opened in edit mode
6+
Scenario: Add container instance by creating Top Container
7+
When the user clicks on 'Instances'
8+
And the user clicks on 'Add Container Instance'
9+
And the user selects 'Accession' from 'Type' in the 'Instances' form
10+
And the user clicks on the first dropdown in the 'Instances' form
11+
And the user clicks on 'Create' in the dropdown menu in the 'Instances' form
12+
And the user fills in 'Indicator' with 'Test Container' in the modal
13+
And the user clicks on 'Create and Link' in the modal
14+
And the user clicks on 'Save Accession'
15+
Then the 'Accession' updated message is displayed
16+
And a new Instance is added to the Accession with the following values
17+
| Type | Accession |
18+
| Top Container | Test Container |
19+
Scenario: Add container instance by browsing Top Container
20+
When the user clicks on 'Instances'
21+
And the user clicks on 'Add Container Instance'
22+
And the user selects 'Accession' from 'Type' in the 'Instances' form
23+
And the user clicks on the first dropdown in the 'Instances' form
24+
And the user clicks on 'Browse' in the dropdown menu in the 'Instances' form
25+
And the user fills in 'Keyword' with 'Test Container' in the modal
26+
And the user clicks on 'Search' in the modal
27+
And the user selects the Top Container from the search results in the modal
28+
And the user clicks on 'Link' in the modal
29+
And the user clicks on 'Save Accession'
30+
Then the 'Accession' updated message is displayed
31+
And a new Instance is added to the Accession with the following values
32+
| Type | Accession |
33+
| Top Container | Test Container |

staff_features/accessions/step_definitions/accession_edit.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,20 @@
159159
expect(@user_b_session).to have_text message[0]
160160
end
161161
end
162+
163+
Then 'a new Instance is added to the Accession with the following values' do |form_values_table|
164+
instances = all('#accession_instances_ .subrecord-form-list li.subrecord-form-wrapper')
165+
166+
expect(instances.length).to eq @accession_number_of_instances + 1
167+
168+
instance = instances.last
169+
170+
form_values_hash = form_values_table.rows_hash
171+
form_values_hash.each do |field, value|
172+
if field == 'Top Container'
173+
expect(find('.top_container').text).to eq value
174+
else
175+
expect(instance.find_field(field, visible: true).value).to eq value.downcase.gsub(' ', '_')
176+
end
177+
end
178+
end

staff_features/accessions/step_definitions/accession_shared.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@
9191
dropdown_items = all('li.token-input-dropdown-item2')
9292
dropdown_items.first.click
9393

94+
@accession_number_of_instances = 0
95+
9496
click_on 'Save'
9597
expect(page).to have_text "Accession Accession Title #{@uuid} created"
9698
end
@@ -152,3 +154,11 @@
152154
expect(created_extent.find_field(field).value).to eq value.downcase.gsub(' ', '_')
153155
end
154156
end
157+
158+
When 'the user selects the Top Container from the search results in the modal' do
159+
results = all('table.table-search-results tbody tr')
160+
161+
expect(results.length > 0).to eq true
162+
163+
results[0].click
164+
end

0 commit comments

Comments
 (0)