organization_profile_spec.rb 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Organization Profile', type: :system do
  4. let(:organization) { create(:organization) }
  5. it 'does show the edit link' do
  6. visit "#organization/profile/#{organization.id}"
  7. click '#userAction label'
  8. click_link 'Edit'
  9. modal_ready
  10. end
  11. context 'members section' do
  12. let(:members) { organization.members.order(id: :asc) }
  13. before do
  14. create_list(:customer, 50, organization: organization)
  15. visit "#organization/profile/#{organization.id}"
  16. end
  17. it 'shows first 10 members and loads more on demand' do
  18. expect(page).to have_text(members[9].fullname)
  19. expect(page).to have_no_text(members[10].fullname)
  20. click '.js-showMoreMembers'
  21. expect(page).to have_text(members[10].fullname)
  22. end
  23. end
  24. context 'when ticket changes in organization profile', authenticated_as: :authenticate do
  25. let(:ticket) { create(:ticket, title: SecureRandom.uuid, customer: create(:customer, :with_org), group: Group.first) }
  26. def authenticate
  27. ticket
  28. true
  29. end
  30. before do
  31. visit "#organization/profile/#{ticket.customer.organization.id}"
  32. end
  33. it 'does update when ticket changes' do
  34. expect(page).to have_text(ticket.title)
  35. ticket.update(title: SecureRandom.uuid)
  36. expect(page).to have_text(ticket.title)
  37. end
  38. end
  39. end