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 ...@@ -6,8 +6,6 @@ module QA
module_function module_function
def while_signed_in(as: nil, address: :gitlab, admin: false) 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) sign_in(as: as, address: address, admin: admin)
result = yield result = yield
...@@ -23,9 +21,10 @@ module QA ...@@ -23,9 +21,10 @@ module QA
end end
def sign_in(as: nil, address: :gitlab, skip_page_validation: false, admin: false) 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?) unless Page::Main::Login.perform(&:on_login_page?)
Page::Main::Menu.perform(&:sign_out) if Page::Main::Menu.perform(&:signed_in?) Page::Main::Menu.perform(&:sign_out) if Page::Main::Menu.perform(&:signed_in?)
Runtime::Browser.visit(address, Page::Main::Login)
end end
Page::Main::Login.perform do |login| Page::Main::Login.perform do |login|
......
...@@ -386,6 +386,10 @@ module QA ...@@ -386,6 +386,10 @@ module QA
end end
end end
def current_host
URI(page.current_url).host
end
def self.path def self.path
raise NotImplementedError raise NotImplementedError
end end
......
...@@ -156,6 +156,11 @@ module QA ...@@ -156,6 +156,11 @@ module QA
sign_in_using_credentials(user: user) sign_in_using_credentials(user: user)
end 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 private
def sign_in_using_gitlab_credentials(user:, skip_page_validation: false) 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