summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/7_configure/auto_devops/auto_devops_templates_spec.rb
blob: 718dc9860fb1eafb1556518d28b2a4a43f7a9097 (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
65
66
# frozen_string_literal: true

module QA
  RSpec.describe 'Configure' do
    describe 'AutoDevOps Templates', only: { subdomain: :staging } do
      using RSpec::Parameterized::TableSyntax

      # specify jobs to be disabled in the pipeline.
      # CANARY_ENABLED will allow the pipeline to be
      # blocked by a manual job, rather than fail
      # during the production run
      let(:optional_jobs) do
        %w[
          LICENSE_MANAGEMENT_DISABLED
          SAST_DISABLED DAST_DISABLED
          DEPENDENCY_SCANNING_DISABLED
          CONTAINER_SCANNING_DISABLED
          CANARY_ENABLED
        ]
      end

      where(:case_name, :template, :testcase) do
        'using express template' | 'express' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348075'
      end

      with_them do
        let!(:project) do
          Resource::Project.fabricate_via_api! do |project|
            project.name = "#{template}-autodevops-project-template"
            project.template_name = template
            project.description = "Let's see if the #{template} project works..."
            project.auto_devops_enabled = true
          end
        end

        let(:pipeline) do
          Resource::Pipeline.fabricate_via_api! do |pipeline|
            pipeline.project = project
            pipeline.variables =
              optional_jobs.map do |job|
                { key: job, value: '1', variable_type: 'env_var' }
              end
          end
        end

        before do
          Flow::Login.sign_in
        end

        it 'works with Auto DevOps', testcase: params[:testcase] do
          %w[build code_quality test].each do |job|
            pipeline.visit!

            Page::Project::Pipeline::Show.perform do |show_page|
              show_page.click_job(job)
            end

            Page::Project::Job::Show.perform do |show|
              expect(show).to have_passed(timeout: 360)
            end
          end
        end
      end
    end
  end
end