Skip to content

Commit

Permalink
Top container search
Browse files Browse the repository at this point in the history
  • Loading branch information
blacksmith-welder committed Feb 24, 2025
1 parent 22f714b commit bec99f2
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 5 deletions.
24 changes: 24 additions & 0 deletions staff_features/accessions/step_definitions/accession_shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,30 @@
expect(page).to have_text "Accession Accession Title #{@uuid} created"
end

Given 'an Accession with a Top Container has been created' do
visit "#{STAFF_URL}/accessions/new"

fill_in 'accession_id_0_', with: "Accession #{@uuid}"
fill_in 'Title', with: "Accession Title #{@uuid}"
fill_in 'Accession Date', with: ORIGINAL_ACCESSION_DATE
check 'Publish?'

click_on 'Add Container Instance'
select 'Accession', from: 'accession_instances__0__instance_type_'

within '#accession_instances__0__sub_container__top_container__ref__combobox' do
find('button').click

click_on 'Create'
end

fill_in 'top_container_indicator_', with: @uuid
click_on 'Create and Link'

click_on 'Save'
expect(page).to have_text "Accession Accession Title #{@uuid} created"
end

Given 'the Accession is opened in edit mode' do
visit "#{STAFF_URL}/accessions"

Expand Down
53 changes: 53 additions & 0 deletions staff_features/resources/step_definitions/resource_shared.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,58 @@
# frozen_string_literal: true

Given 'a Resource with a Top Container has been created' do
visit "#{STAFF_URL}/resources/new"

visit "#{STAFF_URL}/resources/new"

fill_in 'resource_title_', with: "Resource #{@uuid}"
fill_in 'resource_id_0_', with: "Resource #{@uuid}"
find('#resource_publish_').check
select 'Class', from: 'resource_level_'

click_on 'Add Container Instance'
select 'Accession', from: 'resource_instances__0__instance_type_'

within '#resource_instances__0__sub_container__top_container__ref__combobox' do
find('button').click

click_on 'Create'
end

fill_in 'top_container_indicator_', with: @uuid
click_on 'Create and Link'

languages = all('#resource_lang_materials_ .subrecord-form-list li')
click_on 'Add Language' if languages.length == 0
element = find('#resource_lang_materials__0__language_and_script__language_')
element.send_keys(ORIGINAL_LANGUAGE)
element.send_keys(:tab)

select 'Single', from: 'resource_dates__0__date_type_'
fill_in 'resource_dates__0__begin_', with: ORIGINAL_RESOURCE_DATE
@resource_number_of_dates = 1

fill_in 'resource_extents__0__number_', with: '10'
select 'Cassettes', from: 'resource_extents__0__extent_type_'
@resource_number_of_extents = 1

element = find('#resource_finding_aid_language_')
element.send_keys('ENG')
element.send_keys(:tab)

element = find('#resource_finding_aid_script_')
element.send_keys('Latin')
element.send_keys(:tab)

click_on 'Save'

expect(find('.alert.alert-success.with-hide-alert').text).to have_text "Resource Resource #{@uuid} created"

uri_parts = current_url.split('/')
uri_parts.pop
@resource_id = uri_parts.pop
end

Given 'the Resource is opened in the view mode' do
visit "#{STAFF_URL}/resources/#{@resource_id}"
end
Expand Down
6 changes: 6 additions & 0 deletions staff_features/shared/step_definitions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -421,3 +421,9 @@
Then 'the button has text {string}' do |text|
expect(page).to have_text text
end

When 'the user clicks on the gear icon' do
within '.repo-container' do
find('.btn.btn-default.navbar-btn.dropdown-toggle').click
end
end
21 changes: 21 additions & 0 deletions staff_features/top_containers/step_definitions/step_definitions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

When 'the user fills in {string} with the Resource title' do |label|
fill_in label, with: @uuid
end

When 'the user fills in {string} with the Accession title' do |label|
fill_in label, with: @uuid
end

Then 'the Top Container associated with the Resource is in the search results' do
results = all('#bulk_operation_results tbody tr')
expect(results.length).to eq 1
expect(results[0].text).to include @uuid
end

Then 'the Top Container associated with the Accession is in the search results' do
results = all('#bulk_operation_results tbody tr')
expect(results.length).to eq 1
expect(results[0].text).to include @uuid
end
12 changes: 7 additions & 5 deletions staff_features/top_containers/top_container_search.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ Feature: Top container Search
Background:
Given an administrator user is logged in
Scenario: Search Top Container associated with a Resource
Given a Top Container has been created for a Resource
Given a Resource with a Top Container has been created
When the user clicks on the gear icon
And the user clicks on 'Manage Top Containers'
And the user filters by text with the Resource title
And the user fills in 'Keyword' with the Resource title
And the user clicks on 'Search'
Then the Top Container associated with the Resource is in the search results
Scenario: Search Top Container associated with an Accession
Given a Top Container has been created for an Accession
Given an Accession with a Top Container has been created
When the user clicks on the gear icon
And the user clicks on 'Manage Top Containers'
And the user filters by text with the Accession title
Then the Top Container associated with the Accession is in the search results
And the user fills in 'Keyword' with the Accession title
And the user clicks on 'Search'
Then the Top Container associated with the Accession is in the search results

0 comments on commit bec99f2

Please sign in to comment.