-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7849531
commit c0ff8ad
Showing
5 changed files
with
167 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
Given 'an Agent has been created' do | ||
visit "#{STAFF_URL}/agents/agent_person/new" | ||
|
||
fill_in 'Primary Part of Name', with: @uuid | ||
|
||
click_on 'Save' | ||
|
||
expect(find('.alert.alert-success.with-hide-alert').text).to eq 'Agent Created' | ||
|
||
url_parts = current_url.split('agents/agent_person').pop.split('/') | ||
url_parts.pop | ||
@agent_id = url_parts.pop | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
# frozen_string_literal: true | ||
|
||
Given 'two Agents have been created with a common keyword in their name' do | ||
@shared_agent_uuid = SecureRandom.uuid | ||
@agent_a_uuid = SecureRandom.uuid | ||
@agent_b_uuid = SecureRandom.uuid | ||
|
||
visit "#{STAFF_URL}/agents/agent_person/new" | ||
fill_in 'Primary Part of Name', with: "A #{@agent_a_uuid} #{@shared_agent_uuid}" | ||
fill_in 'Authority ID', with: "A #{@agent_a_uuid} #{@shared_agent_uuid}" | ||
select 'Local sources', from: 'Source' | ||
select 'Anglo-American Cataloging Rules', from: 'Rules' | ||
click_on 'Save' | ||
expect(find('.alert.alert-success.with-hide-alert').text).to eq 'Agent Created' | ||
url_parts = current_url.split('agents/agent_person').pop.split('/') | ||
url_parts.pop | ||
@agent_a_id = url_parts.pop | ||
|
||
visit "#{STAFF_URL}/agents/agent_person/new" | ||
fill_in 'Primary Part of Name', with: "B #{@agent_b_uuid} #{@shared_agent_uuid}" | ||
fill_in 'Authority ID', with: "B #{@agent_b_uuid} #{@shared_agent_uuid}" | ||
select 'NAD / ARK II Name Authority Database', from: 'Source' | ||
select 'Describing Archives: A Content Standard', from: 'Rules' | ||
click_on 'Save' | ||
expect(find('.alert.alert-success.with-hide-alert').text).to eq 'Agent Created' | ||
url_parts = current_url.split('agents/agent_person').pop.split('/') | ||
url_parts.pop | ||
@agent_b_id = url_parts.pop | ||
end | ||
|
||
Given 'the two Agents are displayed sorted by ascending name' do | ||
visit "#{STAFF_URL}/agents" | ||
|
||
fill_in 'filter-text', with: @shared_agent_uuid | ||
|
||
within '.search-filter' do | ||
find('button').click | ||
end | ||
|
||
search_result_rows = all('#tabledSearchResults tbody tr') | ||
|
||
expect(search_result_rows.length).to eq 2 | ||
expect(search_result_rows[0]).to have_text @agent_a_uuid | ||
expect(search_result_rows[1]).to have_text @agent_b_uuid | ||
end | ||
|
||
Then 'the two Agents are displayed sorted by descending name' do | ||
search_result_rows = all('#tabledSearchResults tbody tr') | ||
|
||
expect(search_result_rows.length).to eq 2 | ||
expect(search_result_rows[1]).to have_text @agent_a_uuid | ||
expect(search_result_rows[0]).to have_text @agent_b_uuid | ||
end | ||
|
||
Then 'the two Agents are displayed sorted by ascending type' do | ||
search_result_rows = all('#tabledSearchResults tbody tr') | ||
|
||
expect(search_result_rows.length).to eq 2 | ||
expect(search_result_rows[0]).to have_text @agent_a_uuid | ||
expect(search_result_rows[1]).to have_text @agent_b_uuid | ||
end | ||
|
||
Then 'the two Agents are displayed sorted by ascending level' do | ||
search_result_rows = all('#tabledSearchResults tbody tr') | ||
|
||
expect(search_result_rows.length).to eq 2 | ||
expect(search_result_rows[1]).to have_text @agent_a_uuid | ||
expect(search_result_rows[0]).to have_text @agent_b_uuid | ||
end | ||
|
||
Then 'the two Agents are displayed sorted by ascending Authority ID' do | ||
search_result_rows = all('#tabledSearchResults tbody tr') | ||
|
||
expect(search_result_rows.length).to eq 2 | ||
expect(search_result_rows[0]).to have_text @agent_a_uuid | ||
expect(search_result_rows[1]).to have_text @agent_b_uuid | ||
end | ||
|
||
Then 'the two Agents are displayed sorted by ascending source' do | ||
search_result_rows = all('#tabledSearchResults tbody tr') | ||
|
||
expect(search_result_rows.length).to eq 2 | ||
expect(search_result_rows[0]).to have_text @agent_a_uuid | ||
expect(search_result_rows[1]).to have_text @agent_b_uuid | ||
end | ||
|
||
Then 'the two Agents are displayed sorted by ascending rule' do | ||
search_result_rows = all('#tabledSearchResults tbody tr') | ||
|
||
expect(search_result_rows.length).to eq 2 | ||
expect(search_result_rows[0]).to have_text @agent_a_uuid | ||
expect(search_result_rows[1]).to have_text @agent_b_uuid | ||
end | ||
|
||
Then 'the two Agents are displayed sorted by ascending created date' do | ||
search_result_rows = all('#tabledSearchResults tbody tr') | ||
|
||
expect(search_result_rows.length).to eq 2 | ||
expect(search_result_rows[0]).to have_text @agent_a_uuid | ||
expect(search_result_rows[1]).to have_text @agent_b_uuid | ||
end | ||
|
||
Then 'Sort Agents by modified date' do | ||
search_result_rows = all('#tabledSearchResults tbody tr') | ||
|
||
expect(search_result_rows.length).to eq 2 | ||
expect(search_result_rows[0]).to have_text @agent_a_uuid | ||
expect(search_result_rows[1]).to have_text @agent_b_uuid | ||
end | ||
|
||
Then 'the two Agents are displayed sorted by ascending modified date' do | ||
search_result_rows = all('#tabledSearchResults tbody tr') | ||
|
||
expect(search_result_rows.length).to eq 2 | ||
expect(search_result_rows[0]).to have_text @agent_a_uuid | ||
expect(search_result_rows[1]).to have_text @agent_b_uuid | ||
end | ||
|
||
When 'the user filters by text with the Agent name' do | ||
fill_in 'Filter by text', with: @uuid | ||
|
||
find('#filter-text').send_keys(:enter) | ||
|
||
rows = [] | ||
checks = 0 | ||
|
||
while checks < 5 | ||
checks += 1 | ||
|
||
begin | ||
rows = all('tr', text: @uuid) | ||
rescue Selenium::WebDriver::Error::JavascriptError | ||
sleep 1 | ||
end | ||
|
||
break if rows.length == 1 | ||
end | ||
end | ||
|
||
Then 'the Agent is in the search results' do | ||
expect(page).to have_css('tr', text: @uuid) | ||
end | ||
|
||
Then 'the Agent view page is displayed' do | ||
expect(find('h2').text).to eq "#{@uuid} Agent" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters