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') }