account_spec.rb 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Mobile > App Account Page', app: :mobile, type: :system do
  4. context 'when on account page' do
  5. let(:admin) { create(:admin) }
  6. let(:agent) { create(:agent) }
  7. before do
  8. visit '/account'
  9. end
  10. context 'when updating locale', authenticated_as: :agent do
  11. it 'check that user can see and change locale' do
  12. locale = find_treeselect('Language')
  13. # current locale is visible
  14. expect(locale).to have_selected_option('English (United States)')
  15. locale.select_option('Dansk')
  16. wait_for_gql('apps/mobile/pages/account/graphql/mutations/locale.graphql')
  17. agent.reload
  18. expect(agent.preferences[:locale]).to eq('da')
  19. end
  20. end
  21. context 'when checking about information' do
  22. context 'when permitted', authenticated_as: :admin do
  23. it 'shows about information' do
  24. wait_for_gql('shared/graphql/queries/about.graphql')
  25. expect(page).to have_content(Version.get)
  26. end
  27. end
  28. context 'when forbidden', authenticated_as: :agent do
  29. it 'does not show about information' do
  30. expect(page).to have_no_content(Version.get)
  31. end
  32. end
  33. end
  34. end
  35. end