debian-mirror-gitlab/features/steps/shared/builds.rb

79 lines
2.2 KiB
Ruby
Raw Normal View History

module SharedBuilds
include Spinach::DSL
step 'project has CI enabled' do
@project.enable_ci
end
2016-06-02 11:05:42 +05:30
step 'project has coverage enabled' do
@project.update_attribute(:build_coverage_regex, /Coverage (\d+)%/)
end
step 'project has a recent build' do
2016-09-13 17:45:13 +05:30
@pipeline = create(:ci_empty_pipeline, project: @project, sha: @project.commit.sha, ref: 'master')
2018-03-17 18:26:18 +05:30
@build = create(:ci_build, :running, :coverage, pipeline: @pipeline)
end
2016-04-02 18:10:28 +05:30
step 'recent build is successful' do
2016-09-13 17:45:13 +05:30
@build.success
2016-04-02 18:10:28 +05:30
end
step 'recent build failed' do
2016-09-13 17:45:13 +05:30
@build.drop
2016-04-02 18:10:28 +05:30
end
step 'project has another build that is running' do
2016-09-13 17:45:13 +05:30
create(:ci_build, pipeline: @pipeline, name: 'second build', status_event: 'run')
2016-04-02 18:10:28 +05:30
end
step 'I visit recent build details page' do
2017-09-10 17:25:29 +05:30
visit project_job_path(@project, @build)
end
2016-04-02 18:10:28 +05:30
step 'I visit project builds page' do
2017-09-10 17:25:29 +05:30
visit project_jobs_path(@project)
2016-04-02 18:10:28 +05:30
end
step 'recent build has artifacts available' do
artifacts = Rails.root + 'spec/fixtures/ci_build_artifacts.zip'
archive = fixture_file_upload(artifacts, 'application/zip')
2018-03-17 18:26:18 +05:30
@build.update_attributes(legacy_artifacts_file: archive)
end
step 'recent build has artifacts metadata available' do
metadata = Rails.root + 'spec/fixtures/ci_build_artifacts_metadata.gz'
gzip = fixture_file_upload(metadata, 'application/x-gzip')
2018-03-17 18:26:18 +05:30
@build.update_attributes(legacy_artifacts_metadata: gzip)
end
2016-04-02 18:10:28 +05:30
step 'recent build has a build trace' do
2017-08-17 22:00:37 +05:30
@build.trace.set('job trace')
2016-04-02 18:10:28 +05:30
end
step 'download of build artifacts archive starts' do
expect(page.response_headers['Content-Type']).to eq 'application/zip'
expect(page.response_headers['Content-Transfer-Encoding']).to eq 'binary'
end
step 'I access artifacts download page' do
2017-09-10 17:25:29 +05:30
visit download_project_job_artifacts_path(@project, @build)
end
2016-04-02 18:10:28 +05:30
step 'I see details of a build' do
2017-08-17 22:00:37 +05:30
expect(page).to have_content "Job ##{@build.id}"
2016-04-02 18:10:28 +05:30
end
step 'I see build trace' do
expect(page).to have_css '#build-trace'
end
step 'I see the build' do
2016-06-02 11:05:42 +05:30
page.within('.build') do
2016-04-02 18:10:28 +05:30
expect(page).to have_content "##{@build.id}"
expect(page).to have_content @build.sha[0..7]
expect(page).to have_content @build.ref
expect(page).to have_content @build.name
end
end
end