summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb')
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb50
1 files changed, 50 insertions, 0 deletions
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