Skip to content

Commit

Permalink
Subject Add external document (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdimopulu authored Feb 6, 2025
1 parent ea6734b commit 0550a6c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
13 changes: 13 additions & 0 deletions staff_features/subjects/step_definitions/subject_edit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,16 @@

expect(elements.length).to eq 0
end

Then 'a new External Document is added to the Subject with the following values' do |form_values_table|
records = all('#subject_external_documents_ .subrecord-form-list li')

expect(records.length).to eq @subject_number_of_external_documents + 1

created_record = records.last

form_values_hash = form_values_table.rows_hash
form_values_hash.each do |field, value|
expect(created_record.find_field(field).value.downcase.gsub(' ', '_')).to eq value.downcase.gsub(' ', '_')
end
end
2 changes: 2 additions & 0 deletions staff_features/subjects/step_definitions/subject_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
select 'Art & Architecture Thesaurus', from: 'subject_source_'
select 'Cultural context', from: 'subject_terms__0__term_type_'

@subject_number_of_external_documents = 0

click_on 'Save'
expect(find('.alert.alert-success.with-hide-alert').text).to eq 'Subject Created'

Expand Down
22 changes: 22 additions & 0 deletions staff_features/subjects/subject_add_external_document.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Feature: Subject External Documemt
Background:
Given an administrator user is logged in
And a Subject has been created
And the Subject is opened in edit mode
Scenario: Add External Document
When the user clicks on 'External Documents'
And the user clicks on 'Add External Document'
And the user fills in 'Title' with 'Test title'
And the user fills in 'Location' with 'Test location'
And the user clicks on 'Save Subject'
Then the 'Subject' saved message is displayed
And a new External Document is added to the Subject with the following values
| Title | Test title |
| Location | Test location |
Scenario: External Document is not added because required fields are missing
When the user clicks on 'External Documents'
And the user clicks on 'Add External Document'
And the user clicks on 'Save Subject'
Then the following error messages are displayed
| Title - Property is required but was missing |
| Location - Property is required but was missing |

0 comments on commit 0550a6c

Please sign in to comment.