-
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
026944c
commit 258b006
Showing
2 changed files
with
75 additions
and
6 deletions.
There are no files selected for viewing
11 changes: 5 additions & 6 deletions
11
staff_features/container_profiles/container_profile_merge.feature
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 |
---|---|---|
@@ -1,15 +1,14 @@ | ||
Feature: Container Profiles merge | ||
Background: | ||
Given an administrator user is logged in | ||
And a two Container Profiles A & B have been created | ||
And the user is on the Container Profiles page | ||
And two Container Profiles A & B have been created | ||
And the two Container Profiles are displayed in the search results | ||
Scenario: Merge two Container Profiles | ||
Given the two Container Profiles A & B are selected | ||
When the user clicks on 'Merge' | ||
And the user selects the Container Profile B in the Merge Container Profiles modal | ||
And the user clicks on 'Select merge target' in the modal | ||
And the user clicks on 'Select merge destination' in the modal | ||
And the user clicks on 'Merge 2 records' in the Confirm Merge Container Profiles modal | ||
Then the 'Container Profile(s)' merged message is displayed | ||
And the user is on the Container Profile B view page | ||
And the Container Profile A is deleted | ||
Then the 'Container Profiles(s)' merged message is displayed | ||
And the Container Profile B view page is displayed | ||
And the Container Profile A is deleted |
70 changes: 70 additions & 0 deletions
70
staff_features/container_profiles/step_definitions/container_profile_merge.rb
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,70 @@ | ||
# frozen_string_literal: true | ||
|
||
Given 'two Container Profiles A & B have been created' do | ||
@shared_container_profile_uuid = SecureRandom.uuid | ||
@container_profile_a_uuid = SecureRandom.uuid | ||
@container_profile_b_uuid = SecureRandom.uuid | ||
|
||
visit "#{STAFF_URL}/container_profiles/new" | ||
fill_in 'container_profile_name_', with: "Container Profile A #{@shared_container_profile_uuid} #{@container_profile_a_uuid}" | ||
fill_in 'container_profile_depth_', with: '1.1' | ||
fill_in 'container_profile_height_', with: '2.2' | ||
fill_in 'container_profile_width_', with: '3.3' | ||
click_on 'Save' | ||
expect(find('.alert.alert-success.with-hide-alert').text).to eq 'Container Profile Created' | ||
url_parts = current_url.split('container_profiles/container_profile_person').pop.split('/') | ||
@container_profile_a_id = url_parts.pop | ||
|
||
visit "#{STAFF_URL}/container_profiles/new" | ||
fill_in 'container_profile_name_', with: "Container Profile B #{@shared_container_profile_uuid} #{@container_profile_b_uuid}" | ||
fill_in 'container_profile_depth_', with: '1.1' | ||
fill_in 'container_profile_height_', with: '2.2' | ||
fill_in 'container_profile_width_', with: '3.3' | ||
click_on 'Save' | ||
expect(find('.alert.alert-success.with-hide-alert').text).to eq 'Container Profile Created' | ||
url_parts = current_url.split('container_profiles/container_profile_person').pop.split('/') | ||
@container_profile_b_id = url_parts.pop | ||
end | ||
|
||
Given 'the two Container Profiles are displayed in the search results' do | ||
visit "#{STAFF_URL}/container_profiles" | ||
|
||
fill_in 'filter-text', with: @shared_container_profile_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 @container_profile_a_uuid | ||
expect(search_result_rows[1]).to have_text @container_profile_b_uuid | ||
end | ||
|
||
When 'the two Container Profiles A & B are selected' do | ||
find('#select_all').click | ||
end | ||
|
||
When 'the user selects the Container Profile B in the Merge Container Profiles modal' do | ||
find(:css, "[id=\"/container_profiles/#{@container_profile_b_id}\"]").click | ||
end | ||
|
||
When 'the user clicks on {string} in the Confirm Merge Container Profiles modal' do |string| | ||
within '#bulkMergeConfirmModal' do | ||
click_on string | ||
end | ||
end | ||
|
||
Then 'the Container Profile B view page is displayed' do | ||
expect(current_url).to eq "#{STAFF_URL}/container_profiles/#{@container_profile_b_id}" | ||
end | ||
|
||
Then 'the Container Profile A is deleted' do | ||
visit "#{STAFF_URL}/container_profiles/#{@container_profile_a_id}" | ||
|
||
expect(find('h2').text).to eq 'Record Not Found' | ||
|
||
expected_text = "The record you've tried to access may no longer exist or you may not have permission to view it." | ||
expect(page).to have_text expected_text | ||
end |