Commit 0a77480d authored by Sanad Liaquat's avatar Sanad Liaquat

Fix instance audit log spec flakiness

Ensure that user is logged in as admin by logging out if already
logged in and login in not logged in already
parent 68fbe9c8
...@@ -5,6 +5,8 @@ module QA ...@@ -5,6 +5,8 @@ module QA
context 'Manage' do context 'Manage' do
shared_examples 'instance audit event logs' do |expected_events| shared_examples 'instance audit event logs' do |expected_events|
it 'logs audit events for UI operations' do it 'logs audit events for UI operations' do
sign_in
Page::Main::Menu.perform(&:click_admin_area) Page::Main::Menu.perform(&:click_admin_area)
QA::Page::Admin::Menu.perform(&:go_to_monitoring_audit_logs) QA::Page::Admin::Menu.perform(&:go_to_monitoring_audit_logs)
EE::Page::Admin::Monitoring::AuditLog.perform do |audit_log_page| EE::Page::Admin::Monitoring::AuditLog.perform do |audit_log_page|
...@@ -110,10 +112,9 @@ module QA ...@@ -110,10 +112,9 @@ module QA
end end
def sign_in def sign_in
unless Page::Main::Menu.perform { |p| p.has_personal_area?(wait: 0) } Page::Main::Menu.perform(&:sign_out_if_signed_in)
Runtime::Browser.visit(:gitlab, Page::Main::Login) Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_admin_credentials) Page::Main::Login.perform(&:sign_in_using_admin_credentials)
end
end end
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