diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /qa/qa/specs/features/browser_ui/3_create/snippet | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) | |
download | gitlab-ce-48aff82709769b098321c738f3444b9bdaa694c6.tar.gz |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'qa/qa/specs/features/browser_ui/3_create/snippet')
5 files changed, 102 insertions, 4 deletions
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 |