ticket_merge_spec.rb 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Mobile > Ticket > Merge tickets', app: :mobile, authenticated_as: :agent, type: :system do
  4. let(:group) { create(:group) }
  5. let(:agent) { create(:agent, groups: [group]) }
  6. let!(:source_ticket) { create(:ticket, title: 'Source', group: group) }
  7. let!(:target_ticket) { create(:ticket, title: 'Target', group: group) }
  8. before do
  9. searchindex_model_reload([Ticket])
  10. end
  11. context 'when merging tickets', searchindex: true do
  12. it 'can merge two tickets' do
  13. visit "/tickets/#{source_ticket.id}"
  14. wait_for_form_to_settle('form-ticket-edit')
  15. find_button('Show ticket actions').click
  16. find_button('Merge tickets').click
  17. search_input = find('[role="searchbox"]')
  18. search_input.fill_in(with: target_ticket.title)
  19. find('[role="option"]', text: "#{Setting.get('ticket_hook')}#{Setting.get('ticket_hook_divider')}#{target_ticket.number} - #{target_ticket.title}").click
  20. wait_for_gql 'shared/entities/ticket/graphql/queries/autocompleteSearchTicket.graphql'
  21. find('[aria-label="Confirm merge"]').click
  22. find_button('OK').click
  23. wait_for_gql 'shared/entities/ticket/graphql/mutations/merge.graphql'
  24. expect_current_route "/tickets/#{target_ticket.id}"
  25. expect(page).to have_no_css('[role="dialog"]')
  26. end
  27. end
  28. end