Skip to content

Commit

Permalink
Digital object delete
Browse files Browse the repository at this point in the history
  • Loading branch information
blacksmith-welder committed Dec 21, 2024
1 parent 7f30ee5 commit 72afd50
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 10 deletions.
6 changes: 0 additions & 6 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ AllCops:
Metrics/AbcSize:
Max: 50

Metrics/BlockLength:
Max: 80

Layout/LineLength:
Max: 200

Expand All @@ -18,9 +15,6 @@ Metrics/MethodLength:
Metrics/BlockLength:
Max: 90

Layout/LineLength:
Max: 180

Layout/ElseAlignment:
Enabled: false

Expand Down
7 changes: 3 additions & 4 deletions staff_features/digital_objects/digital_object_delete.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Feature: Digital Object Delete
Scenario: Digital Object is deleted from the view page
Given the user is on the Digital Object view page
When the user clicks on 'Delete'
And the user clicks on 'Delete' in the confirm popup
And the user clicks on 'Delete' in the modal
Then the Digital Objects page is displayed
And the 'Digital Object' deleted message is displayed
And the Digital Object is deleted
And the Digital Object is deleted
Scenario: Cancel Digital Object delete from the view page
Given the user is on the Digital Object view page
When the user clicks on 'Delete'
Expand All @@ -26,8 +26,7 @@ Feature: Digital Object Delete
Scenario: Digital Object is deleted from the edit page
Given the user is on the Digital Object edit page
When the user clicks on 'Delete'
And the user clicks on 'Delete' in the confirm popup
And the user clicks on 'Delete' in the modal
Then the Digital Objects page is displayed
And the 'Digital Object' deleted message is displayed
And the Digital Object is deleted

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

When 'the user checks the checkbox of the Digital Object' do
find('#multiselect-item').check
end

Then 'the Digital Object is deleted' do
expect(@digital_object_id).to_not eq nil

visit "#{STAFF_URL}/digital_objects/#{@digital_object_id}/edit"

expect(find('h2').text).to eq 'Record Not Found'

expected_text = "The record you've tried to access may no longer exist or you may not have permission to view it."
expect(page).to have_text expected_text
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# frozen_string_literal: true

Given 'a Digital Object has been created' do
visit "#{STAFF_URL}/digital_objects/new"

fill_in 'digital_object_digital_object_id_', with: "Digital Object Identifier #{@uuid}"
fill_in 'digital_object_title_', with: "Digital Object Title #{@uuid}"

click_on 'Save'

wait_for_ajax
expect(find('.alert.alert-success.with-hide-alert').text).to have_text "Digital Object Digital Object Title #{@uuid} Created"
@digital_object_id = current_url.split('::digital_object_').pop
end

When 'the user filters by text with the Digital Object title' do
fill_in 'Filter by text', with: "Digital Object Identifier #{@uuid}"

find('#filter-text').send_keys(:enter)

rows = []
checks = 0

while checks < 5
checks += 1

begin
rows = all('tr', text: @uuid)
rescue Selenium::WebDriver::Error::JavascriptError
sleep 1
end

break if rows.length == 1
end
end

Given 'the user is on the Digital Object view page' do
visit "#{STAFF_URL}/digital_objects/#{@digital_object_id}"
end

Then 'the Digital Objects page is displayed' do
expect(find('h2').text).to have_text 'Digital Objects'
expect(current_url).to include "#{STAFF_URL}/digital_objects"
end

Then 'the user is still on the Digital Object view page' do
expect(find('h2').text).to eq "Digital Object Title #{@uuid} Digital Object"
expect(current_url).to include "#{STAFF_URL}/digital_objects/#{@digital_object_id}"
end

0 comments on commit 72afd50

Please sign in to comment.