Commit 21d2b475 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'fix-geo-ssh-push-secondary-clone-qa' into 'master'

Fix wait for project replication before getting clone URL

Closes gitlab-org/quality/nightly#51

See merge request gitlab-org/gitlab-ee!8937
parents 9913c389 aa1d8bde
......@@ -5,7 +5,7 @@ module QA
module Show
def wait_for_repository_replication(max_wait: Runtime::Geo.max_file_replication_time)
wait_until_geo_max_replication_time(max_wait: max_wait) do
!page.has_text?(/No repository|The repository for this project is empty/)
has_no_text?(/No repository|The repository for this project is empty/)
end
end
......
......@@ -112,6 +112,10 @@ module QA
has_css?(element_selector_css(name))
end
def has_no_text?(text)
page.has_no_text? text
end
def within_element(name)
page.within(element_selector_css(name)) do
yield
......
......@@ -12,7 +12,7 @@ module QA
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
# Visit the primary node and login
Page::Main::Login.act { sign_in_using_credentials }
Page::Main::Login.perform(&:sign_in_using_credentials)
# Create a new Project
project = Resource::Project.fabricate! do |project|
......@@ -40,7 +40,7 @@ module QA
expect(banner).to have_secondary_read_only_banner
end
Page::Main::Menu.perform { |menu| menu.go_to_projects }
Page::Main::Menu.perform(&:go_to_projects)
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(project.name)
......@@ -48,7 +48,10 @@ module QA
end
# Grab the HTTP URI for the secondary and store as 'location'
location = Page::Project::Show.act { repository_clone_http_location }
location = Page::Project::Show.perform do |project_page|
project_page.wait_for_repository_replication
project_page.repository_clone_http_location
end
# Perform a git push over HTTP at the secondary
push = Resource::Repository::Push.fabricate! do |push|
......@@ -88,7 +91,7 @@ module QA
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
# Visit the primary node and login
Page::Main::Login.act { sign_in_using_credentials }
Page::Main::Login.perform(&:sign_in_using_credentials)
# Create a new Project
project = Resource::Project.fabricate! do |project|
......@@ -116,7 +119,7 @@ module QA
expect(banner).to have_secondary_read_only_banner
end
Page::Main::Menu.perform { |menu| menu.go_to_projects }
Page::Main::Menu.perform(&:go_to_projects)
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(project.name)
......@@ -124,7 +127,10 @@ module QA
end
# Grab the HTTP URI for the secondary and store as 'location'
location = Page::Project::Show.act { repository_clone_http_location }
location = Page::Project::Show.perform do |project_page|
project_page.wait_for_repository_replication
project_page.repository_clone_http_location
end
# Perform a git push over HTTP at the secondary
push = Resource::Repository::Push.fabricate! do |push|
......
......@@ -14,7 +14,7 @@ module QA
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
# Visit the primary node and login
Page::Main::Login.act { sign_in_using_credentials }
Page::Main::Login.perform(&:sign_in_using_credentials)
# Create a new SSH key for the user
key = Resource::SSHKey.fabricate! do |resource|
......@@ -49,7 +49,7 @@ module QA
end
# Ensure the SSH key has replicated
Page::Main::Menu.act { go_to_profile_settings }
Page::Main::Menu.perform(&:go_to_profile_settings)
Page::Profile::Menu.perform do |menu|
menu.click_ssh_keys
menu.wait_for_key_to_replicate(key_title)
......@@ -59,14 +59,17 @@ module QA
expect(page).to have_content(key.fingerprint)
# Ensure project has replicated
Page::Main::Menu.perform { |menu| menu.go_to_projects }
Page::Main::Menu.perform(&:go_to_projects)
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(project.name)
dashboard.go_to_project(project.name)
end
# Grab the SSH URI for the secondary and store as 'location'
location = Page::Project::Show.act { repository_clone_ssh_location }
location = Page::Project::Show.perform do |project_page|
project_page.wait_for_repository_replication
project_page.repository_clone_ssh_location
end
# Perform a git push over SSH at the secondary
push = Resource::Repository::Push.fabricate! do |push|
......@@ -103,7 +106,7 @@ module QA
Runtime::Browser.visit(:geo_primary, QA::Page::Main::Login) do
# Visit the primary node and login
Page::Main::Login.act { sign_in_using_credentials }
Page::Main::Login.perform(&:sign_in_using_credentials)
# Create a new SSH key for the user
key = Resource::SSHKey.fabricate! do |resource|
......@@ -138,7 +141,7 @@ module QA
end
# Ensure the SSH key has replicated
Page::Main::Menu.act { go_to_profile_settings }
Page::Main::Menu.perform(&:go_to_profile_settings)
Page::Profile::Menu.perform do |menu|
menu.click_ssh_keys
menu.wait_for_key_to_replicate(key_title)
......@@ -148,14 +151,17 @@ module QA
expect(page).to have_content(key.fingerprint)
# Ensure project has replicated
Page::Main::Menu.perform { |menu| menu.go_to_projects }
Page::Main::Menu.perform(&:go_to_projects)
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(project.name)
dashboard.go_to_project(project.name)
end
# Grab the SSH URI for the secondary and store as 'location'
location = Page::Project::Show.act { repository_clone_ssh_location }
location = Page::Project::Show.perform do |project_page|
project_page.wait_for_repository_replication
project_page.repository_clone_ssh_location
end
# Perform a git push over SSH at the secondary
push = Resource::Repository::Push.fabricate! do |push|
......
......@@ -85,6 +85,14 @@ module QA
found
end
def has_no_text?(text)
found = super
log(%Q{has_no_text?('#{text}') returned #{found}})
found
end
def within_element(name)
log("within element :#{name}")
......
......@@ -65,6 +65,13 @@ describe QA::Support::Page::Logging do
.to output(/has_element\? :element returned true/).to_stdout_from_any_process
end
it 'logs has_no_text?' do
allow(page).to receive(:has_no_text?).with('foo').and_return(true)
expect { subject.has_no_text? 'foo' }
.to output(/has_no_text\?\('foo'\) returned true/).to_stdout_from_any_process
end
it 'logs within_element' do
expect { subject.within_element(:element) }
.to output(/within element :element/).to_stdout_from_any_process
......
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