Skip to content

Commit

Permalink
Subject import
Browse files Browse the repository at this point in the history
  • Loading branch information
blacksmith-welder committed Jan 30, 2025
1 parent a0ba08c commit f61b16a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 12 deletions.
25 changes: 23 additions & 2 deletions staff_features/jobs/step_definitions/jobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,28 @@
end

Then 'the Import Job page is displayed' do
expect(find('h2').text).to start_with 'Import Job'
tries = 0

loop do
expect(find('h2').text).to start_with 'Import Job'

break
rescue RSpec::Expectations::ExpectationNotMetError => e
tries += 1
sleep 3

raise e if tries == 5
end
end

Then 'the job completes' do
tries = 0
begin

loop do
expect(page).to_not have_text 'This job is next in the queue.'
expect(page).to have_text 'The job has completed.'

break
rescue RSpec::Expectations::ExpectationNotMetError => e
tries += 1
sleep 3
Expand All @@ -35,3 +49,10 @@
Then 'the record links do not display {string}' do |string|
expect(all('span.badge.badge-warning').map(&:text)).not_to include(string)
end

Then 'the Subject is listed in the New & Modified Records form' do
visit current_url

element = find('#generated_uris .subrecord-form-fields')
expect(element.text).to eq 'Subject headings'
end
20 changes: 20 additions & 0 deletions staff_features/subjects/step_definitions/subject_import.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

When 'the user clicks on the gear icon' do
within '.repo-container' do
find('.btn.btn-default.navbar-btn.dropdown-toggle').click
end
end

When 'the user checks {string} in the LCNAF Import form' do |string|
elements = all(:css, "div[class*='radio']")

elements.each do |element|
element.find('input').click if element.text == string
end
end

When 'the user selects the first Subject from the search results' do
elements = all('#results div.lcnaf-result')
elements[0].find('button').click
end
17 changes: 7 additions & 10 deletions staff_features/subjects/subject_import.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@ Feature: Subject Import with the LCNAF Import Plug-In
Background:
Given an administrator user is logged in
And a Subject has been created
And the user is on the ArchivesSpace homepage
Scenario: Subject Import with the LCNAF Import Plug-In
When the user clicks on 'Repository settings'
And the user clicks on 'LCNAF Import' in the dropdown menu in the 'Plug-ins'
And the user clicks on 'LCSH - https://id.loc.gov/authorities/subjects' in the 'LCNAF Import' form
When the user clicks on the gear icon
And the user hovers on 'Plug-ins' in the dropdown menu
And the user clicks on 'LCNAF Import' in the dropdown menu
And the user checks 'LCSH - https://id.loc.gov/authorities/subjects' in the LCNAF Import form
And the user fills in 'Primary Name' with 'subject heading'
And the user clicks on 'Search'
And the user selects the Subject from the search results in the modal
And the user selects the first Subject from the search results
And the user clicks on 'Import'
Then the Import Job page is displayed
And the job completes
And the following message is displayed
|The job has completed.|
Scenario: Complete import process using th LCNAF Import Plug-In
Given the Import Job page is displayed
When the user clicks on 'Refresh Page'
Then the Subject is listed in the New & Modified Records form
| The job has completed. |
And the Subject is listed in the New & Modified Records form

0 comments on commit f61b16a

Please sign in to comment.