diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /qa/qa/specs/features/browser_ui/3_create | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) | |
download | gitlab-ce-a09983ae35713f5a2bbb100981116d31ce99826e.tar.gz |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'qa/qa/specs/features/browser_ui/3_create')
35 files changed, 333 insertions, 133 deletions
diff --git a/qa/qa/specs/features/browser_ui/3_create/gitaly/high_availability_spec.rb b/qa/qa/specs/features/browser_ui/3_create/gitaly/high_availability_spec.rb index 3bb03f68d51..97a76c1aa01 100644 --- a/qa/qa/specs/features/browser_ui/3_create/gitaly/high_availability_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/gitaly/high_availability_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do context 'Gitaly' do describe 'High Availability', :orchestrated, :gitaly_ha do let(:project) do @@ -10,15 +10,15 @@ module QA end end let(:initial_file) { 'pushed_to_primary.txt' } - let(:final_file) { 'pushed_to_secondary.txt' } + let(:final_file) { 'committed_to_primary.txt' } + let(:praefect_manager) { Service::PraefectManager.new } before do - @praefect_manager = Service::PraefectManager.new Flow::Login.sign_in end after do - @praefect_manager.reset + praefect_manager.reset_cluster end it 'makes sure that automatic failover is happening' do @@ -30,7 +30,7 @@ module QA push.file_content = "This should exist on both nodes" end - @praefect_manager.stop_primary_node + praefect_manager.trigger_failover_by_stopping_primary_node project.visit! @@ -41,11 +41,13 @@ module QA expect(show).to have_file(initial_file) end + praefect_manager.enable_writes + Resource::Repository::Commit.fabricate_via_api! do |commit| commit.project = project commit.add_files([ { - file_path: 'committed_to_primary.txt', + file_path: final_file, content: 'This should exist on both nodes too' } ]) 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 05a932fd53e..28338475cb5 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 @@ -1,23 +1,24 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do include Support::Api describe 'Jira integration', :jira, :orchestrated, :requires_admin do let(:jira_project_key) { 'JITP' } + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = "project_with_jira_integration" + end + end - before(:all) do + before do page.visit Vendor::Jira::JiraAPI.perform(&:base_url) QA::Support::Retrier.retry_until(sleep_interval: 3, reload_page: page, max_attempts: 20, raise_on_failure: true) do page.has_text? 'Welcome to Jira' end - @project = Resource::Project.fabricate_via_api! do |project| - project.name = "project_with_jira_integration" - end - # Retry is required because allow_local_requests_from_web_hooks_and_services # takes some time to get enabled. # Bug issue: https://gitlab.com/gitlab-org/gitlab/-/issues/217010 @@ -27,7 +28,7 @@ module QA page.visit Runtime::Scenario.gitlab_address Flow::Login.sign_in_unless_signed_in - @project.visit! + project.visit! Page::Project::Menu.perform(&:go_to_integrations_settings) QA::Page::Project::Settings::Integrations.perform(&:click_jira_link) @@ -67,9 +68,11 @@ module QA expect_issue_done(issue_key) end + private + def create_mr_with_description(description) Resource::MergeRequest.fabricate! do |merge_request| - merge_request.project = @project + merge_request.project = project merge_request.target_new_branch = !master_branch_exists? merge_request.description = description end @@ -80,7 +83,7 @@ module QA push.branch_name = 'master' push.commit_message = commit_message push.file_content = commit_message - push.project = @project + push.project = project push.new_branch = !master_branch_exists? end end @@ -98,7 +101,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?("master") end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb index 4a9901f2a84..a002779d7d9 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb @@ -1,29 +1,31 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Create a new merge request' do - before do - Flow::Login.sign_in - - @project = Resource::Project.fabricate_via_api! do |project| + let(:project) do + Resource::Project.fabricate_via_api! do |project| project.name = 'project' end + end + + let(:merge_request_title) { 'One merge request to rule them all' } + let(:merge_request_description) { '... to find them, to bring them all, and in the darkness bind them' } - @merge_request_title = 'One merge request to rule them all' - @merge_request_description = '... to find them, to bring them all, and in the darkness bind them' + before do + Flow::Login.sign_in end it 'creates a basic merge request' do Resource::MergeRequest.fabricate_via_browser_ui! do |merge_request| - merge_request.project = @project - merge_request.title = @merge_request_title - merge_request.description = @merge_request_description + merge_request.project = project + merge_request.title = merge_request_title + merge_request.description = merge_request_description end Page::MergeRequest::Show.perform do |merge_request| - expect(merge_request).to have_title(@merge_request_title) - expect(merge_request).to have_description(@merge_request_description) + expect(merge_request).to have_title(merge_request_title) + expect(merge_request).to have_description(merge_request_description) end end @@ -31,32 +33,29 @@ module QA gitlab_account_username = "@#{Runtime::User.username}" milestone = Resource::ProjectMilestone.fabricate_via_api! do |milestone| - milestone.project = @project + milestone.project = project end label = Resource::Label.fabricate_via_api! do |label| - label.project = @project + label.project = project label.title = 'label' end Resource::MergeRequest.fabricate_via_browser_ui! do |merge_request| - merge_request.title = @merge_request_title - merge_request.description = @merge_request_description - merge_request.project = @project + merge_request.title = merge_request_title + merge_request.description = merge_request_description + merge_request.project = project merge_request.milestone = milestone merge_request.assignee = 'me' merge_request.labels.push(label) end Page::MergeRequest::Show.perform do |merge_request| - expect(merge_request).to have_title(@merge_request_title) - expect(merge_request).to have_description(@merge_request_description) + expect(merge_request).to have_title(merge_request_title) + expect(merge_request).to have_description(merge_request_description) expect(merge_request).to have_assignee(gitlab_account_username) expect(merge_request).to have_label(label.title) - end - - Page::Issuable::Sidebar.perform do |sidebar| - expect(sidebar).to have_milestone(milestone.title) + expect(merge_request).to have_milestone(milestone.title) 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 3964ae7eada..5b89bf046fb 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 @@ -1,19 +1,16 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Merge request creation from fork' do - it 'user forks a project, submits a merge request and maintainer merges it' do - Flow::Login.sign_in - - merge_request = Resource::MergeRequestFromFork.fabricate_via_browser_ui! do |merge_request| + let(:merge_request) do + Resource::MergeRequestFromFork.fabricate_via_api! do |merge_request| merge_request.fork_branch = 'feature-branch' end + end - merge_request.project.api_put(auto_devops_enabled: false) - - Page::Main::Menu.perform(&:sign_out) - Page::Main::Login.perform(&:sign_in_using_credentials) + it 'can merge feature branch fork to mainline' do + Flow::Login.sign_in merge_request.visit! 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 4e189faec6e..a1c604bdcfc 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 @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/30226', type: :bug } do + RSpec.describe 'Create', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/30226', type: :bug } do describe 'Merge request rebasing' do it 'user rebases source branch of merge request' do Flow::Login.sign_in diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/squash_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/squash_merge_request_spec.rb index 9236609934e..cb660a3e40b 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/squash_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/squash_merge_request_spec.rb @@ -1,19 +1,23 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Merge request squashing' do - it 'user squashes commits while merging' do - Flow::Login.sign_in - - project = Resource::Project.fabricate_via_api! do |project| + let(:project) do + Resource::Project.fabricate_via_api! do |project| project.name = "squash-before-merge" end + end - merge_request = Resource::MergeRequest.fabricate! do |merge_request| + let(:merge_request) do + Resource::MergeRequest.fabricate_via_api! do |merge_request| merge_request.project = project merge_request.title = 'Squashing commits' end + end + + before do + Flow::Login.sign_in Resource::Repository::ProjectPush.fabricate! do |push| push.project = project @@ -25,7 +29,9 @@ module QA end merge_request.visit! + end + it 'user squashes commits while merging' do Page::MergeRequest::Show.perform do |merge_request_page| merge_request_page.retry_on_exception(reload: true) do expect(merge_request_page).to have_text('to be squashed') @@ -34,13 +40,9 @@ module QA merge_request_page.mark_to_squash merge_request_page.merge! - merge_request.project.visit! - Git::Repository.perform do |repository| - repository.uri = merge_request.project.repository_http_location.uri - + repository.uri = project.repository_http_location.uri repository.use_default_credentials - repository.clone expect(repository.commits.size).to eq 3 diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_diff_patch_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_diff_patch_spec.rb index 604b6c10aee..3c2c068dfd1 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_diff_patch_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_diff_patch_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Download merge request patch and diff' do before(:context) do @merge_request = Resource::MergeRequest.fabricate_via_api! do |merge_request| diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb index d5346546efe..c02632c2c60 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb @@ -1,12 +1,14 @@ # frozen_string_literal: true +require 'securerandom' + module QA - context 'Create' do + RSpec.describe 'Create' do describe 'File templates' do include Runtime::Fixtures - before(:all) do - @project = Resource::Project.fabricate_via_api! do |project| + let(:project) do + Resource::Project.fabricate_via_api! do |project| project.name = 'file-template-project' project.description = 'Add file templates via the Files view' project.initialize_with_readme = true @@ -46,7 +48,7 @@ module QA Flow::Login.sign_in - @project.visit! + project.visit! Page::Project::Show.perform(&:create_new_file!) Page::File::Form.perform do |form| @@ -54,12 +56,14 @@ module QA expect(form).to have_normalized_ws_text(content[0..100]) + form.add_name("#{SecureRandom.hex(8)}/#{template[:file_name]}") form.commit_changes - expect(form).to have_content('The file has been successfully created.') - expect(form).to have_content(template[:file_name]) - expect(form).to have_content('Add new file') - expect(form).to have_normalized_ws_text(content[0..100]) + aggregate_failures "indications of file created" do + expect(form).to have_content(template[:file_name]) + expect(form).to have_normalized_ws_text(content[0..100]) + expect(form).to have_content('Add new file') + end end end 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 bf5a9501cba..cab909756c1 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 @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Create, list, and delete branches via web' do master_branch = 'master' second_branch = 'second-branch' diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb deleted file mode 100644 index 68bbc1719fc..00000000000 --- a/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -module QA - context 'Create' do - describe 'SSH keys support' do - let(:key_title) { "key for ssh tests #{Time.now.to_f}" } - - it 'user adds and then removes an SSH key', :smoke do - Flow::Login.sign_in - - key = Resource::SSHKey.fabricate_via_browser_ui! do |resource| - resource.title = key_title - end - - expect(page).to have_content(key.title) - expect(page).to have_content(key.md5_fingerprint) - - Page::Main::Menu.perform(&:click_settings_link) - Page::Profile::Menu.perform(&:click_ssh_keys) - - Page::Profile::SSHKeys.perform do |ssh_keys| - ssh_keys.remove_key(key_title) - end - - expect(page).not_to have_content("Title: #{key_title}") - expect(page).not_to have_content(key.md5_fingerprint) - end - end - end -end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb index 0650c8395c7..c9cbc68c254 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb @@ -1,16 +1,18 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Git clone over HTTP', :ldap_no_tls do - before(:all) do - @project = Resource::Project.fabricate_via_api! do |scenario| + let(:project) do + Resource::Project.fabricate_via_api! do |scenario| scenario.name = 'project-with-code' scenario.description = 'project for git clone tests' end + end + before do Git::Repository.perform do |repository| - repository.uri = @project.repository_http_location.uri + repository.uri = project.repository_http_location.uri repository.use_default_credentials repository.act do @@ -21,12 +23,12 @@ module QA push_changes end end - @project.wait_for_push_new_branch + project.wait_for_push_new_branch end it 'user performs a deep clone' do Git::Repository.perform do |repository| - repository.uri = @project.repository_http_location.uri + repository.uri = project.repository_http_location.uri repository.use_default_credentials repository.clone @@ -37,7 +39,7 @@ module QA it 'user performs a shallow clone' do Git::Repository.perform do |repository| - repository.uri = @project.repository_http_location.uri + repository.uri = project.repository_http_location.uri repository.use_default_credentials repository.shallow_clone diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb index 51a1c19f0f7..d66f0ddcda6 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Files management' do it 'user creates, edits and deletes a file via the Web' do Runtime::Browser.visit(:gitlab, Page::Main::Login) diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/move_project_create_fork_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/move_project_create_fork_spec.rb index d0123da53bb..f586c25165c 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/move_project_create_fork_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/move_project_create_fork_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/217002', type: :investigating } do + RSpec.describe 'Create', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/217002', type: :investigating } do describe 'Gitaly repository storage', :orchestrated, :repository_storage, :requires_admin do let(:user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) } let(:parent_project) do diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_http_spec.rb index b210e747614..e3b0d7de9ec 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_http_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_http_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Push over HTTP using Git protocol version 2', :requires_git_protocol_v2 do it 'user pushes to the repository' do Flow::Login.sign_in diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_ssh_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_ssh_spec.rb index e3d5b755317..90beff343ab 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_ssh_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_ssh_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Push over SSH using Git protocol version 2', :requires_git_protocol_v2 do # Note: If you run this test against GDK make sure you've enabled sshd and # enabled setting the Git protocol by adding `AcceptEnv GIT_PROTOCOL` to diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_http_private_token_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_http_private_token_spec.rb index d8aaffc3713..c01558d3702 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_http_private_token_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_http_private_token_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Git push over HTTP', :ldap_no_tls do it 'user using a personal access token pushes code to the repository' do Flow::Login.sign_in diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb index ae95f5a7a44..254e32a88ce 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Push mirror a repository over HTTP' do it 'configures and syncs a (push) mirrored repository' do Runtime::Browser.visit(:gitlab, Page::Main::Login) diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb index 21ae10774c9..443ace0c9f0 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create', :requires_admin do + RSpec.describe 'Create', :requires_admin do describe 'push after setting the file size limit via admin/application_settings' do # Note: The file size limits in this test should be greater than the limits in # ee/browser_ui/3_create/repository/push_rules_spec to prevent that test from diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb index 6c0d55cc69a..b918b2ff268 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Git push over HTTP', :ldap_no_tls do it 'user pushes code to the repository' do Flow::Login.sign_in 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 455db4d811d..3e1e470d8c3 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 @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Protected branch support', :ldap_no_tls do let(:branch_name) { 'protected-branch' } let(:commit_message) { 'Protected push commit message' } diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/ssh_key_support_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/ssh_key_support_spec.rb new file mode 100644 index 00000000000..d67e4a4ea83 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/repository/ssh_key_support_spec.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'SSH keys support', :smoke do + key_title = "key for ssh tests #{Time.now.to_f}" + key = nil + + before do + Flow::Login.sign_in + end + + it 'user can add an SSH key' do + key = Resource::SSHKey.fabricate_via_browser_ui! do |resource| + resource.title = key_title + end + + expect(page).to have_content(key.title) + expect(page).to have_content(key.md5_fingerprint) + end + + # Note this context ensures that the example it contains is executed after the example above. Be aware of the order of execution if you add new examples in either context. + context 'after adding an ssh key' do + it 'can delete an ssh key' do + Page::Main::Menu.perform(&:click_settings_link) + Page::Profile::Menu.perform(&:click_ssh_keys) + Page::Profile::SSHKeys.perform do |ssh_keys| + ssh_keys.remove_key(key_title) + end + + expect(page).not_to have_content("Title: #{key_title}") + expect(page).not_to have_content(key.md5_fingerprint) + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/use_ssh_key_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/use_ssh_key_spec.rb index 1a3c6d03098..e91717b0f5f 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/use_ssh_key_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/use_ssh_key_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'SSH key support' do # Note: If you run this test against GDK make sure you've enabled sshd # See: https://gitlab.com/gitlab-org/gitlab-qa/blob/master/docs/run_qa_against_gdk.md diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb index aee62bacfa8..cf91b829817 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Commit data' do before(:context) do # Get the user's details to confirm they're included in the email patch diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/add_comment_to_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/add_comment_to_snippet_spec.rb new file mode 100644 index 00000000000..a867d9cb973 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/add_comment_to_snippet_spec.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Adding comments on snippets' do + let(:comment_author) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) } + let(:comment_content) { 'Comment 123' } + let(:edited_comment_content) { 'Nice snippet!' } + + let(:personal_snippet) do + Resource::Snippet.fabricate! do |snippet| + snippet.title = 'Personal snippet with a comment' + end + end + + let(:project_snippet) do + Resource::ProjectSnippet.fabricate! do |snippet| + snippet.title = 'Project snippet with a comment' + end + end + + before do + Flow::Login.sign_in + end + + shared_examples 'comments on snippets' do |snippet_type| + it "adds, edits, and deletes a comment on a #{snippet_type}" do + send(snippet_type) + + Page::Main::Menu.perform(&:sign_out) + + Flow::Login.sign_in(as: comment_author) + + send(snippet_type).visit! + + create_comment + verify_comment_content(comment_author.username, comment_content) + + edit_comment + verify_comment_content(comment_author.username, edited_comment_content) + + delete_comment + verify_comment_deleted + end + end + + it_behaves_like 'comments on snippets', :personal_snippet + it_behaves_like 'comments on snippets', :project_snippet + + def create_comment + Page::Dashboard::Snippet::Show.perform do |snippet| + snippet.add_comment(comment_content) + end + end + + def edit_comment + Page::Dashboard::Snippet::Show.perform do |snippet| + snippet.edit_comment(edited_comment_content) + end + end + + def delete_comment + Page::Dashboard::Snippet::Show.perform do |snippet| + snippet.delete_comment(edited_comment_content) + end + end + + def verify_comment_content(author, comment_content) + Page::Dashboard::Snippet::Show.perform do |comment| + expect(comment).to have_comment_author(author) + expect(comment).to have_comment_content(comment_content) + end + end + + def verify_comment_deleted + expect(page).not_to have_content(comment_author.username) + expect(page).not_to have_content(edited_comment_content) + end + end + end +end 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 341ff39fdf1..e6589851dd9 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 @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Version control for personal snippets' do let(:new_file) { 'new_snippet_file' } let(:changed_content) { 'changes' } 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 a3011550db8..1660944fccd 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 @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Version control for project snippets' do let(:new_file) { 'new_snippet_file' } let(:changed_content) { 'changes' } 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 451a7847f8b..d2b86904cd3 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 @@ -1,27 +1,30 @@ # frozen_string_literal: true module QA - context 'Create', :smoke do + RSpec.describe 'Create', :smoke do describe 'Personal snippet creation' do it 'User creates a personal snippet' do Flow::Login.sign_in - Page::Main::Menu.perform(&:go_to_snippets) + Page::Main::Menu.perform do |menu| + menu.go_to_more_dropdown_option(:snippets_link) + end Resource::Snippet.fabricate_via_browser_ui! do |snippet| snippet.title = 'Snippet title' snippet.description = 'Snippet description' snippet.visibility = 'Private' - snippet.file_name = 'New snippet file name' - snippet.file_content = 'Snippet file text' + snippet.file_name = 'ruby_file.rb' + snippet.file_content = 'File.read("test.txt").split(/\n/)' end Page::Dashboard::Snippet::Show.perform do |snippet| expect(snippet).to have_snippet_title('Snippet title') expect(snippet).to have_snippet_description('Snippet description') expect(snippet).to have_visibility_type(/private/i) - expect(snippet).to have_file_name('New snippet file name') - expect(snippet).to have_file_content('Snippet file text') + expect(snippet).to have_file_name('ruby_file.rb') + expect(snippet).to have_file_content('File.read("test.txt").split(/\n/)') + expect(snippet).to have_syntax_highlighting('ruby') end end end 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 8fc4427bda7..05795e9b51e 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 @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do # to be converted to a smoke test once proved to be stable + 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' do Flow::Login.sign_in diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/add_file_template_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/add_file_template_spec.rb index 7c9db5ee496..1e3cb0e2ffc 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/add_file_template_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/add_file_template_spec.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true +require 'securerandom' + module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Web IDE file templates' do include Runtime::Fixtures @@ -53,10 +55,11 @@ module QA ide.create_new_file_from_template template[:file_name], template[:name] expect(ide.has_file?(template[:file_name])).to be_truthy - expect(ide).to have_button('Undo') expect(ide).to have_normalized_ws_text(content[0..100]) + ide.rename_file(template[:file_name], "#{SecureRandom.hex(8)}/#{template[:file_name]}") + ide.commit_changes expect(ide).to have_content(template[:file_name]) diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/create_first_file_in_web_ide_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/create_first_file_in_web_ide_spec.rb index 3bf6e156967..fbf70153e1d 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/create_first_file_in_web_ide_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/create_first_file_in_web_ide_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'First file using Web IDE' do let(:project) do Resource::Project.fabricate_via_api! do |project| diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb index ed988bdf046..7e0d8822101 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do describe 'Review a merge request in Web IDE' do let(:new_file) { 'awesome_new_file.txt' } let(:original_text) { 'Text' } diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_creation_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_creation_spec.rb index 1d0c8ee60d4..77a5998362c 100644 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_creation_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_creation_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do context 'Wiki' do describe 'testing wiki content creation inside a project' do let(:new_wiki_title) { "just_another_wiki_page" } diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_manipulation_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_manipulation_spec.rb index 10370c80476..dbc7798a594 100644 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_manipulation_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_manipulation_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Create' do + RSpec.describe 'Create' do context 'Wiki' do describe 'testing wiki content manipulation inside a project' do let(:new_wiki_title) { "just_another_wiki_page" } diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_list_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_list_spec.rb new file mode 100644 index 00000000000..d7f59abc361 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_list_spec.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + context 'Wiki' do + let(:small_number_of_pages) { 5 } + let(:large_number_of_pages) { 15 } + let(:random_page) { "bulk_#{rand(0..4)}" } + + let(:small_wiki) { create_wiki_pages small_number_of_pages } + let(:large_wiki) { create_wiki_pages large_number_of_pages } + + before do + Flow::Login.sign_in + end + + context 'Sidebar' do + it 'has all expected links that work' do + small_wiki.visit! + + small_number_of_pages.times do |index| + Page::Project::Wiki::Show.perform do |list| + expect(list).to have_page_listed "bulk_#{index}" + end + end + + Page::Project::Wiki::Show.perform do |list| + list.click_page_link random_page + end + + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_title random_page + end + end + end + + context 'Page List' do + it 'has all expected links that work' do + large_wiki.visit! + + Page::Project::Wiki::Show.perform(&:click_view_all_pages) + + large_number_of_pages.times do |index| + Page::Project::Wiki::List.perform do |list| + expect(list).to have_page_listed "bulk_#{index}" + end + end + + Page::Project::Wiki::List.perform do |list| + list.click_page_link random_page + end + + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_title random_page + end + end + end + + private + + def create_wiki_pages(no_of_pages) + wiki = Resource::Wiki::ProjectPage.fabricate_via_api! + no_of_pages.times do |index| + Resource::Wiki::ProjectPage.fabricate_via_api! do |page| + page.title = "bulk_#{index}" + page.project = wiki.project + end + end + wiki + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_page_deletion_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_page_deletion_spec.rb new file mode 100644 index 00000000000..923c7332748 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_page_deletion_spec.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + context 'Wiki' do + let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } + + before do + Flow::Login.sign_in + end + + context 'Page deletion' do + it 'has removed the deleted page correctly' do + initial_wiki.visit! + + Page::Project::Wiki::Show.perform(&:click_edit) + Page::Project::Wiki::Edit.perform(&:delete_page) + + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_no_page + end + end + end + end + end +end |