summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/3_create/repository/branch_with_unusual_name_spec.rb
blob: 39fb18f20510b16c6c41b0867a996eb4f449cfa6 (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
# frozen_string_literal: true

module QA
  RSpec.describe 'Create' do
    describe 'Branch with unusual name' do
      let(:branch_name) { 'unUsually/named#br--anch' }
      let(:project) do
        Resource::Project.fabricate_via_api! do |resource|
          resource.name = 'unusually-named-branch-project'
          resource.initialize_with_readme = true
        end
      end

      before do
        Flow::Login.sign_in
      end

      context 'when branch name contains slash, hash, double dash, and capital letter' do
        it 'renders repository file tree correctly', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1809' do
          Resource::Repository::Commit.fabricate_via_api! do |commit|
            commit.project = project
            commit.branch = branch_name
            commit.start_branch = project.default_branch
            commit.commit_message = 'Add new file'
            commit.add_files([
                                 { file_path: 'test-folder/test-file.md', content: 'new content' }
                             ])
          end

          project.visit!

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

            expect(show).to have_file('test-file.md')

            show.click_file('test-file.md')

            expect(show).to have_content('new content')
          end
        end
      end
    end
  end
end