Commit f6598ae4 authored by Desiree Chevalier's avatar Desiree Chevalier Committed by Walmyr Lima e Silva Filho

Wait for audit event in group audit logs spec

parent b745647f
......@@ -3,8 +3,14 @@ require 'securerandom'
module QA
context 'Manage' do
include Support::Api
let(:api_client) { Runtime::API::Client.new(:gitlab) }
shared_examples 'group audit event logs' do |expected_events|
it 'logs audit events' do
wait_for_audit_events(expected_events)
Page::Group::Menu.perform(&:go_to_audit_events_settings)
expected_events.each do |expected_event|
expect(page).to have_text(expected_event)
......@@ -19,6 +25,10 @@ module QA
end
end
before do
@event_count = get_audit_event_count
end
let(:project) do
Resource::Project.fabricate_via_api! do |resource|
resource.name = 'project-shared-with-group'
......@@ -110,5 +120,18 @@ module QA
end
end
end
def get_audit_event_count
response = get Runtime::API::Request.new(api_client, "/groups/#{@group.id}/audit_events").url
parse_body(response).length
end
def wait_for_audit_events(expected_events)
new_event_count = @event_count + expected_events.length
Support::Retrier.retry_until(sleep_interval: 1) do
get_audit_event_count == new_event_count
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment