# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/ require 'rails_helper' RSpec.describe 'Manage > Channels > Twitter', :use_vcr, type: :system do context 'credentials' do before { visit '/#channels/twitter' } context 'incomplete' do it 'displays a 401 error modal' do within(:active_content) do find('.js-configApp').click in_modal do fill_in 'Twitter Consumer Key *', with: 'some_key', exact: true fill_in 'Twitter Consumer Secret *', with: 'some_secret', exact: true click_on 'Submit' expect(page).to have_css('.alert', text: '401 Unauthorized (Invalid credentials may be to blame.)') end end end end context 'invalid' do it 'displays a 401 error modal' do within(:active_content) do find('.js-configApp').click in_modal do fill_in 'Twitter Consumer Key *', with: 'some_key', exact: true fill_in 'Twitter Consumer Secret *', with: 'some_secret', exact: true fill_in 'Twitter Access Token *', with: 'some_oauth_token', exact: true fill_in 'Twitter Access Token Secret *', with: 'some_oauth_token_secret', exact: true fill_in 'Twitter Dev environment label *', with: 'some_env', exact: true click_on 'Submit' expect(page).to have_css('.alert', text: '401 Unauthorized (Invalid credentials may be to blame.)') end end end end end end