first_steps_spec.rb 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # Copyright (C) 2012-2022 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 then 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. check "group_ids::#{target_group.id}", option: 'full', allow_label_click: true
  25. click('button')
  26. end
  27. expect(page).to have_no_text 'Sending'
  28. expect(User.last).to have_attributes(firstname: 'Bob', lastname: 'Smith', group_ids: [target_group.id])
  29. end
  30. it 'invites customer' do
  31. within(:active_content) { click '.js-inviteCustomer' }
  32. in_modal do
  33. fill_in 'firstname', with: 'Client'
  34. fill_in 'lastname', with: 'Smith'
  35. fill_in 'email', with: "#{customer}@example.com"
  36. click('button')
  37. end
  38. wait.until { expect(User.last).to have_attributes(firstname: 'Client', lastname: 'Smith') }
  39. expect(page).to have_no_text 'Sending'
  40. end
  41. it 'creates test ticket', sessions_jobs: true do
  42. initial_ticket_count = Ticket.count
  43. within(:active_content) { click '.js-testTicket' }
  44. within '.sidebar .js-activityContent' do
  45. wait.until { Ticket.count == (initial_ticket_count + 1) }
  46. expect(page).to have_text 'Nicole Braun created article for Test Ticket!'
  47. end
  48. end
  49. it 'updates online form channel' do
  50. Setting.set('form_ticket_create', true)
  51. page.refresh
  52. within :active_content do
  53. click '.tab[data-area="first-steps-widgets"]'
  54. end
  55. expect(page).to have_link(href: '#channels/form', class: %w[todo is-done])
  56. end
  57. end