diff --git a/staff_features/digital_objects/step_definitions/digital_object_shared.rb b/staff_features/digital_objects/step_definitions/digital_object_shared.rb index dd6e45c7..c0ad6760 100644 --- a/staff_features/digital_objects/step_definitions/digital_object_shared.rb +++ b/staff_features/digital_objects/step_definitions/digital_object_shared.rb @@ -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 diff --git a/staff_features/subjects/step_definitions/subject_shared.rb b/staff_features/subjects/step_definitions/subject_shared.rb index 9d4258dc..01bef603 100644 --- a/staff_features/subjects/step_definitions/subject_shared.rb +++ b/staff_features/subjects/step_definitions/subject_shared.rb @@ -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 diff --git a/staff_features/subjects/subject_edit_default_values.feature b/staff_features/subjects/subject_edit_default_values.feature new file mode 100644 index 00000000..a59f6c7f --- /dev/null +++ b/staff_features/subjects/subject_edit_default_values.feature @@ -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 |