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

Container Profile merge #107

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
14 changes: 14 additions & 0 deletions staff_features/container_profiles/container_profile_merge.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Feature: Container Profiles merge
Background:
Given an administrator user is logged in
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 destination' in the modal
And the user clicks on 'Merge 2 records' in the Confirm Merge Container Profiles modal
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
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
Loading