summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb
blob: ccd4d34a9168ee08c67e34e1b11e4403d617ae07 (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
# frozen_string_literal: true

module QA
  RSpec.describe 'Verify' do
    describe 'Add or Remove CI variable via UI', :smoke do
      let(:project) do
        Resource::Project.fabricate_via_api! do |project|
          project.name = 'project-with-ci-variables'
          project.description = 'project with CI variables'
        end
      end

      before do
        Flow::Login.sign_in
        project.visit!
        add_ci_variable
      end

      it 'user adds a CI variable', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/395' do
        Page::Project::Settings::CiVariables.perform do |ci_variable|
          expect(ci_variable).to have_text('VARIABLE_KEY')
          expect(ci_variable).to have_no_text('some_CI_variable')

          ci_variable.click_reveal_ci_variable_value_button

          expect(ci_variable).to have_text('some_CI_variable')
        end
      end

      it 'user removes a CI variable', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/394' do
        Page::Project::Settings::CiVariables.perform do |ci_variable|
          ci_variable.click_edit_ci_variable
          ci_variable.click_ci_variable_delete_button

          expect(ci_variable).to have_text('There are no variables yet', wait: 60)
        end
      end

      private

      def add_ci_variable
        Resource::CiVariable.fabricate_via_browser_ui! do |ci_variable|
          ci_variable.project = project
          ci_variable.key = 'VARIABLE_KEY'
          ci_variable.value = 'some_CI_variable'
          ci_variable.masked = false
        end
      end
    end
  end
end