Commit cf96c74e authored by Andrejs Cunskis's avatar Andrejs Cunskis

Merge branch 'qa-geo-check-address' into 'master'

Match address of host when checking whether to login

See merge request gitlab-org/gitlab!73492
parents 46fddfdd d8d066de
......@@ -6,8 +6,6 @@ module QA
module_function
def while_signed_in(as: nil, address: :gitlab, admin: false)
Page::Main::Menu.perform(&:sign_out_if_signed_in)
sign_in(as: as, address: address, admin: admin)
result = yield
......@@ -23,9 +21,10 @@ module QA
end
def sign_in(as: nil, address: :gitlab, skip_page_validation: false, admin: false)
Page::Main::Login.perform { |p| p.redirect_to_login_page(address) }
unless Page::Main::Login.perform(&:on_login_page?)
Page::Main::Menu.perform(&:sign_out) if Page::Main::Menu.perform(&:signed_in?)
Runtime::Browser.visit(address, Page::Main::Login)
end
Page::Main::Login.perform do |login|
......
......@@ -386,6 +386,10 @@ module QA
end
end
def current_host
URI(page.current_url).host
end
def self.path
raise NotImplementedError
end
......
......@@ -156,6 +156,11 @@ module QA
sign_in_using_credentials(user: user)
end
def redirect_to_login_page(address)
desired_host = URI(Runtime::Scenario.send("#{address}_address")).host
Runtime::Browser.visit(address, Page::Main::Login) if desired_host != current_host
end
private
def sign_in_using_gitlab_credentials(user:, skip_page_validation: false)
......
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