clues_spec.rb 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Clues', authenticated_as: :agent, type: :system do
  4. let(:agent) { create(:agent, hide_clues: false) }
  5. context 'when logging in the first time' do
  6. it 'shows the intro clues' do
  7. visit 'dashboard'
  8. expect_current_route 'clues'
  9. find(:clues_close).in_fixed_position.click
  10. wait.until do
  11. agent.reload.preferences >= { 'intro' => true, 'keyboard_shortcuts_clues' => true }
  12. end
  13. end
  14. end
  15. context 'when logging again after the keyboard shortcuts were changed' do
  16. before do
  17. # Set a state where the agent saw only the intro, but not the keyboard shortcuts clue.
  18. agent.preferences = { 'intro' => true }
  19. agent.save!
  20. end
  21. it 'shows the intro clues' do
  22. visit 'dashboard'
  23. expect(page).to have_text('New Keyboard Shortcuts')
  24. find('div.btn', text: 'Got it!').click
  25. wait.until do
  26. agent.reload.preferences >= { 'intro' => true, 'keyboard_shortcuts_clues' => true }
  27. end
  28. end
  29. end
  30. end