summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb')
-rw-r--r--qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb85
1 files changed, 46 insertions, 39 deletions
diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb
index 83dfb2d9639..d54ce0ac0fc 100644
--- a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb
+++ b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb
@@ -1,30 +1,35 @@
# frozen_string_literal: true
module QA
- RSpec.describe 'Manage', :github, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/issues/26952', type: :bug } do
- describe 'Project import from GitHub' do
+ RSpec.describe 'Manage', :github, :requires_admin do
+ describe 'Project import' do
+ let!(:user) do
+ Resource::User.fabricate_via_api! do |resource|
+ resource.api_client = Runtime::API::Client.as_admin
+ end
+ end
+
+ let(:group) { Resource::Group.fabricate_via_api! }
+
let(:imported_project) do
- Resource::ProjectImportedFromGithub.fabricate! do |project|
+ Resource::ProjectImportedFromGithub.fabricate_via_browser_ui! do |project|
project.name = 'imported-project'
- project.personal_access_token = Runtime::Env.github_access_token
- project.github_repository_path = 'gitlab-qa/test-project'
+ project.group = group
+ project.github_personal_access_token = Runtime::Env.github_access_token
+ project.github_repository_path = 'gitlab-qa-github/test-project'
end
end
- after do
- # We need to delete the imported project because it's impossible to import
- # the same GitHub project twice for a given user.
- api_client = Runtime::API::Client.new(:gitlab)
- delete_project_request = Runtime::API::Request.new(api_client, "/projects/#{CGI.escape("#{Runtime::Namespace.path}/#{imported_project.name}")}")
- delete delete_project_request.url
-
- expect_status(202)
+ before do
+ group.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
+ end
- Page::Main::Menu.perform(&:sign_out_if_signed_in)
+ after do
+ user.remove_via_api!
end
- it 'user imports a GitHub repo', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/385' do
- Flow::Login.sign_in
+ it 'imports a GitHub repo', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/385' do
+ Flow::Login.sign_in(as: user)
imported_project # import the project
@@ -44,25 +49,28 @@ module QA
end
def verify_repository_import
- expect(page).to have_content('This test project is used for automated GitHub import by GitLab QA.')
- expect(page).to have_content(imported_project.name)
+ Page::Project::Show.perform do |project|
+ expect(project).to have_content('This test project is used for automated GitHub import by GitLab QA.')
+ expect(project).to have_content(imported_project.name)
+ end
end
def verify_issues_import
QA::Support::Retrier.retry_on_exception do
Page::Project::Menu.perform(&:click_issues)
- expect(page).to have_content('This is a sample issue')
- click_link 'This is a sample issue'
+ Page::Project::Issue::Show.perform do |issue_page|
+ expect(issue_page).to have_content('This is a sample issue')
- expect(page).to have_content('We should populate this project with issues, pull requests and wiki pages.')
+ click_link 'This is a sample issue'
- # Comments
- comment_text = 'This is a comment from @rymai.'
+ expect(issue_page).to have_content('This is a sample first comment')
+
+ # Comments
+ comment_text = 'This is a comment from @sliaquat'
- Page::Project::Issue::Show.perform do |issue_page|
expect(issue_page).to have_comment(comment_text)
- expect(issue_page).to have_label('enhancement')
+ expect(issue_page).to have_label('custom new label')
expect(issue_page).to have_label('help wanted')
expect(issue_page).to have_label('good first issue')
end
@@ -71,26 +79,23 @@ module QA
def verify_merge_requests_import
Page::Project::Menu.perform(&:click_merge_requests)
- expect(page).to have_content('Improve README.md')
- click_link 'Improve README.md'
+ Page::MergeRequest::Show.perform do |merge_request|
+ expect(merge_request).to have_content('Improve readme')
- expect(page).to have_content('This improves the README file a bit.')
+ click_link 'Improve readme'
- # Review comment are not supported yet
- expect(page).not_to have_content('Really nice change.')
+ expect(merge_request).to have_content('This improves the README file a bit.')
- # Comments
- expect(page).to have_content('Nice work! This is a comment from @rymai.')
+ # Comments
+ expect(merge_request).to have_content('[PR comment by @sliaquat] Nice work!')
- # Diff comments
- expect(page).to have_content('[Review comment] I like that!')
- expect(page).to have_content('[Review comment] Nice blank line.')
- expect(page).to have_content('[Single diff comment] Much better without this line!')
+ # Diff comments
+ expect(merge_request).to have_content('[Single diff comment] Good riddance')
+ expect(merge_request).to have_content('[Single diff comment] Nice addition')
- Page::MergeRequest::Show.perform do |merge_request|
expect(merge_request).to have_label('bug')
- expect(merge_request).to have_label('enhancement')
+ expect(merge_request).to have_label('documentation')
end
end
@@ -107,7 +112,9 @@ module QA
def verify_wiki_import
Page::Project::Menu.perform(&:click_wiki)
- expect(page).to have_content('Welcome to the test-project wiki!')
+ Page::Project::Wiki::Show.perform do |wiki|
+ expect(wiki).to have_content('Welcome to the test-project wiki!')
+ end
end
end
end