first_steps_spec.rb 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'First Steps', type: :system do
  4. let(:agent) { "bob.smith_#{SecureRandom.uuid}" }
  5. let(:customer) { "customer.smith_#{SecureRandom.uuid}" }
  6. before do
  7. visit 'dashboard'
  8. within :active_content do
  9. click '.tab[data-area="first-steps-widgets"]'
  10. end
  11. end
  12. it 'show first steps configuration page' do
  13. within :active_content do
  14. expect(page).to have_text 'Configuration'
  15. end
  16. end
  17. it 'invites agent (with more than one group)' do
  18. within(:active_content) { click '.js-inviteAgent' }
  19. target_group = Group.last
  20. in_modal do
  21. fill_in 'firstname', with: 'Bob'
  22. fill_in 'lastname', with: 'Smith'
  23. fill_in 'email', with: "#{agent}@example.com"
  24. click 'span', text: 'Agent'
  25. within '.js-groupListNewItemRow' do
  26. click '.js-input'
  27. click 'li', text: target_group.name
  28. click 'input[value="full"]', visible: :all
  29. click '.js-add'
  30. end
  31. click('button')
  32. end
  33. expect(page).to have_no_text 'Sending'
  34. expect(User.last).to have_attributes(firstname: 'Bob', lastname: 'Smith', group_ids: [target_group.id])
  35. end
  36. it 'invites customer' do
  37. within(:active_content) { click '.js-inviteCustomer' }
  38. in_modal do
  39. fill_in 'firstname', with: 'Client'
  40. fill_in 'lastname', with: 'Smith'
  41. fill_in 'email', with: "#{customer}@example.com"
  42. click('button')
  43. end
  44. wait.until { User.last.firstname == 'Client' }
  45. expect(User.last).to have_attributes(firstname: 'Client', lastname: 'Smith')
  46. expect(page).to have_no_text 'Sending'
  47. end
  48. it 'creates test ticket', sessions_jobs: true do
  49. initial_ticket_count = Ticket.count
  50. within(:active_content) { click '.js-testTicket' }
  51. within '.sidebar .js-activityContent' do
  52. wait.until { Ticket.count == (initial_ticket_count + 1) }
  53. expect(page).to have_text 'Nicole Braun created article for Test Ticket!'
  54. end
  55. end
  56. it 'updates online form channel' do
  57. Setting.set('form_ticket_create', true)
  58. page.refresh
  59. within :active_content do
  60. click '.tab[data-area="first-steps-widgets"]'
  61. end
  62. expect(page).to have_link(href: '#channels/form', class: %w[todo is-done])
  63. end
  64. end