summaryrefslogtreecommitdiff
path: root/qa/qa/factory/resource/ci_variable.rb
blob: a0aefc61f9f725b5911bd436f3aaa7336b217d93 (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
module QA
  module Factory
    module Resource
      class CiVariable < Factory::Base
        attr_accessor :key, :value

        attribute :project do
          Factory::Resource::Project.fabricate! do |resource|
            resource.name = 'project-with-ci-variables'
            resource.description = 'project for adding CI variable test'
          end
        end

        def fabricate!
          project.visit!

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

          Page::Project::Settings::CICD.perform do |setting|
            setting.expand_ci_variables do |page|
              page.fill_variable(key, value)

              page.save_variables
            end
          end
        end
      end
    end
  end
end