Skip to content

Commit

Permalink
Digital Object Suppress (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdimopulu authored Feb 5, 2025
1 parent 3a20690 commit b605144
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
17 changes: 17 additions & 0 deletions staff_features/digital_objects/digital_object_suppress.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Feature: Digital Object Suppress
Background:
Given an administrator user is logged in
And a Digital Object has been created
And the Digital Object is opened in edit mode
Scenario: Digital Object is suppressed
Given the Digital Object is not suppressed
When the user clicks on 'Suppress'
And the user clicks on 'Suppress' in the modal
Then the Digital Object now is suppressed
And the Digital Object cannot be accessed by archivists
Scenario: Digital Object is unsuppressed
Given the Digital Object is suppressed
When the user clicks on 'Unsuppress'
And the user clicks on 'Unsuppress' in the modal
Then the Digital Object now is not suppressed
And the Digital Object can be accessed by archivists
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# frozen_string_literal: true

Given 'the Digital Object is not suppressed' do
expect(page).to have_css('button', text: 'Suppress')
end

Given 'the Digital Object is suppressed' do
expect(page).to have_css('button', text: 'Suppress')

click_on 'Suppress'
within '.modal-content' do
click_on 'Suppress'
end

expect(current_url).to include "digital_objects/#{@digital_object_id}"
expect(page).to have_text "Digital Object Digital Object Title #{@uuid} suppressed"
expect(page).to have_text 'Digital Object is suppressed and cannot be edited'
end

Then 'the Digital Object now is suppressed' do
expect(current_url).to include "digital_objects/#{@digital_object_id}"
expect(page).to have_text "Digital Object Digital Object Title #{@uuid} suppressed"
expect(page).to have_text 'Digital Object is suppressed and cannot be edited'
end

Then 'the Digital Object now is not suppressed' do
visit "#{STAFF_URL}/digital_objects/#{@digital_object_id}/edit"

wait_for_ajax

expect(current_url).to include "/digital_objects/#{@digital_object_id}/edit"

expect(page).to have_css('button', text: 'Suppress')
end

Then 'the Digital Object cannot be accessed by archivists' do
visit "#{STAFF_URL}/logout"

login_archivist

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

expect(page).to have_text '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

Then 'the Digital Object can be accessed by archivists' do
visit "#{STAFF_URL}/logout"

login_archivist

visit "#{STAFF_URL}/digital_objects/#{@digital_object_id}/edit"
expect(current_url).to include "/digital_objects/#{@digital_object_id}/edit"
end

0 comments on commit b605144

Please sign in to comment.