diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /qa/qa/specs/features/browser_ui/3_create | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) | |
download | gitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'qa/qa/specs/features/browser_ui/3_create')
13 files changed, 190 insertions, 32 deletions
diff --git a/qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb b/qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb new file mode 100644 index 00000000000..0fec7bc9e9d --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb @@ -0,0 +1,155 @@ +# frozen_string_literal: true +require 'securerandom' + +module QA + RSpec.describe 'Create', :requires_admin, :skip_live_env, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/195179', type: :flaky } do + describe 'Jenkins integration' do + let(:project_name) { "project_with_jenkins_#{SecureRandom.hex(4)}" } + + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = project_name + project.initialize_with_readme = true + project.auto_devops_enabled = false + end + end + + before do + jenkins_server = run_jenkins_server + + Vendor::Jenkins::Page::Base.host = jenkins_server.host_address + + Runtime::Env.personal_access_token ||= fabricate_personal_access_token + + allow_requests_to_local_networks + + setup_jenkins + end + + it 'integrates and displays build status for MR pipeline in GitLab', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/719' do + login_to_gitlab + + setup_project_integration_with_jenkins + + expect(page).to have_text("Jenkins CI activated.") + + QA::Support::Retrier.retry_on_exception do + Resource::Repository::ProjectPush.fabricate! do |push| + push.project = project + push.new_branch = false + push.file_name = "file_#{SecureRandom.hex(4)}.txt" + end + + Vendor::Jenkins::Page::LastJobConsole.perform do |job_console| + job_console.job_name = project_name + + job_console.visit! + + Support::Waiter.wait_until(sleep_interval: 2, reload_page: page) do + job_console.has_successful_build? && job_console.no_failed_status_update? + end + end + + project.visit! + + Flow::Pipeline.visit_latest_pipeline + + Page::Project::Pipeline::Show.perform do |show| + expect(show).to have_build('jenkins', status: :success, wait: 15) + end + end + end + + after do + remove_jenkins_server + end + + def setup_jenkins + Vendor::Jenkins::Page::Login.perform do |login_page| + login_page.visit! + login_page.login + end + + token_description = "token-#{SecureRandom.hex(8)}" + + Vendor::Jenkins::Page::NewCredentials.perform do |new_credentials| + new_credentials.visit_and_set_gitlab_api_token(Runtime::Env.personal_access_token, token_description) + end + + Vendor::Jenkins::Page::Configure.perform do |configure| + configure.visit_and_setup_gitlab_connection(patch_host_name(Runtime::Scenario.gitlab_address, 'gitlab'), token_description) do + configure.click_test_connection + expect(configure).to have_success + end + end + + Vendor::Jenkins::Page::NewJob.perform do |new_job| + new_job.visit_and_create_new_job_with_name(project_name) + end + + Vendor::Jenkins::Page::ConfigureJob.perform do |configure_job| + configure_job.job_name = project_name + configure_job.configure(scm_url: patch_host_name(project.repository_http_location.git_uri, 'gitlab')) + end + end + + def run_jenkins_server + Service::DockerRun::Jenkins.new.tap do |runner| + runner.pull + runner.register! + end + end + + def remove_jenkins_server + Service::DockerRun::Jenkins.new.remove! + end + + def fabricate_personal_access_token + login_to_gitlab + + token = Resource::PersonalAccessToken.fabricate!.access_token + Page::Main::Menu.perform(&:sign_out) + token + end + + def login_to_gitlab + Flow::Login.sign_in + end + + def patch_host_name(host_name, container_name) + return host_name unless host_name.include?('localhost') + + ip_address = `docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' #{container_name}`.strip + host_name.gsub('localhost', ip_address) + end + + def setup_project_integration_with_jenkins + project.visit! + + Page::Project::Menu.perform(&:click_project) + Page::Project::Menu.perform(&:go_to_integrations_settings) + Page::Project::Settings::Integrations.perform(&:click_jenkins_ci_link) + + QA::Page::Project::Settings::Services::Jenkins.perform do |jenkins| + jenkins.setup_service_with(jenkins_url: patch_host_name(Vendor::Jenkins::Page::Base.host, 'jenkins-server'), + project_name: project_name) + end + end + + def allow_requests_to_local_networks + Page::Main::Menu.perform(&:sign_out_if_signed_in) + Flow::Login.sign_in_as_admin + Page::Main::Menu.perform(&:go_to_admin_area) + Page::Admin::Menu.perform(&:go_to_network_settings) + + Page::Admin::Settings::Network.perform do |network| + network.expand_outbound_requests do |outbound_requests| + outbound_requests.allow_requests_to_local_network_from_services + end + end + + Page::Main::Menu.perform(&:sign_out) + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb b/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb index 37ddd1425a8..d53e7fcf69a 100644 --- a/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb @@ -80,7 +80,6 @@ module QA def push_commit(commit_message) Resource::Repository::ProjectPush.fabricate! do |push| - push.branch_name = 'master' push.commit_message = commit_message push.file_content = commit_message push.project = project @@ -101,7 +100,7 @@ module QA end def master_branch_exists? - project.repository_branches.map { |item| item[:name] }.include?("master") + project.repository_branches.map { |item| item[:name] }.include?(project.default_branch) end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb index b58e820a6c9..d2ba97400e6 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb @@ -2,21 +2,23 @@ module QA RSpec.describe 'Create' do - describe 'Merge request creation from fork' do - let(:merge_request) do - Resource::MergeRequestFromFork.fabricate_via_api! do |merge_request| + describe 'Merge request creation from fork', :smoke do + let!(:merge_request) do + Resource::MergeRequestFromFork.fabricate_via_browser_ui! do |merge_request| merge_request.fork_branch = 'feature-branch' end end it 'can merge feature branch fork to mainline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/928' do - Flow::Login.sign_in + Flow::Login.while_signed_in do + merge_request.visit! - merge_request.visit! + Page::MergeRequest::Show.perform do |merge_request| + merge_request.merge! - Page::MergeRequest::Show.perform(&:merge!) - - expect(page).to have_content('The changes were merged') + expect(merge_request).to have_content('The changes were merged') + end + end end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb index 02fbb0bbbd7..823a033ab6d 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb @@ -27,7 +27,6 @@ module QA push.project = project push.file_name = "other.txt" push.file_content = "New file added!" - push.branch_name = "master" push.new_branch = false end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_merge_ref_diff_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_merge_ref_diff_spec.rb index 970615e8b90..24b92164060 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_merge_ref_diff_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_merge_ref_diff_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create', :requires_admin do + RSpec.describe 'Create', :requires_admin, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/261793', type: :investigating } do describe 'View merge request merge-ref diff' do let(:project) do Resource::Project.fabricate_via_api! do |project| @@ -37,8 +37,8 @@ module QA mr_page.click_diffs_tab mr_page.click_target_version_dropdown - expect(mr_page.version_dropdown_content).to include('master (HEAD)') - expect(mr_page.version_dropdown_content).not_to include('master (base)') + expect(mr_page.version_dropdown_content).to include("#{project.default_branch} (HEAD)") + expect(mr_page.version_dropdown_content).not_to include("#{project.default_branch} (base)") expect(mr_page).to have_file(merge_request.file_name) expect(mr_page).not_to have_file(new_file_name) end @@ -62,8 +62,8 @@ module QA mr_page.click_diffs_tab mr_page.click_target_version_dropdown - expect(mr_page.version_dropdown_content).to include('master (HEAD)') - expect(mr_page.version_dropdown_content).to include('master (base)') + expect(mr_page.version_dropdown_content).to include("#{project.default_branch} (HEAD)") + expect(mr_page.version_dropdown_content).to include("#{project.default_branch} (base)") expect(mr_page).to have_file(merge_request.file_name) expect(mr_page).to have_file(new_file_name) end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb index 98cbc5c0a93..8df68e0f53b 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Create' do describe 'Create, list, and delete branches via web' do - master_branch = 'master' + master_branch = nil second_branch = 'second-branch' third_branch = 'third-branch' file_1_master = 'file.txt' @@ -21,12 +21,16 @@ module QA project = Resource::Project.fabricate_via_api! do |proj| proj.name = 'project-qa-test' proj.description = 'project for qa test' + proj.initialize_with_readme = true end + master_branch = project.default_branch + Git::Repository.perform do |repository| repository.uri = project.repository_http_location.uri repository.use_default_credentials repository.try_add_credentials_to_netrc + repository.default_branch = master_branch repository.act do clone diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb index 54d00209cc7..2b249f779d9 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb @@ -40,7 +40,7 @@ module QA end def create_protected_branch(allowed_to_push:) - Resource::ProtectedBranch.fabricate! do |resource| + Resource::ProtectedBranch.fabricate_via_api! do |resource| resource.branch_name = branch_name resource.project = project resource.allowed_to_push = allowed_to_push diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb index efd61a2e63a..a21c5d58aad 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb @@ -7,7 +7,6 @@ module QA let(:changed_content) { 'changes' } let(:commit_message) { 'Changes to snippets' } let(:added_content) { 'updated ' } - let(:branch_name) { 'master' } let(:snippet) do Resource::Snippet.fabricate! do |snippet| @@ -41,7 +40,7 @@ module QA end it 'clones, pushes, and pulls a snippet over HTTP, edits via UI', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/826' do - Resource::Repository::Push.fabricate! do |push| + push = Resource::Repository::Push.fabricate! do |push| push.repository_http_uri = repository_uri_http push.file_name = new_file push.file_content = changed_content @@ -61,7 +60,7 @@ module QA Git::Repository.perform do |repository| repository.init_repository - repository.pull(repository_uri_http, branch_name) + repository.pull(repository_uri_http, push.branch_name) expect(repository.commits.size).to eq(3) expect(repository.commits.first).to include('Update snippet') @@ -70,7 +69,7 @@ module QA end it 'clones, pushes, and pulls a snippet over SSH, deletes via UI', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/825' do - Resource::Repository::Push.fabricate! do |push| + push = Resource::Repository::Push.fabricate! do |push| push.repository_ssh_uri = repository_uri_ssh push.ssh_key = ssh_key push.file_name = new_file @@ -90,7 +89,7 @@ module QA repository.use_ssh_key(ssh_key) repository.init_repository - expect { repository.pull(repository_uri_ssh, branch_name) } + expect { repository.pull(repository_uri_ssh, push.branch_name) } .to raise_error(QA::Support::Run::CommandError, /fatal: Could not read from remote repository\./) end end diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb index 79e2677da66..4ce6c3fdcd3 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb @@ -7,7 +7,7 @@ module QA let(:changed_content) { 'changes' } let(:commit_message) { 'Changes to snippets' } let(:added_content) { 'updated ' } - let(:branch_name) { 'master' } + let(:branch_name) { snippet.project.default_branch } let(:snippet) do Resource::ProjectSnippet.fabricate! do |snippet| diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb index 8445fdafdd4..b74f27389a0 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Create', :smoke do describe 'Personal snippet creation' do - it 'User creates a personal snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/840' do + it 'user creates a personal snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/840' do Flow::Login.sign_in Page::Main::Menu.perform do |menu| diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb index d80fc4c5b95..8c44cd6d642 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Create' do # to be converted to a smoke test once proved to be stable describe 'Project snippet creation' do - it 'User creates a project snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/839' do + it 'user creates a project snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/839' do Flow::Login.sign_in Resource::ProjectSnippet.fabricate_via_browser_ui! do |snippet| @@ -16,13 +16,13 @@ module QA Page::Dashboard::Snippet::Show.perform do |snippet| expect(snippet).to have_snippet_title('Project snippet') - expect(snippet).to have_no_snippet_description + expect(snippet).not_to have_snippet_description expect(snippet).to have_visibility_type(/private/i) expect(snippet).to have_file_name('markdown_file.md') expect(snippet).to have_file_content('Snippet heading') expect(snippet).to have_file_content('Gitlab link') - expect(snippet).to have_no_file_content('###') - expect(snippet).to have_no_file_content('https://gitlab.com/') + expect(snippet).not_to have_file_content('###') + expect(snippet).not_to have_file_content('https://gitlab.com/') end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb index ca6ea5db65d..8002e95cf0d 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb @@ -46,8 +46,8 @@ module QA aggregate_failures 'file names and contents' do expect(snippet).to have_file_name('Original file name') expect(snippet).to have_file_content('Original file content') - expect(snippet).to have_no_file_name('Second file name') - expect(snippet).to have_no_file_content('Second file content') + expect(snippet).not_to have_file_name('Second file name') + expect(snippet).not_to have_file_content('Second file content') end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb index e2fa487c937..dad5ad74a4c 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Create' do - describe 'Open a fork in Web IDE' do + describe 'Open a fork in Web IDE', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/284081', type: :investigating } do let(:parent_project) do Resource::Project.fabricate_via_api! do |project| project.name = 'parent-project' |