Commit dbe50cdb authored by Jennifer Louie's avatar Jennifer Louie Committed by Sanad Liaquat

Refactor Geo end-to-end specs

parent 9e26d989
......@@ -78,6 +78,17 @@ module QA
def weight_no_value_content
find_element(:weight_no_value_content)
end
def wait_for_attachment_replication(image_url, max_wait: Runtime::Geo.max_file_replication_time)
QA::Runtime::Logger.debug(%Q[#{self.class.name} - wait_for_attachment_replication])
wait_until_geo_max_replication_time(max_wait: max_wait) do
asset_exists?(image_url)
end
end
def wait_until_geo_max_replication_time(max_wait: Runtime::Geo.max_file_replication_time)
wait_until(max_duration: max_wait) { yield }
end
end
end
end
......
......@@ -7,12 +7,12 @@ module QA
it 'user uploads attachment to the primary node' do
QA::Flow::Login.while_signed_in(address: :geo_primary) do
@project = Resource::Project.fabricate! do |project|
@project = Resource::Project.fabricate_via_api! do |project|
project.name = 'project-for-issues'
project.description = 'project for adding issues'
end
@issue = Resource::Issue.fabricate! do |issue|
@issue = Resource::Issue.fabricate_via_api! do |issue|
issue.title = 'My geo issue'
issue.project = @project
end
......@@ -52,10 +52,7 @@ module QA
image_url = find('a[href$="banana_sample.gif"]')[:href]
Page::Project::Issue::Show.perform do |show|
# Wait for attachment replication
found = show.wait_until(reload: false) do
show.asset_exists?(image_url)
end
found = show.wait_for_attachment_replication(image_url)
expect(found).to be_truthy
end
......
......@@ -12,7 +12,7 @@ module QA
QA::Flow::Login.while_signed_in(address: :geo_primary) do
# Create a new Project
project = Resource::Project.fabricate! do |project|
project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
......@@ -66,7 +66,7 @@ module QA
project = nil
QA::Flow::Login.while_signed_in(address: :geo_primary) do
project = Resource::Project.fabricate! do |project|
project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
......
......@@ -15,7 +15,7 @@ module QA
QA::Flow::Login.while_signed_in(address: :geo_primary) do
# Create a new Project
project = Resource::Project.fabricate! do |project|
project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
......@@ -96,7 +96,7 @@ module QA
QA::Flow::Login.while_signed_in(address: :geo_primary) do
# Create a new Project
project = Resource::Project.fabricate! do |project|
project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
......
......@@ -4,21 +4,24 @@ module QA
context 'Geo', :orchestrated, :geo do
describe 'GitLab Geo project rename replication' do
it 'user renames project' do
original_project_name = 'geo-before-rename'
original_readme_content = "The original project name was #{original_project_name}"
readme_file_name = 'README.md'
# create the project and push code
QA::Flow::Login.while_signed_in(address: :geo_primary) do
project = Resource::Project.fabricate! do |project|
project.name = 'geo-before-rename'
project = Resource::Project.fabricate_via_api! do |project|
project.name = original_project_name
project.description = 'Geo project to be renamed'
end
geo_project_name = project.name
expect(project.name).to include 'geo-before-rename'
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.file_name = 'README.md'
push.file_content = '# This is Geo project!'
push.commit_message = 'Add README.md'
push.file_name = readme_file_name
push.file_content = original_readme_content
push.commit_message = "Add #{readme_file_name}"
end
# rename the project
......@@ -62,8 +65,8 @@ module QA
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!'
expect(page).to have_content readme_file_name
expect(page).to have_content original_readme_content
end
end
end
......
......@@ -19,7 +19,7 @@ module QA
end
# Create a new Project
project = Resource::Project.fabricate! do |project|
project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
......@@ -88,7 +88,7 @@ module QA
end
# Create a new Project
project = Resource::Project.fabricate! do |project|
project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
......
......@@ -20,7 +20,7 @@ module QA
end
# Create a new Project
project = Resource::Project.fabricate! do |project|
project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
......@@ -110,7 +110,7 @@ module QA
end
# Create a new Project
project = Resource::Project.fabricate! do |project|
project = Resource::Project.fabricate_via_api! do |project|
project.name = 'geo-project'
project.description = 'Geo test project'
end
......
......@@ -12,7 +12,7 @@ module QA
# Create new wiki and push wiki commit
QA::Flow::Login.while_signed_in(address: :geo_primary) do
project = Resource::Project.fabricate! do |project|
project = Resource::Project.fabricate_via_api! do |project|
project.name = project_name
project.description = 'Geo project for wiki repo test'
end
......
......@@ -20,7 +20,7 @@ module QA
end
# Create a new project and wiki
project = Resource::Project.fabricate! do |project|
project = Resource::Project.fabricate_via_api! do |project|
project.name = project_name
project.description = 'Geo project for wiki ssh spec'
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