Commit 7f1ecd2e authored by Gabriel Mazetto's avatar Gabriel Mazetto

Fix Runtime::Browser.visit to allow omitting `page`

parent bdefb879
module QA
module Page
module Main
class Home < Page::Base
def self.path
'/'
end
end
end
end
end
...@@ -23,18 +23,14 @@ module QA ...@@ -23,18 +23,14 @@ module QA
# In case of an address that is a symbol we will try to guess address # In case of an address that is a symbol we will try to guess address
# based on `Runtime::Scenario#something_address`. # based on `Runtime::Scenario#something_address`.
# #
def visit(address, page, &block) def visit(address, page = nil, &block)
Browser::Session.new(address, page).perform(&block) Browser::Session.new(address, page).perform(&block)
end end
def self.visit(address, page, &block) def self.visit(address, page = nil, &block)
new.visit(address, page, &block) new.visit(address, page, &block)
end end
def self.url_for(instance, page)
Runtime::Scenario.send("#{instance}_address") + page&.path
end
def self.configure! def self.configure!
return if Capybara.drivers.include?(:chrome) return if Capybara.drivers.include?(:chrome)
......
...@@ -21,7 +21,7 @@ module QA ...@@ -21,7 +21,7 @@ module QA
end end
# check it exists on the other machine # check it exists on the other machine
visit(Runtime::Browser.url_for(:geo_secondary, QA::Page::Main::Login)) Runtime::Browser.visit(:geo_secondary, QA::Page::Main::Login) do
Page::Main::OAuth.act do Page::Main::OAuth.act do
authorize! if needs_authorization? authorize! if needs_authorization?
end end
...@@ -46,7 +46,7 @@ module QA ...@@ -46,7 +46,7 @@ module QA
end end
# rename the project # rename the project
visit(Runtime::Browser.url_for(:geo_primary, QA::Page::Main::Home)) Runtime::Browser.visit(:geo_primary)
Page::Menu::Main.act { go_to_projects } Page::Menu::Main.act { go_to_projects }
Page::Dashboard::Projects.perform do |dashboard| Page::Dashboard::Projects.perform do |dashboard|
...@@ -64,7 +64,7 @@ module QA ...@@ -64,7 +64,7 @@ module QA
sleep 2 # wait for replication sleep 2 # wait for replication
# check renamed project exist on secondary node # check renamed project exist on secondary node
visit(Runtime::Browser.url_for(:geo_secondary, QA::Page::Main::Home)) Runtime::Browser.visit(:geo_secondary)
expect(page).to have_content 'You are on a secondary (read-only) Geo node' expect(page).to have_content 'You are on a secondary (read-only) Geo node'
...@@ -85,4 +85,5 @@ module QA ...@@ -85,4 +85,5 @@ module QA
end end
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