Skip to content

Commit

Permalink
Subject edit default values (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdimopulu authored Feb 6, 2025
1 parent 0550a6c commit 207ae21
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,16 @@
And 'the user selects the Digital Object Component' do
click_on "Digital Object Component Label #{@uuid}"
end

Then 'the Assessment is linked to the Digital Object in the {string} form' do |form_title|
section_title = find('h3', text: form_title)
section = section_title.ancestor('section')
expect(section[:id]).to_not eq nil

related_accessions_elements = section.all('li.token-input-token')

expect(related_accessions_elements.length).to eq 1
related_accession = related_accessions_elements[0].find('.digital_object')

expect(related_accession[:'data-content']).to include "digital_objects/#{@digital_object_id}"
end
22 changes: 22 additions & 0 deletions staff_features/subjects/step_definitions/subject_shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,25 @@

wait_for_ajax
end

Given 'the user is on the Subjects page' do
visit "#{STAFF_URL}/subjects"
end

Then 'the new Subject form has the following default values' do |form_values_table|
visit "#{STAFF_URL}/subjects/new"

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
15 changes: 15 additions & 0 deletions staff_features/subjects/subject_edit_default_values.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Feature: Subject Edit Default Values
Background:
Given an administrator user is logged in
And the Pre-populate Records option is checked in Repository Preferences
And the user is on the Subjects page
Scenario: Edit Default Values
When the user clicks on 'Edit Default Values'
And the user fills in 'Authority ID' with 'Test ID'
And the user fills in 'Scope Note' with 'Text'
And the user clicks on 'Save'
Then the 'Defaults' updated message is displayed
And the new Subject form has the following default values
| form_section | form_field | form_value |
| Basic Information | Authority ID | Test ID |
| Basic Information | Scope Note | Text |

0 comments on commit 207ae21

Please sign in to comment.