twitter_spec.rb 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Manage > Channels > Twitter', :use_vcr, type: :system do
  4. context 'credentials' do
  5. before { visit '/#channels/twitter' }
  6. context 'incomplete' do
  7. it 'displays a 401 error modal' do
  8. within(:active_content) do
  9. find('.js-configApp').click
  10. in_modal do
  11. fill_in 'Twitter Consumer Key *', with: 'some_key', exact: true
  12. fill_in 'Twitter Consumer Secret *', with: 'some_secret', exact: true
  13. click_on 'Submit'
  14. expect(page).to have_css('.alert', text: '401 Unauthorized (Invalid credentials may be to blame.)')
  15. end
  16. end
  17. end
  18. end
  19. context 'invalid' do
  20. it 'displays a 401 error modal' do
  21. within(:active_content) do
  22. find('.js-configApp').click
  23. in_modal do
  24. fill_in 'Twitter Consumer Key *', with: 'some_key', exact: true
  25. fill_in 'Twitter Consumer Secret *', with: 'some_secret', exact: true
  26. fill_in 'Twitter Access Token *', with: 'some_oauth_token', exact: true
  27. fill_in 'Twitter Access Token Secret *', with: 'some_oauth_token_secret', exact: true
  28. fill_in 'Twitter Dev environment label *', with: 'some_env', exact: true
  29. click_on 'Submit'
  30. expect(page).to have_css('.alert', text: '401 Unauthorized (Invalid credentials may be to blame.)')
  31. end
  32. end
  33. end
  34. end
  35. end
  36. end