diff options
Diffstat (limited to 'qa/qa/specs/features/browser_ui/3_create')
17 files changed, 284 insertions, 22 deletions
diff --git a/qa/qa/specs/features/browser_ui/3_create/design_management/add_design_content_spec.rb b/qa/qa/specs/features/browser_ui/3_create/design_management/add_design_content_spec.rb index ff2b4fa5364..051e8fcecbe 100644 --- a/qa/qa/specs/features/browser_ui/3_create/design_management/add_design_content_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/design_management/add_design_content_spec.rb @@ -5,7 +5,7 @@ module QA context 'Design Management' do let(:issue) { Resource::Issue.fabricate_via_api! } let(:design_filename) { 'banana_sample.gif' } - let(:design) { File.absolute_path(File.join('spec', 'fixtures', design_filename)) } + let(:design) { File.absolute_path(File.join('qa', 'fixtures', 'designs', design_filename)) } let(:annotation) { "This design is great!" } before do diff --git a/qa/qa/specs/features/browser_ui/3_create/design_management/archive_design_content_spec.rb b/qa/qa/specs/features/browser_ui/3_create/design_management/archive_design_content_spec.rb new file mode 100644 index 00000000000..7090427e5a4 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/design_management/archive_design_content_spec.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + context 'Design Management' do + let(:first_design) { Resource::Design.fabricate! } + + let(:second_design) do + Resource::Design.fabricate! do |design| + design.issue = first_design.issue + design.filename = 'values.png' + end + end + + let(:third_design) do + Resource::Design.fabricate! do |design| + design.issue = second_design.issue + design.filename = 'tanuki.jpg' + end + end + + before do + Flow::Login.sign_in + end + + it 'user archives a design', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/274' do + third_design.issue.visit! + + Page::Project::Issue::Show.perform do |issue| + issue.select_design(third_design.filename) + + issue.archive_selected_designs + + expect(issue).not_to have_design(third_design.filename) + expect(issue).to have_design(first_design.filename) + expect(issue).to have_design(second_design.filename) + end + + Page::Project::Issue::Show.perform do |issue| + issue.select_design(second_design.filename) + issue.select_design(first_design.filename) + + issue.archive_selected_designs + + expect(issue).not_to have_design(first_design.filename) + expect(issue).not_to have_design(second_design.filename) + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/design_management/modify_design_content_spec.rb b/qa/qa/specs/features/browser_ui/3_create/design_management/modify_design_content_spec.rb new file mode 100644 index 00000000000..135063b6644 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/design_management/modify_design_content_spec.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + context 'Design Management' do + let(:design) do + Resource::Design.fabricate! do |design| + design.filename = 'tanuki.jpg' + end + end + + before do + Flow::Login.sign_in + end + + it 'user adds a design and modifies it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/273' do + design.issue.visit! + + Page::Project::Issue::Show.perform do |issue| + expect(issue).to have_created_icon + end + + Page::Project::Issue::Show.perform do |issue| + issue.update_design(design.filename) + expect(issue).to have_modified_icon + end + end + end + end +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 new file mode 100644 index 00000000000..7844d0d7ccb --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_merge_ref_diff_spec.rb @@ -0,0 +1,80 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create', :requires_admin do + describe 'View merge request merge-ref diff' do + let(:merge_request) do + Resource::MergeRequest.fabricate_via_api! do |merge_request| + 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' + end + end + + 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) + + merge_request.visit! + end + + it 'views the merge-ref diff by default' do + Page::MergeRequest::Show.perform do |mr_page| + 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).to have_file(merge_request.file_name) + expect(mr_page).not_to have_file(new_file_name) + end + end + end + + 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) + + merge_request.visit! + end + + it 'views the merge-base diff by default' do + Page::MergeRequest::Show.perform do |mr_page| + 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).to have_file(merge_request.file_name) + expect(mr_page).to have_file(new_file_name) + end + end + end + + def commit_to_branch(branch, file) + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = merge_request.project + commit.branch = branch + commit.commit_message = "Add new file on #{branch}" + commit.add_files( + [ + { + file_path: file, + content: "This exists on source and target branches" + } + ] + ) + end + end + end + end +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 index 43f4b080c73..5aa5f0fc0a3 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 @@ -18,7 +18,6 @@ module QA file.commit_message = commit_message_for_create end - expect(page).to have_content('The file has been successfully created.') expect(page).to have_content(file_name) expect(page).to have_content(file_content) expect(page).to have_content(commit_message_for_create) 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 8ac7285d70c..5781bf8a7f0 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 @@ -37,8 +37,10 @@ module QA project.wait_for_push_new_branch # Check that the push worked - expect(page).to have_content(file_name) - expect(page).to have_content(file_content) + Page::Project::Show.perform do |project_page| + expect(project_page).to have_file(file_name) + expect(project_page).to have_readme_content(file_content) + end # And check that the correct Git protocol was used expect(git_protocol_reported).to eq(git_protocol) 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 f96b424d233..45afa252305 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 @@ -4,7 +4,6 @@ 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 - Runtime::Feature.enable_and_verify('push_mirror_syncs_lfs') Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) @@ -37,8 +36,10 @@ 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('The rendered file could not be displayed because it is stored in LFS') + Page::Project::Show.perform do |project_page| + expect(project_page).to have_file('README.md') + expect(project_page).to have_readme_content('The rendered file could not be displayed because it is stored in LFS') + end end end end 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 2ebab7d2a30..222eb3771ad 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 @@ -41,7 +41,7 @@ module QA retry_on_fail do expect { push_new_file('oversize_file_2.bin', wait_for_push: false) } - .to raise_error(QA::Git::Repository::RepositoryCommandError, /remote: fatal: pack exceeds maximum allowed size/) + .to raise_error(QA::Support::Run::CommandError, /remote: fatal: pack exceeds maximum allowed size/) end end 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 8b6973e6cea..cf14017b7f1 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 @@ -36,8 +36,10 @@ module QA project.visit! - expect(page).to have_content('README.md') - expect(page).to have_content("This is a test project named #{project.name}") + Page::Project::Show.perform do |project_page| + expect(project_page).to have_file('README.md') + expect(project_page).to have_readme_content("This is a test project named #{project.name}") + end end end end 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 d20abd658c6..54d00209cc7 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 @@ -35,7 +35,7 @@ module QA roles: Resource::ProtectedBranch::Roles::NO_ONE }) - expect { push_new_file(branch_name) }.to raise_error(QA::Git::Repository::RepositoryCommandError, /remote: GitLab: You are not allowed to push code to protected branches on this project\.([\s\S]+)\[remote rejected\] #{branch_name} -> #{branch_name} \(pre-receive hook declined\)/) + expect { push_new_file(branch_name) }.to raise_error(QA::Support::Run::CommandError, /remote: GitLab: You are not allowed to push code to protected branches on this project\.([\s\S]+)\[remote rejected\] #{branch_name} -> #{branch_name} \(pre-receive hook declined\)/) 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 ef3b315506f..a3f6d521766 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 @@ -36,6 +36,10 @@ module QA Flow::Login.sign_in end + after do + ssh_key.remove_via_api! + 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.repository_http_uri = repository_uri_http @@ -87,7 +91,7 @@ module QA repository.init_repository expect { repository.pull(repository_uri_ssh, branch_name) } - .to raise_error(QA::Git::Repository::RepositoryCommandError, /fatal: Could not read from remote repository\./) + .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 34f6b464f29..be56b870490 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 @@ -36,6 +36,10 @@ module QA Flow::Login.sign_in end + after do + ssh_key.remove_via_api! + end + it 'clones, pushes, and pulls a project snippet over HTTP, edits via UI', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/833' do Resource::Repository::Push.fabricate! do |push| push.repository_http_uri = repository_uri_http @@ -86,7 +90,7 @@ module QA repository.init_repository expect { repository.pull(repository_uri_ssh, branch_name) } - .to raise_error(QA::Git::Repository::RepositoryCommandError, /fatal: Could not read from remote repository\./) + .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/create_personal_snippet_with_multiple_files_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb new file mode 100644 index 00000000000..50f2f4789fa --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Multiple file snippet' do + it 'creates a personal snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/842' do + Flow::Login.sign_in + + 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 = 'Personal snippet with multiple files' + snippet.description = 'Snippet description' + snippet.visibility = 'Public' + snippet.file_name = 'First file name' + snippet.file_content = 'First file content' + + snippet.add_files do |files| + files.append(name: 'Second file name', content: 'Second file content') + files.append(name: 'Third file name', content: 'Third file content') + end + end + + Page::Dashboard::Snippet::Show.perform do |snippet| + expect(snippet).to have_snippet_title('Personal snippet with multiple files') + expect(snippet).to have_snippet_description('Snippet description') + expect(snippet).to have_visibility_type(/public/i) + expect(snippet).to have_file_name('First file name', 1) + expect(snippet).to have_file_content('First file content', 1) + expect(snippet).to have_file_name('Second file name', 2) + expect(snippet).to have_file_content('Second file content', 2) + expect(snippet).to have_file_name('Third file name', 3) + expect(snippet).to have_file_content('Third file content', 3) + end + end + 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 0a8f6e13b2e..d80fc4c5b95 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 @@ -21,8 +21,8 @@ module QA 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).not_to have_file_content('###') - expect(snippet).not_to have_file_content('https://gitlab.com/') + expect(snippet).to have_no_file_content('###') + expect(snippet).to have_no_file_content('https://gitlab.com/') end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb new file mode 100644 index 00000000000..7b4ec573f53 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Multiple file snippet' do + it 'creates a project snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1024' do + Flow::Login.sign_in + + Resource::ProjectSnippet.fabricate_via_browser_ui! do |snippet| + snippet.title = 'Project snippet with multiple files' + snippet.description = 'Snippet description' + snippet.visibility = 'Private' + snippet.file_name = '01 file name' + snippet.file_content = '1 file content' + + # Ten is the limit of files you can have under one snippet at the moment + snippet.add_files do |files| + (2..10).each do |i| + files.append(name: file_name(i), content: file_content(i)) + end + end + end + + Page::Dashboard::Snippet::Show.perform do |snippet| + aggregate_failures 'file content verification' do + expect(snippet).to have_snippet_title('Project snippet with multiple files') + expect(snippet).to have_snippet_description('Snippet description') + expect(snippet).to have_visibility_type(/private/i) + + (1..10).each do |i| + expect(snippet).to have_file_name(file_name(i), i) + expect(snippet).to have_file_content(file_content(i), i) + end + end + end + end + + # Currently the files are returned in alphabetical order and not in the order they are created. + # However, it might soon change - see https://gitlab.com/gitlab-org/gitlab/-/issues/250836. + # By using a leading "0" we make sure the test works with either implementation. + def file_name(index) + "#{index.to_s.rjust(2, '0')} file name" + end + + def file_content(index) + "#{index} file content" + end + end + end +end 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 ea821f8b3e6..f7a2e3081fb 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 @@ -10,7 +10,6 @@ module QA end end - let(:web_ide_url) { current_url + '-/ide/project/' + project.path_with_namespace } let(:file_name) { 'the very first file.txt' } before do @@ -18,10 +17,8 @@ module QA end it "creates the first file in an empty project via Web IDE", testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/847' do - # In the first iteration, the test opens Web IDE by modifying the URL to address past regressions. - # Once the Web IDE button is introduced for empty projects, the test will be modified to go through UI. - # See https://gitlab.com/gitlab-org/gitlab/-/issues/27915 and https://gitlab.com/gitlab-org/gitlab/-/issues/27535. - page.visit(web_ide_url) + project.visit! + Page::Project::Show.perform(&:create_first_new_file!) Page::Project::WebIDE::Edit.perform do |ide| ide.create_first_file(file_name) diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_directory_management_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_directory_management_spec.rb index e8053600930..4f1d9ac1696 100644 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_directory_management_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_directory_management_spec.rb @@ -4,7 +4,7 @@ module QA RSpec.describe 'Create' do context 'Wiki' do let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } - let(:new_path) { "a/new/path" } + let(:new_path) { "a/new/path-with-spaces" } before do Flow::Login.sign_in @@ -23,7 +23,9 @@ module QA Page::Project::Wiki::Edit.perform(&:click_save_changes) Page::Project::Wiki::Show.perform do |wiki| - expect(wiki).to have_directory(new_path) + expect(wiki).to have_directory('a') + expect(wiki).to have_directory('new') + expect(wiki).to have_directory('path with spaces') end end end |