Skip to content

Commit

Permalink
Update resource scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
blacksmith-welder committed Sep 7, 2024
1 parent 0583467 commit f4131ae
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 44 deletions.
28 changes: 14 additions & 14 deletions staff-features/resources/update_basic_information.feature
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
Feature: Update Resource Basic Information
Background:
Given the user is logged in as an administrator
Given a resource has been created
And a resource has been created
Scenario: Successfully update resource basic information
Given the user is on the resource edit page
When the user selects "Records" from "Resource Type"
When the user checks Publish?
When the user checks Restrictions Apply?
When the user fills in Repository Processing Note with "Repository Processing Note"
When the user clicks on 'Save Resource'
Then the resource is updated
Then Resource Type has value Records
Then Publish? is checked
Then Restrictions Apply? is checked
Then Repository Processing Note has value "Repository Processing Note"
When the user selects 'Records' from "Resource Type"
And the user checks 'Publish?'
And the user checks 'Restrictions Apply?'
And the user fills in 'Repository Processing Note' with 'VTF #3810'
And the user clicks on 'Save Resource'
Then the 'Resource' updated message is displayed
And the 'Resource Type' has selected value 'Records'
And the 'Publish?' is checked
And the 'Restrictions Apply?' is checked
And the 'Repository Processing Note' has value 'VTF #3810'
Scenario: Revert changes
Given the user is on the resource edit page
When the user changes the resource Title
When the user changes the resource Identifier
When the user clicks on 'Revert Changes'
And the user changes the resource Identifier
And the user clicks on 'Revert Changes'
Then the resource Title does not change
Then the resource Identifier does not change
And the resource Identifier does not change
30 changes: 0 additions & 30 deletions staff-features/resources/update_basic_information.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,6 @@
click_on 'Edit'
end

When 'the user checks Publish?' do
find('#resource_publish_').check
end

When 'the user checks Restrictions Apply?' do
find('#resource_restrictions_').check
end

When 'the user fills in Repository Processing Note with {string}' do |value|
fill_in 'Repository Processing Note', with: value
end

When 'the user changes the resource Title' do
fill_in 'resource_title_', with: 'Resource title chagned'
end
Expand All @@ -34,24 +22,6 @@
fill_in 'resource_id_0_', with: 'Resource identifier chagned'
end

Then 'the resource is updated' do
element = find('.alert.alert-success.with-hide-alert')
expect(element.text).to eq "Resource Resource #{@uuid} updated"
end

Then 'Resource Type has value Records' do
element = find('#resource_resource_type_')
expect(element.value).to eq 'records'
end

Then 'Publish? is checked' do
expect(find('#resource_publish_').check.checked?).to eq true
end

Then 'Restrictions Apply? is checked' do
expect(find('#resource_restrictions_').check.checked?).to eq true
end

Then 'Repository Processing Note has value {string}' do |value|
expect(find('#resource_repository_processing_note_').value).to eq value
end
Expand Down
20 changes: 20 additions & 0 deletions staff-features/shared/step_definitions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,32 @@
select option, from: label
end

When 'the user checks {string}' do |label|
check label
end

Then 'the {string} message is displayed' do |string|
expect(page).to have_text string
end

Then('the {string} updated message is displayed') do |string|
expect(find('.alert.alert-success.with-hide-alert').text).to match /^#{string}.*updated$/
end

Then 'the following error messages are displayed:' do |messages|
messages.raw.each do |message|
expect(page).to have_text message[0]
end
end

Then 'the {string} has value {string}' do |label, value|
expect(page).to have_field(label, with: value)
end

Then 'the {string} has selected value {string}' do |label, value|
expect(page).to have_select(label, selected: value)
end

Then 'the {string} is checked' do |label|
expect(page).to have_field(label, checked: true)
end

0 comments on commit f4131ae

Please sign in to comment.