Commit 1679d31f authored by Andrejs Cunskis's avatar Andrejs Cunskis Committed by Dan Davison

Additional validations for github import e2e spec

parent 2621790e
......@@ -72,7 +72,7 @@ module QA
# TODO: set reload:false and remove skip_finished_loading_check_on_refresh when
# https://gitlab.com/gitlab-org/gitlab/-/issues/292861 is fixed
wait_until(
max_duration: 60,
max_duration: 90,
sleep_interval: 5.0,
reload: true,
skip_finished_loading_check_on_refresh: true
......
......@@ -131,6 +131,18 @@ module QA
"/projects/#{id}"
end
def api_put_path
"/projects/#{id}"
end
def api_post_path
'/projects'
end
def api_delete_path
"/projects/#{id}"
end
def api_get_archive_path(type = 'tar.gz')
"#{api_get_path}/repository/archive.#{type}"
end
......@@ -183,12 +195,16 @@ module QA
"#{api_get_path}/issues"
end
def api_put_path
"/projects/#{id}"
def api_labels_path
"#{api_get_path}/labels"
end
def api_post_path
'/projects'
def api_milestones_path
"#{api_get_path}/milestones"
end
def api_wikis_path
"#{api_get_path}/wikis"
end
def api_post_body
......@@ -211,10 +227,6 @@ module QA
post_body
end
def api_delete_path
"/projects/#{id}"
end
def change_repository_storage(new_storage)
put_body = { repository_storage: new_storage }
response = put(request_url(api_put_path), put_body)
......@@ -236,11 +248,6 @@ module QA
)
end
def commits
response = get(request_url(api_commits_path))
parse_body(response)
end
def default_branch
reload!.api_response[:default_branch] || Runtime::Env.default_branch
end
......@@ -259,6 +266,11 @@ module QA
result[:import_status]
end
def commits
response = get(request_url(api_commits_path))
parse_body(response)
end
def merge_requests
response = get(request_url(api_merge_requests_path))
parse_body(response)
......@@ -269,11 +281,8 @@ module QA
end
def runners(tag_list: nil)
response = if tag_list
get(request_url("#{api_runners_path}?tag_list=#{tag_list.compact.join(',')}", per_page: '100'))
else
get(request_url(api_runners_path, per_page: '100'))
end
url = tag_list ? "#{api_runners_path}?tag_list=#{tag_list.compact.join(',')}" : api_runners_path
response = get(request_url(url, per_page: '100'))
parse_body(response)
end
......@@ -318,6 +327,21 @@ module QA
parse_body(response)
end
def labels
response = get(request_url(api_labels_path))
parse_body(response)
end
def milestones
response = get(request_url(api_milestones_path))
parse_body(response)
end
def wikis
response = get(request_url(api_wikis_path))
parse_body(response)
end
private
def transform_api_resource(api_resource)
......
......@@ -37,7 +37,11 @@ module QA
aggregate_failures do
verify_repository_import
verify_commits_import
verify_labels_import
verify_issues_import
verify_milestones_import
verify_wikis_import
verify_merge_requests_import
end
end
......@@ -50,6 +54,29 @@ module QA
)
end
def verify_commits_import
expect(imported_project.commits.length).to eq(20)
end
def verify_labels_import
labels = imported_project.labels.map { |label| label.slice(:name, :color) }
expect(labels).to eq(
[
{ name: 'bug', color: '#d73a4a' },
{ name: 'custom new label', color: '#fc8f91' },
{ name: 'documentation', color: '#0075ca' },
{ name: 'duplicate', color: '#cfd3d7' },
{ name: 'enhancement', color: '#a2eeef' },
{ name: 'good first issue', color: '#7057ff' },
{ name: 'help wanted', color: '#008672' },
{ name: 'invalid', color: '#e4e669' },
{ name: 'question', color: '#d876e3' },
{ name: 'wontfix', color: '#ffffff' }
]
)
end
def verify_issues_import
issues = imported_project.issues
......@@ -62,6 +89,20 @@ module QA
)
end
def verify_milestones_import
milestones = imported_project.milestones
expect(milestones.length).to eq(1)
expect(milestones.first).to include(title: 'v1.0', description: nil, state: 'active')
end
def verify_wikis_import
wikis = imported_project.wikis
expect(wikis.length).to eq(1)
expect(wikis.first).to include(title: 'Home', format: 'markdown')
end
def verify_merge_requests_import
merge_requests = imported_project.merge_requests
......
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