summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/3_create/repository/file/file_with_unusual_name_spec.rb
blob: eb6449181b5c8df1b3b4c5fce4b3d0b893622a11 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# frozen_string_literal: true

module QA
  RSpec.describe 'Create' do
    describe 'File with unusual name' do
      let(:file_name) { '-un:usually;named#file?.md' }
      let(:project) do
        Resource::Project.fabricate_via_api! do |resource|
          resource.name = 'unusually-named-file-project'
          resource.initialize_with_readme = true
        end
      end

      before do
        Flow::Login.sign_in
      end

      context 'when file name starts with a dash and contains hash, semicolon, colon, and question mark' do
        it 'renders repository file tree correctly', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347714' do
          Resource::File.fabricate_via_api! do |file|
            file.project = project
            file.commit_message = 'Add new file'
            file.name = "test-folder/#{file_name}"
            file.content = "### Heading\n\n[Example link](https://example.com/)"
          end

          project.visit!

          Page::Project::Show.perform do |show|
            show.click_file('test-folder')

            expect(show).to have_file(file_name)

            show.click_file(file_name)

            aggregate_failures 'markdown file contents' do
              expect(show).to have_content('Heading')
              expect(show).to have_content('Example link')
              expect(show).not_to have_content('###')
              expect(show).not_to have_content('https://example.com/')
            end
          end
        end
      end
    end
  end
end