diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /qa/qa/specs/features/browser_ui/3_create | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) | |
download | gitlab-ce-7e9c479f7de77702622631cff2628a9c8dcbc627.tar.gz |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'qa/qa/specs/features/browser_ui/3_create')
12 files changed, 246 insertions, 77 deletions
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 7844d0d7ccb..970615e8b90 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 @@ -3,8 +3,15 @@ module QA RSpec.describe 'Create', :requires_admin do describe 'View merge request merge-ref diff' do + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'merge-ref-diff' + end + end + let(:merge_request) do Resource::MergeRequest.fabricate_via_api! do |merge_request| + merge_request.project = project merge_request.title = 'This is a merge request' merge_request.description = '... for viewing merge-ref and merge-base diffs' merge_request.file_content = 'This exists on the source branch only' @@ -13,16 +20,14 @@ module QA let(:new_file_name) { "added_file-#{SecureRandom.hex(8)}.txt" } - before do - commit_to_branch(merge_request.target_branch, new_file_name) - commit_to_branch(merge_request.source_branch, new_file_name) - - Flow::Login.sign_in - end - context 'when the feature flag default_merge_ref_for_diffs is enabled' do before do - Runtime::Feature.enable('default_merge_ref_for_diffs', project: merge_request.project) + Runtime::Feature.enable('default_merge_ref_for_diffs', project: project) + + commit_to_branch(merge_request.target_branch, new_file_name) + commit_to_branch(merge_request.source_branch, new_file_name) + + Flow::Login.sign_in merge_request.visit! end @@ -42,7 +47,12 @@ module QA context 'when the feature flag default_merge_ref_for_diffs is disabled' do before do - Runtime::Feature.disable('default_merge_ref_for_diffs', project: merge_request.project) + Runtime::Feature.disable('default_merge_ref_for_diffs', project: project) + + commit_to_branch(merge_request.target_branch, new_file_name) + commit_to_branch(merge_request.source_branch, new_file_name) + + Flow::Login.sign_in merge_request.visit! end 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 deleted file mode 100644 index 5aa5f0fc0a3..00000000000 --- a/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: true - -module QA - RSpec.describe 'Create' do - describe 'Files management' do - it 'user creates, edits and deletes a file via the Web', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/451' do - Runtime::Browser.visit(:gitlab, Page::Main::Login) - Page::Main::Login.perform(&:sign_in_using_credentials) - - # Create - file_name = 'QA Test - File name' - file_content = 'QA Test - File content' - commit_message_for_create = 'QA Test - Create new file' - - Resource::File.fabricate_via_browser_ui! do |file| - file.name = file_name - file.content = file_content - file.commit_message = commit_message_for_create - end - - expect(page).to have_content(file_name) - expect(page).to have_content(file_content) - expect(page).to have_content(commit_message_for_create) - - # Edit - updated_file_content = 'QA Test - Updated file content' - commit_message_for_update = 'QA Test - Update file' - - Page::File::Show.perform(&:click_edit) - - Page::File::Form.act do - remove_content - add_content(updated_file_content) - add_commit_message(commit_message_for_update) - commit_changes - end - - expect(page).to have_content('Your changes have been successfully committed.') - expect(page).to have_content(updated_file_content) - expect(page).to have_content(commit_message_for_update) - - # Delete - commit_message_for_delete = 'QA Test - Delete file' - - Page::File::Show.act do - click_delete - add_commit_message(commit_message_for_delete) - click_delete_file - end - - expect(page).to have_content('The file has been successfully deleted.') - expect(page).to have_content(commit_message_for_delete) - expect(page).to have_no_content(file_name) - end - end - end -end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/file/create_file_via_web_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/file/create_file_via_web_spec.rb new file mode 100644 index 00000000000..cd333b3cea2 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/repository/file/create_file_via_web_spec.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + context 'File management' do + file_name = 'QA Test - File name' + file_content = 'QA Test - File content' + commit_message_for_create = 'QA Test - Create new file' + + before do + Flow::Login.sign_in + end + + it 'user creates a file via the Web', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1093' do + Resource::File.fabricate_via_browser_ui! do |file| + file.name = file_name + file.content = file_content + file.commit_message = commit_message_for_create + end + + Page::File::Show.perform do |file| + aggregate_failures 'file details' do + expect(file).to have_file(file_name) + expect(file).to have_file_content(file_content) + expect(file).to have_commit_message(commit_message_for_create) + end + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/file/delete_file_via_web_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/file/delete_file_via_web_spec.rb new file mode 100644 index 00000000000..903001aa4f0 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/repository/file/delete_file_via_web_spec.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + context 'File management' do + let(:file) { Resource::File.fabricate_via_api! } + + commit_message_for_delete = 'QA Test - Delete file' + + before do + Flow::Login.sign_in + file.visit! + end + + it 'user deletes a file via the Web', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1095' do + Page::File::Show.perform do |file| + file.click_delete + file.add_commit_message(commit_message_for_delete) + file.click_delete_file + end + + Page::Project::Show.perform do |project| + aggregate_failures 'file details' do + expect(project).to have_notice('The file has been successfully deleted.') + expect(project).to have_commit_message(commit_message_for_delete) + expect(project).not_to have_file(file.name) + end + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/file/edit_file_via_web_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/file/edit_file_via_web_spec.rb new file mode 100644 index 00000000000..0da774b557f --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/repository/file/edit_file_via_web_spec.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + context 'File management' do + let(:file) { Resource::File.fabricate_via_api! } + + updated_file_content = 'QA Test - Updated file content' + commit_message_for_update = 'QA Test - Update file' + + before do + Flow::Login.sign_in + file.visit! + end + + it 'user edits a file via the Web', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1094' do + Page::File::Show.perform(&:click_edit) + + Page::File::Form.perform do |file| + file.remove_content + file.add_content(updated_file_content) + file.add_commit_message(commit_message_for_update) + file.commit_changes + end + + Page::File::Show.perform do |file| + aggregate_failures 'file details' do + expect(file).to have_notice('Your changes have been successfully committed.') + expect(file).to have_file_content(updated_file_content) + expect(file).to have_commit_message(commit_message_for_update) + end + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb index 45afa252305..e4a492d3487 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Create' do describe 'Push mirror a repository over HTTP' do - it 'configures and syncs LFS objects for a (push) mirrored repository', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/414' do + it 'configures and syncs LFS objects for a (push) mirrored repository', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1075' do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) 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 00d4acbd1e1..f01a3b21eee 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 @@ -35,8 +35,11 @@ module QA # Check that the target project has the commit from the source target_project.visit! - expect(page).to have_content('README.md') - expect(page).to have_content('This is a test project') + + Page::Project::Show.perform do |project| + expect(project).to have_content('README.md') + expect(project).to have_content('This is a test project') + end end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/add_file_to_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/add_file_to_snippet_spec.rb new file mode 100644 index 00000000000..469335db5ab --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/add_file_to_snippet_spec.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Multiple file snippet' do + let(:personal_snippet) do + Resource::Snippet.fabricate_via_api! do |snippet| + snippet.title = 'Personal snippet to add file to' + snippet.file_name = 'Original file name' + snippet.file_content = 'Original file content' + end + end + + let(:project_snippet) do + Resource::ProjectSnippet.fabricate_via_api! do |snippet| + snippet.title = 'Project snippet to add file to' + snippet.file_name = 'Original file name' + snippet.file_content = 'Original file content' + end + end + + before do + Flow::Login.sign_in + end + + shared_examples 'adding file to snippet' do |snippet_type| + it "adds second file to an existing #{snippet_type} to make it multi-file" do + send(snippet_type).visit! + + Page::Dashboard::Snippet::Show.perform(&:click_edit_button) + + Page::Dashboard::Snippet::Edit.perform do |snippet| + snippet.click_add_file + snippet.fill_file_name('Second file name', 2) + snippet.fill_file_content('Second file content', 2) + snippet.save_changes + end + + Page::Dashboard::Snippet::Show.perform do |snippet| + aggregate_failures 'file names and contents' do + expect(snippet).to have_file_name('Original file name', 1) + expect(snippet).to have_file_content('Original file content', 1) + expect(snippet).to have_file_name('Second file name', 2) + expect(snippet).to have_file_content('Second file content', 2) + end + end + end + end + + it_behaves_like 'adding file to snippet', :personal_snippet + it_behaves_like 'adding file to snippet', :project_snippet + 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 a3f6d521766..efd61a2e63a 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 - RSpec.describe 'Create', quarantine: { only: { subdomain: :staging }, issue: 'https://gitlab.com/gitlab-org/gitaly/-/issues/3143', type: :bug } do + RSpec.describe 'Create' do describe 'Version control for personal snippets' do let(:new_file) { 'new_snippet_file' } let(:changed_content) { 'changes' } @@ -22,13 +22,13 @@ module QA end let(:repository_uri_http) do - snippet + snippet.visit! Page::Dashboard::Snippet::Show.perform(&:get_repository_uri_http) end let(:repository_uri_ssh) do ssh_key - snippet + snippet.visit! Page::Dashboard::Snippet::Show.perform(&:get_repository_uri_ssh) 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 be56b870490..79e2677da66 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 - RSpec.describe 'Create', quarantine: { only: { subdomain: :staging }, issue: 'https://gitlab.com/gitlab-org/gitaly/-/issues/3143', type: :bug } do + RSpec.describe 'Create' do describe 'Version control for project snippets' do let(:new_file) { 'new_snippet_file' } let(:changed_content) { 'changes' } @@ -22,13 +22,13 @@ module QA end let(:repository_uri_http) do - snippet + snippet.visit! Page::Dashboard::Snippet::Show.perform(&:get_repository_uri_http) end let(:repository_uri_ssh) do ssh_key - snippet + snippet.visit! Page::Dashboard::Snippet::Show.perform(&:get_repository_uri_ssh) 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 new file mode 100644 index 00000000000..ca6ea5db65d --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Multiple file snippet' do + let(:personal_snippet) do + Resource::Snippet.fabricate_via_api! do |snippet| + snippet.title = 'Personal snippet to delete file from' + snippet.file_name = 'Original file name' + snippet.file_content = 'Original file content' + + snippet.add_files do |files| + files.append(name: 'Second file name', content: 'Second file content') + end + end + end + + let(:project_snippet) do + Resource::ProjectSnippet.fabricate_via_api! do |snippet| + snippet.title = 'Project snippet to delete file from' + snippet.file_name = 'Original file name' + snippet.file_content = 'Original file content' + + snippet.add_files do |files| + files.append(name: 'Second file name', content: 'Second file content') + end + end + end + + before do + Flow::Login.sign_in + end + + shared_examples 'deleting file from snippet' do |snippet_type| + it "deletes second file from an existing #{snippet_type} to make it single-file" do + send(snippet_type).visit! + + Page::Dashboard::Snippet::Show.perform(&:click_edit_button) + + Page::Dashboard::Snippet::Edit.perform do |snippet| + snippet.click_delete_file(2) + snippet.save_changes + end + + Page::Dashboard::Snippet::Show.perform do |snippet| + 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') + end + end + end + end + + it_behaves_like 'deleting file from snippet', :personal_snippet + it_behaves_like 'deleting file from snippet', :project_snippet + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb index 6b21d84cb13..971c5371d44 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb @@ -18,7 +18,7 @@ module QA context 'when the snippet is public' do it 'can be shared with not signed-in users', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1016' do - snippet + snippet.visit! sharing_link = Page::Dashboard::Snippet::Show.perform do |snippet| expect(snippet).to have_embed_dropdown @@ -40,7 +40,7 @@ module QA context 'when the snippet is changed to private' do it 'does not display Embed/Share dropdown', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1015' do - snippet + snippet.visit! Page::Dashboard::Snippet::Show.perform do |snippet| expect(snippet).to have_embed_dropdown |