account_spec.rb 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Mobile > App Account Page', type: :system, app: :mobile 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. # current locale is visible
  13. expect(page).to have_content('English')
  14. click('output', text: %r{English}i)
  15. click('span', text: %r{Dansk}i)
  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