Skip to content

Commit

Permalink
Resource component default values
Browse files Browse the repository at this point in the history
  • Loading branch information
blacksmith-welder committed Jan 3, 2025
1 parent 56f1055 commit 083fe2a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
2 changes: 2 additions & 0 deletions helpers/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ def find_user_table_row_in_manage_user_access_page(username)
end

def create_resource(uuid)
visit "#{STAFF_URL}/resources/new"

fill_in 'resource_title_', with: "Resource #{uuid}"
fill_in 'resource_id_0_', with: "Resource #{uuid}"
find('#resource_publish_').check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ Feature: Resource Component Edit Default Values
Background:
Given an administrator user is logged in
And the Pre-populate Records option is checked in Repository Preferences
And a Resource has been created
And the user is on the Resources page
Scenario: Open Resource Component Edit Default values page
When the user clicks on 'Edit Default Values'
And the user clicks on 'Resource Component' in the dropdown menu
Then the Component Record Defaults page is displayed
Scenario: Edit Default Values of Resource Component
Given the user is on the Component Record Default page
Given a Resource has been created
And the user is on the Component Record Default page
When the user fills in 'Title' with 'Default Component Test'
And the user selects 'File' from 'Level of Description'
And the user clicks on 'Save'
Expand All @@ -18,4 +18,3 @@ Feature: Resource Component Edit Default Values
| form_section | form_field | form_value |
| Basic Information | Title | Default Component Test |
| Basic Information | Level of Description | File |

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

Given 'the user is on the Component Record Default page' do
visit "#{STAFF_URL}/archival_objects/defaults"
end

Then 'the Component Record Defaults page is displayed' do
expect(current_url).to include '/archival_objects/defaults'
end

Then 'the new Resource Component form has the following default values' do |form_values_table|
visit "#{STAFF_URL}/resources/#{@resource_id}/edit"
wait_for_ajax
click_on 'Add Child'
wait_for_ajax

form_values = form_values_table.hashes

form_values.each do |row|
section_title = find('h3', text: row['form_section'])
section = section_title.ancestor('section')
expect(section[:id]).to_not eq nil

within section do
field = find_field(row['form_field'])

expect(field.value.downcase).to eq row['form_value'].downcase
end
end
end

0 comments on commit 083fe2a

Please sign in to comment.