2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
RSpec.describe 'Admin::HookLogs', feature_category: :continuous_verification do
|
2023-01-13 00:05:48 +05:30
|
|
|
let_it_be(:system_hook) { create(:system_hook) }
|
|
|
|
let_it_be(:hook_log) { create(:web_hook_log, web_hook: system_hook, internal_error_message: 'some error') }
|
|
|
|
let_it_be(:admin) { create(:admin) }
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
before do
|
2021-02-22 17:27:13 +05:30
|
|
|
sign_in(admin)
|
|
|
|
gitlab_enable_admin_mode_sign_in(admin)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'show list of hook logs' do
|
2017-09-10 17:25:29 +05:30
|
|
|
hook_log
|
|
|
|
visit edit_admin_hook_path(system_hook)
|
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
expect(page).to have_content('Recent events')
|
|
|
|
expect(page).to have_link('View details', href: admin_hook_hook_log_path(system_hook, hook_log))
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'show hook log details' do
|
2017-09-10 17:25:29 +05:30
|
|
|
hook_log
|
|
|
|
visit edit_admin_hook_path(system_hook)
|
|
|
|
click_link 'View details'
|
|
|
|
|
|
|
|
expect(page).to have_content("POST #{hook_log.url}")
|
|
|
|
expect(page).to have_content(hook_log.internal_error_message)
|
|
|
|
expect(page).to have_content('Resend Request')
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'retry hook log' do
|
2017-09-10 17:25:29 +05:30
|
|
|
WebMock.stub_request(:post, system_hook.url)
|
|
|
|
|
|
|
|
hook_log
|
|
|
|
visit edit_admin_hook_path(system_hook)
|
|
|
|
click_link 'View details'
|
|
|
|
click_link 'Resend Request'
|
|
|
|
|
2022-05-07 20:08:51 +05:30
|
|
|
expect(page).to have_current_path(edit_admin_hook_path(system_hook), ignore_query: true)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
2022-07-23 23:45:48 +05:30
|
|
|
|
|
|
|
context 'response data is too large' do
|
|
|
|
let(:hook_log) { create(:web_hook_log, web_hook: system_hook, request_data: WebHookLog::OVERSIZE_REQUEST_DATA) }
|
|
|
|
|
|
|
|
it 'shows request data as too large and disables retry function' do
|
|
|
|
visit(admin_hook_hook_log_path(system_hook, hook_log))
|
|
|
|
|
|
|
|
expect(page).to have_content('Request data is too large')
|
|
|
|
expect(page).not_to have_button(
|
|
|
|
_('Resent request'),
|
|
|
|
disabled: true, class: 'has-tooltip', title: _("Request data is too large")
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|