This repository was archived by the owner on Oct 14, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +77
-3
lines changed Expand file tree Collapse file tree 5 files changed +77
-3
lines changed Original file line number Diff line number Diff line change 1+ Feature : Accession Accession Spawn
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 : Accession Spawn Accession page is opened
7+ When the user clicks on 'Spawn'
8+ And the user clicks on 'Accession' in the spawn dropdown menu
9+ Then the New Accession page is displayed
10+ And the Accession has been spawned from Accession info message is displayed
11+ Scenario : Successfully spawn a new accession from an existing accession - not linked
12+ Given the user is on the New Accession page spawned from the original Accession
13+ When the user fills in 'Identifier'
14+ And the user clicks on 'Save'
15+ Then the Accession is created
16+ And the new Accession is not linked to the original Accession
17+ Scenario : Successfully spawn a new accession from an existing accession - linked
18+ Given the user is on the New Accession page spawned from the original Accession
19+ When the user fills in 'Identifier'
20+ And the user links to the original Accession in the 'Related Accessions' form
21+ And the user clicks on 'Save'
22+ Then the Accession is created
23+ And the new Accession is linked to the original Accession
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
3- Given ( 'the user is on the New Accession page' ) do
3+ Given 'the user is on the New Accession page' do
44 click_on 'Create'
55 click_on 'Accession'
66end
77
8- Then ( 'the Accession is created' ) do
8+ Then 'the Accession is created' do
99 uri = find ( '#accession_form' ) [ :'data-update-monitor-record-uri' ]
1010
1111 @accession_id = uri . split ( '/' ) . pop
1212
1313 visit "#{ STAFF_URL } /accessions/#{ @accession_id } /edit"
1414
15- expect ( find ( 'h2' ) . text ) . to eq "#{ @uuid } Accession"
1615 expect ( find ( '#accession_id_0_' ) . value ) . to eq @uuid
1716end
File renamed without changes.
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ Then 'the New Accession page is displayed' do
4+ expect ( find ( 'h2' ) . text ) . to eq 'New Accession Accession'
5+ end
6+
7+ Given 'the user is on the New Accession page spawned from the original Accession' do
8+ visit "#{ STAFF_URL } /accessions/new?accession_id=#{ @accession_id } "
9+ end
10+
11+ Then 'the Accession has been spawned from Accession info message is displayed' do
12+ message = "This Accession has been spawned from Accession Accession Title #{ @uuid } . This record is unsaved. You must click Save for the record to be created in the system"
13+
14+ expect ( page ) . to have_text message
15+ end
16+
17+ Then 'the new Accession is not linked to the original Accession' do
18+ expect ( page ) . not_to have_selector ( '#accession_related_accessions__0_' )
19+ end
20+
21+ When 'the user links to the original Accession in the {string} form' do |form_title |
22+ section_title = find ( 'h3' , text : form_title )
23+ section = section_title . ancestor ( 'section' )
24+ expect ( section [ :id ] ) . to_not eq nil
25+
26+ within section do
27+ click_on 'Add Related Accession'
28+ find ( '.related-accession-type' ) . select '"Part of" Relationship'
29+ fill_in 'token-input-accession_related_accessions__0__ref_' , with : @uuid
30+ dropdown_items = all ( 'li.token-input-dropdown-item2' )
31+ dropdown_items . first . click
32+ end
33+ end
34+
35+ Then 'the new Accession is linked to the original Accession' do
36+ section = find ( '#accession_related_accessions_' )
37+ expect ( section ) . to have_text @uuid
38+ end
Original file line number Diff line number Diff line change 2727 end
2828end
2929
30+ When 'the user clicks on {string} in the spawn dropdown menu' do |string |
31+ within '#spawn-dropdown' do
32+ click_on_string string
33+ end
34+ end
35+
3036When 'the user clicks on {string} in the confirm popup' do |string |
3137 within '#confirmChangesModal' do
3238 click_on_string string
95101 expect ( find ( '.alert.alert-success.with-hide-alert' ) . text ) . to match ( /^#{ string } .*deleted$/i )
96102end
97103
104+ Then 'only the following info message is displayed' do |messages |
105+ expect ( messages . raw . length ) . to eq 1
106+
107+ messages . raw . each do |message |
108+ expect ( page ) . to have_text message [ 0 ]
109+ end
110+ end
111+
98112Then 'the following error messages are displayed' do |messages |
99113 messages . raw . each do |message |
100114 expect ( page ) . to have_text message [ 0 ]
You can’t perform that action at this time.
0 commit comments