diff options
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.rb | 42 |
1 files changed, 32 insertions, 10 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 4f85fa257a2..c55ecb28361 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 @@ -3,9 +3,11 @@ module QA RSpec.describe 'Manage', :github, :requires_admin do describe 'Project import' do - let!(:api_client) { Runtime::API::Client.as_admin } - let!(:group) { Resource::Group.fabricate_via_api! { |resource| resource.api_client = api_client } } - let!(:user) do + let(:github_repo) { 'gitlab-qa-github/test-project' } + let(:imported_project_name) { 'imported-project' } + let(:api_client) { Runtime::API::Client.as_admin } + let(:group) { Resource::Group.fabricate_via_api! { |resource| resource.api_client = api_client } } + let(:user) do Resource::User.fabricate_via_api! do |resource| resource.api_client = api_client resource.hard_delete_on_api_removal = true @@ -13,16 +15,25 @@ module QA end let(:imported_project) do - Resource::ProjectImportedFromGithub.fabricate_via_browser_ui! do |project| - project.name = 'imported-project' + Resource::ProjectImportedFromGithub.init do |project| + project.import = true + project.add_name_uuid = false + project.name = imported_project_name project.group = group project.github_personal_access_token = Runtime::Env.github_access_token - project.github_repository_path = 'gitlab-qa-github/test-project' + project.github_repository_path = github_repo end end before do group.add_member(user, Resource::Members::AccessLevel::MAINTAINER) + + Flow::Login.sign_in(as: user) + Page::Main::Menu.perform(&:go_to_create_project) + Page::Project::New.perform do |project_page| + project_page.click_import_project + project_page.click_github_link + end end after do @@ -30,13 +41,24 @@ module QA end it 'imports a GitHub repo', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1762' do - Flow::Login.sign_in(as: user) + Page::Project::Import::Github.perform do |import_page| + import_page.add_personal_access_token(Runtime::Env.github_access_token) + import_page.import!(github_repo, group.full_path, imported_project_name) - imported_project # import the project + aggregate_failures do + expect(import_page).to have_imported_project(github_repo) + # validate button is present instead of navigating to avoid dealing with multiple tabs + # which makes the test more complicated + expect(import_page).to have_go_to_project_button(github_repo) + end + end + imported_project.reload!.visit! Page::Project::Show.perform do |project| - expect(project).to have_content(imported_project.name) - expect(project).to have_content('This test project is used for automated GitHub import by GitLab QA.') + aggregate_failures do + expect(project).to have_content(imported_project_name) + expect(project).to have_content('This test project is used for automated GitHub import by GitLab QA.') + end end end end |