From 10494a5d645c4d4e8d46718a67856cb356f9d3b2 Mon Sep 17 00:00:00 2001 From: blacksmith-welder Date: Sat, 21 Dec 2024 12:23:22 +0200 Subject: [PATCH] Digital object component default values --- ...ject_component_edit_default_values.feature | 13 +++++------- .../digital_object_default_values.rb | 21 +++++++++++++++++++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/staff_features/digital_objects/digital_object_component_edit_default_values.feature b/staff_features/digital_objects/digital_object_component_edit_default_values.feature index 1b11a8e..749cfa9 100644 --- a/staff_features/digital_objects/digital_object_component_edit_default_values.feature +++ b/staff_features/digital_objects/digital_object_component_edit_default_values.feature @@ -2,19 +2,16 @@ Feature: Digital Object 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 Digital Object has been created And the user is on the Digital Objects page - Scenario: Open Digital Object Component Edit Default values page + Scenario: Edit Default Values of Digital Object Component When the user clicks on 'Edit Default Values' And the user clicks on 'Digital Object Component' in the dropdown menu - Then the Digital Object Component Defaults page is displayed - Scenario: Edit Default Values of Digital Object Component - Given a Digital Object has been created - And the user is on the Digital Object Component Defaults page When the user fills in 'Label' with 'Test label' And the user fills in 'Title' with 'Test title' And the user clicks on 'Save Digital Object Component' Then the 'Defaults' updated message is displayed And the new Digital Object Component form has the following default values - | form_section | form_field | form_value | - | Basic Information | Label | Test label | - | Basic Information | Title | Test title | + | form_section | form_field | form_value | + | Basic Information | Label | Test label | + | Basic Information | Title | Test title | diff --git a/staff_features/digital_objects/step_definitions/digital_object_default_values.rb b/staff_features/digital_objects/step_definitions/digital_object_default_values.rb index 6db119e..31b014f 100644 --- a/staff_features/digital_objects/step_definitions/digital_object_default_values.rb +++ b/staff_features/digital_objects/step_definitions/digital_object_default_values.rb @@ -17,3 +17,24 @@ end end end + +Then 'the new Digital Object Component form has the following default values' do |form_values_table| + visit "#{STAFF_URL}/digital_objects/#{@digital_object_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