Welcome to mirror list, hosted at ThFree Co, Russian Federation.

add_new_branch_rule_spec.rb « repository « 3_create « browser_ui « features « specs « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 82074919ad428546da91c9c6d39bca0875b01d41 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# frozen_string_literal: true

module QA
  RSpec.describe 'Create' do
    describe 'Branch Rules Overview', product_group: :source_code,
      quarantine: {
        issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/403583',
        type: :flaky
      } do
      let(:branch_name) { 'new-branch' }
      let(:allowed_to_push_role) { Resource::ProtectedBranch::Roles::NO_ONE }
      let(:allowed_to_merge_role) { Resource::ProtectedBranch::Roles::MAINTAINERS }
      let(:project) do
        Resource::Project.fabricate_via_api! do |project|
          project.name = 'branch-rule-project'
          project.initialize_with_readme = true
        end
      end

      before do
        Flow::Login.sign_in

        Resource::Repository::Commit.fabricate_via_api! do |commit|
          commit.project = project
          commit.branch = branch_name
          commit.start_branch = project.default_branch
          commit.commit_message = 'First commit'
          commit.add_files([{ file_path: 'new_file.rb', content: '# new content' }])
        end
      end

      it 'adds a new branch rule', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/397587' do
        project.visit!

        Page::Project::Menu.perform(&:go_to_repository_settings)

        Page::Project::Settings::Repository.perform(&:expand_branch_rules)

        Page::Project::Settings::BranchRules.perform(&:click_add_branch_rule)

        Page::Project::Settings::ProtectedBranches.perform do |settings|
          settings.select_branch(branch_name)
          settings.select_allowed_to_push(roles: allowed_to_push_role)
          settings.select_allowed_to_merge(roles: allowed_to_merge_role)
          settings.protect_branch
        end

        Page::Project::Settings::Repository.perform(&:expand_branch_rules)

        Page::Project::Settings::BranchRules.perform do |rules|
          expect(rules).to have_content(branch_name)
          rules.navigate_to_branch_rules_details(branch_name)
        end

        Page::Project::Settings::BranchRulesDetails.perform do |details|
          aggregate_failures 'branch rules details' do
            expect(details).to have_allowed_to_push(allowed_to_push_role[:description])
            expect(details).to have_allowed_to_merge(allowed_to_merge_role[:description])
          end
        end
      end
    end
  end
end