Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subject Add external document #78

Merged
merged 2 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
Loading