change_customer_spec.rb 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Ticket zoom > Sidebar > Customer', :aggregate_failures, type: :system do
  4. let(:primary_organization) { create(:organization) }
  5. let(:secondary_organizations) { create_list(:organization, 3) }
  6. let(:customer) { create(:customer, organization: primary_organization, organizations: secondary_organizations) }
  7. let(:ticket) { create(:ticket, group: Group.find_by(name: 'Users'), customer: customer) }
  8. context "when using the sidebar to get current customer's information" do
  9. before do
  10. visit "#ticket/zoom/#{ticket.id}"
  11. end
  12. context 'when changing the customer/organization' do
  13. it 'shows the organization field with all possible organizations' do
  14. click '.tabsSidebar-tab[data-tab=customer]'
  15. click '#userAction'
  16. click_on 'Change Customer'
  17. modal_ready
  18. in_modal do
  19. find('[name="customer_id"] ~ .user-select.token-input').fill_in with: customer.firstname
  20. expect(page).to have_css('ul.recipientList > li.recipientList-entry', minimum: 1)
  21. first('.recipientList-entry.js-object').click
  22. expect(page).to have_css('[name="organization_id"]', visible: :all)
  23. find('[data-attribute-name="organization_id"] .js-input').click
  24. expect(page).to have_css('ul.js-optionsList > li.js-option', count: 4)
  25. end
  26. end
  27. end
  28. end
  29. end