Commit 9b6d93fe authored by Michael Kozono's avatar Michael Kozono

Fix wait strategies for slow replication

parent ebc5615a
......@@ -4,6 +4,10 @@ module QA
#
module EE
module Page
module Dashboard
autoload :Projects, 'qa/ee/page/dashboard/projects'
end
module Main
autoload :Banner, 'qa/ee/page/main/banner'
end
......@@ -24,6 +28,8 @@ module QA
end
module Project
autoload :Show, 'qa/ee/page/project/show'
module Settings
autoload :ProtectedBranches, 'qa/ee/page/project/settings/protected_branches'
end
......
module QA
module EE
module Page
module Dashboard
module Projects
def wait_for_project_replication(project_name)
wait(max: 180) do
filter_by_name(project_name)
page.has_content?(project_name)
end
end
end
end
end
end
end
module QA
module EE
module Page
module Project
module Show
def wait_for_repository_replication
wait(max: 180) do
!page.has_content?('The repository for this project is empty')
end
end
end
end
end
end
end
......@@ -2,6 +2,8 @@ module QA
module Page
module Dashboard
class Projects < Page::Base
prepend QA::EE::Page::Dashboard::Projects
view 'app/views/dashboard/projects/index.html.haml'
view 'app/views/shared/projects/_search_form.html.haml' do
element :form_filter_by_name, /form_tag.+id: 'project-filter-form'/
......
......@@ -2,6 +2,8 @@ module QA
module Page
module Project
class Show < Page::Base
prepend QA::EE::Page::Project::Show
include Page::Shared::ClonePanel
view 'app/views/projects/_last_push.html.haml' do
......
......@@ -36,12 +36,20 @@ module QA
end
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(project.name)
dashboard.go_to_project(project.name)
end
Page::Menu::Side.act { click_issues }
Page::Project::Issue::Index.perform do |index|
# wait for DB replication of issue
index.wait do
# we may want to filter by title here if the project is reused by other specs
page.has_content?(issue.title)
end
index.go_to_issue(issue.title)
end
......
......@@ -36,8 +36,6 @@ module QA
end
end
sleep 2 # wait for replication
# check renamed project exist on secondary node
Runtime::Browser.visit(:geo_secondary, QA::Page::Main::Login) do
Page::Main::OAuth.act do
......@@ -50,15 +48,17 @@ module QA
Page::Menu::Main.perform do |menu|
menu.go_to_projects
expect(page).to have_content(geo_project_renamed)
end
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(geo_project_renamed)
dashboard.go_to_project(geo_project_renamed)
end
Page::Project::Show.perform do
Page::Project::Show.perform do |show|
show.wait_for_repository_replication
expect(page).to have_content 'README.md'
expect(page).to have_content 'This is Geo project!'
end
......
......@@ -30,17 +30,17 @@ module QA
Page::Menu::Main.perform do |menu|
menu.go_to_projects
expect(page).to have_content(geo_project_name)
end
sleep 10 # wait for repository replication
Page::Dashboard::Projects.perform do |dashboard|
dashboard.wait_for_project_replication(geo_project_name)
dashboard.go_to_project(geo_project_name)
end
Page::Project::Show.perform do
Page::Project::Show.perform do |show|
show.wait_for_repository_replication
expect(page).to have_content 'README.md'
expect(page).to have_content 'This is Geo project!'
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