summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/project/pipelines_spec.rb
blob: f9280cd049a87c5da98ffb8b828925836d010980 (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
67
module QA
  feature 'CI/CD Pipelines', :core, :docker do
    let(:executor) { "qa-runner-#{Time.now.to_i}" }

    after do
      Service::Runner.new(executor).remove!
    end

    scenario 'user registers a new specific runner' do
      Runtime::Browser.visit(:gitlab, Page::Main::Login)
      Page::Main::Login.act { sign_in_using_credentials }

      Factory::Resource::Runner.fabricate! do |runner|
        runner.name = executor
      end

      Page::Project::Settings::CICD.perform do |settings|
        settings.refresh

        settings.expand_runners_settings do |page|
          expect(page).to have_content(executor)
          expect(page).to have_online_runner
        end
      end
    end

    scenario 'users creates a new pipeline' do
      Runtime::Browser.visit(:gitlab, Page::Main::Login)
      Page::Main::Login.act { sign_in_using_credentials }

      project = Factory::Resource::Project.fabricate! do |project|
        project.name = 'project-with-pipelines'
        project.description = 'Project with CI/CD Pipelines.'
      end

      Factory::Resource::Runner.fabricate! do |runner|
        runner.project = project
        runner.name = executor
      end

      Factory::Repository::Push.fabricate! do |push|
        push.project = project
        push.file_name = '.gitlab-ci.yml'
        push.commit_message = 'Add .gitlab-ci.yml'
        push.file_content = <<~EOF
          echo-success-test:
            script: echo 'OK'

          echo-failure-test:
            script:
              - echo 'FAILURE'
              - exit 1

          echo-artifacts-test:
            script: echo "CONTENTS" > my-artifacts/artifact.txt
            artifacts:
              paths:
                - my-artifacts/
        EOF
      end

      Page::Project::Show.act { wait_for_push }

      expect(page).to have_content('Add .gitlab-ci.yml')
    end
  end
end