Files
docuseal/spec/system/api_settings_spec.rb
T

40 lines
950 B
Ruby
Raw Normal View History

2023-08-20 12:42:47 +03:00
# frozen_string_literal: true
RSpec.describe 'API Settings' do
let!(:account) { create(:account) }
let!(:user) { create(:user, account:) }
before do
sign_in(user)
visit settings_api_index_path
end
it 'shows verify signed PDF page' do
expect(page).to have_content('API')
2024-10-25 16:03:52 +03:00
token = user.access_token.token
expect(page).to have_field('X-Auth-Token', with: token.sub(token[5..], '*' * token[5..].size))
2023-08-20 12:42:47 +03:00
end
2025-09-05 09:29:20 +03:00
it 'reveals API key with correct password' do
find('#api_key').click
within('.modal') do
fill_in 'password', with: user.password
click_button 'Submit'
end
expect(page).to have_field('X-Auth-Token', with: user.access_token.token)
end
it 'shows error with incorrect password' do
find('#api_key').click
within('.modal') do
fill_in 'password', with: 'wrong_password'
click_button 'Submit'
end
expect(page).to have_content('Wrong password')
end
2023-08-20 12:42:47 +03:00
end