summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb
blob: d80fc4c5b95d9542d0525b668fc1af35edd1b895 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

module QA
  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', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/839' do
        Flow::Login.sign_in

        Resource::ProjectSnippet.fabricate_via_browser_ui! do |snippet|
          snippet.title = 'Project snippet'
          snippet.description = ' '
          snippet.visibility = 'Private'
          snippet.file_name = 'markdown_file.md'
          snippet.file_content = "### Snippet heading\n\n[Gitlab link](https://gitlab.com/)"
        end

        Page::Dashboard::Snippet::Show.perform do |snippet|
          expect(snippet).to have_snippet_title('Project snippet')
          expect(snippet).to have_no_snippet_description
          expect(snippet).to have_visibility_type(/private/i)
          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).to have_no_file_content('###')
          expect(snippet).to have_no_file_content('https://gitlab.com/')
        end
      end
    end
  end
end