dashboard_spec.rb 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. require 'rails_helper'
  2. RSpec.describe 'Dashboard', type: :system, authenticated_as: true do
  3. it 'shows default widgets' do
  4. visit 'dashboard'
  5. expect(page).to have_css('.stat-widgets')
  6. expect(page).to have_css('.ticket_waiting_time > div > div.stat-title', text: /∅ Waiting time today/i)
  7. expect(page).to have_css('.ticket_escalation > div > div.stat-title', text: /Mood/i)
  8. expect(page).to have_css('.ticket_channel_distribution > div > div.stat-title', text: /Channel Distribution/i)
  9. expect(page).to have_css('.ticket_load_measure > div > div.stat-title', text: /Assigned/i)
  10. expect(page).to have_css('.ticket_in_process > div > div.stat-title', text: /Your tickets in process/i)
  11. expect(page).to have_css('.ticket_reopen > div > div.stat-title', text: /Reopening rate/i)
  12. end
  13. context 'when customer role is named different', authenticated_as: :authenticate do
  14. def authenticate
  15. Role.find_by(name: 'Customer').update(name: 'Public')
  16. true
  17. end
  18. it 'invites a customer user' do
  19. visit 'dashboard'
  20. find('div.tab[data-area=first-steps-widgets]').click
  21. find('.js-inviteCustomer').click
  22. fill_in 'Firstname', with: 'Nick'
  23. fill_in 'Lastname', with: 'Braun'
  24. fill_in 'Email', with: 'nick.braun@zammad.org'
  25. click_on 'Invite'
  26. await_empty_ajax_queue
  27. expect(User.find_by(firstname: 'Nick').roles).to eq([Role.find_by(name: 'Public')])
  28. end
  29. end
  30. end