Commit 97f9cf09 authored by Walmyr Lima e Silva Filho's avatar Walmyr Lima e Silva Filho

Merge branch 'qa-add-retry-group-audit-logs-spec' into 'master'

Wait for audit event in group audit logs spec

Closes #36728

See merge request gitlab-org/gitlab!21602
parents b745647f f6598ae4
......@@ -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