From a174e95fabf6e4d58741104077d6a5f3b45078c4 Mon Sep 17 00:00:00 2001 From: Martin Gruner Date: Fri, 24 May 2024 15:17:05 +0200 Subject: [PATCH] Maintenance: Added test for token user preferences. --- spec/system/apps/desktop/account_spec.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/spec/system/apps/desktop/account_spec.rb b/spec/system/apps/desktop/account_spec.rb index 519c352a533d..7626228c63d4 100644 --- a/spec/system/apps/desktop/account_spec.rb +++ b/spec/system/apps/desktop/account_spec.rb @@ -57,6 +57,30 @@ end end + describe 'token handling' do + let(:agent) { create(:admin) } + + it 'user can create and use a token' do + click_on 'Profile settings' + click_on 'Token Access' + + click_on 'New Personal Access Token' + + fill_in 'Name', with: 'Test Token' + + # Activate some permissions for the token + find('span', text: 'Configure your system.').click + find('span', text: 'Manage personal settings.').click + + click_on 'Create' + wait_for_mutation('userCurrentAccessTokenAdd') + + expect(Token.last.name).to eq('Test Token') + expect(Token.last.permissions.map(&:name)).to eq(%w[admin user_preferences]) + expect(Token.last.check?).to be(true) + end + end + describe 'avatar handling', authenticated_as: :agent do let(:agent) { create(:agent, firstname: 'Jane', lastname: 'Doe') }