diff --git a/staff_features/accessions/accession_delete.feature b/staff_features/accessions/accession_delete.feature index 9f6d15d0..d52738b6 100644 --- a/staff_features/accessions/accession_delete.feature +++ b/staff_features/accessions/accession_delete.feature @@ -17,6 +17,7 @@ Feature: Accession Delete And the user clicks on 'Delete' in the confirm popup Then the Accessions page is displayed And the 'Accession deleted' message is displayed + And the Accession is deleted Scenario: Cancel Accession delete from the view page Given the user is on the Accession view page When the user clicks on 'Delete' diff --git a/staff_features/accessions/step_definitions/accession_delete.rb b/staff_features/accessions/step_definitions/accession_delete.rb index f19fb89d..0dc429cc 100644 --- a/staff_features/accessions/step_definitions/accession_delete.rb +++ b/staff_features/accessions/step_definitions/accession_delete.rb @@ -14,6 +14,12 @@ within table_row do click_on 'View' end + + input = find('input#uri') + expect(input.value).to include 'repositories' + expect(input.value).to include 'accession' + + @accession_id = input.value.split('/').pop end When 'the user filters by text with the Accession title' do @@ -39,6 +45,16 @@ When 'the user checks the checkbox of the Accession' do find('#multiselect-item').check + + within '#tabledSearchResults' do + row = find('tr.selected') + + input = row.find('input') + expect(input.value).to include 'repositories' + expect(input.value).to include 'accession' + + @accession_id = input.value.split('/').pop + end end When 'the user confirms the delete action' do @@ -54,3 +70,12 @@ Then 'the Accessions page is displayed' do expect(find('h2').text).to have_text 'Accessions' end + +Then 'the Accession is deleted' do + expect(@accession_id).to_not eq nil + + visit "#{STAFF_URL}/accessions/#{@accession_id}/edit" + + expect(find('h2').text).to eq 'Record Not Found' + expect(page).to have_text "The record you've tried to access may no longer exist or you may not have permission to view it." +end