2016-01-05 07:46:42 -05:00
|
|
|
module SharedBuilds
|
|
|
|
include Spinach::DSL
|
|
|
|
|
2016-01-15 07:56:43 -05:00
|
|
|
step 'project has CI enabled' do
|
2016-01-05 07:46:42 -05:00
|
|
|
@project.enable_ci
|
|
|
|
end
|
|
|
|
|
2016-02-04 05:08:58 -05:00
|
|
|
step 'project has coverage enabled' do
|
|
|
|
@project.update_attribute(:build_coverage_regex, /Coverage (\d+)%/)
|
|
|
|
end
|
|
|
|
|
2016-01-15 07:56:43 -05:00
|
|
|
step 'project has a recent build' do
|
2016-08-11 09:22:35 -04:00
|
|
|
@pipeline = create(:ci_empty_pipeline, project: @project, sha: @project.commit.sha, ref: 'master')
|
2017-02-16 07:13:10 -05:00
|
|
|
@build = create(:ci_build, :coverage, pipeline: @pipeline)
|
2016-02-08 06:23:56 -05:00
|
|
|
end
|
|
|
|
|
2016-02-11 04:27:53 -05:00
|
|
|
step 'recent build is successful' do
|
2016-08-11 09:22:35 -04:00
|
|
|
@build.success
|
2016-02-08 06:23:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'recent build failed' do
|
2016-08-11 09:22:35 -04:00
|
|
|
@build.drop
|
2016-01-05 07:46:42 -05:00
|
|
|
end
|
|
|
|
|
2016-02-11 04:27:53 -05:00
|
|
|
step 'project has another build that is running' do
|
2016-08-11 16:54:25 -04:00
|
|
|
create(:ci_build, pipeline: @pipeline, name: 'second build', status_event: 'run')
|
2016-02-08 06:42:35 -05:00
|
|
|
end
|
|
|
|
|
2016-01-17 10:57:42 -05:00
|
|
|
step 'I visit recent build details page' do
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_job_path(@project, @build)
|
2016-01-05 07:46:42 -05:00
|
|
|
end
|
2016-01-07 04:33:07 -05:00
|
|
|
|
2016-01-17 10:57:42 -05:00
|
|
|
step 'I visit project builds page' do
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_jobs_path(@project)
|
2016-01-17 10:57:42 -05:00
|
|
|
end
|
|
|
|
|
2016-01-07 04:33:07 -05:00
|
|
|
step 'recent build has artifacts available' do
|
|
|
|
artifacts = Rails.root + 'spec/fixtures/ci_build_artifacts.zip'
|
|
|
|
archive = fixture_file_upload(artifacts, 'application/zip')
|
|
|
|
@build.update_attributes(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')
|
|
|
|
@build.update_attributes(artifacts_metadata: gzip)
|
|
|
|
end
|
2016-01-15 07:56:43 -05:00
|
|
|
|
2016-02-01 08:30:05 -05:00
|
|
|
step 'recent build has a build trace' do
|
2017-04-06 12:20:27 -04:00
|
|
|
@build.trace.set('job trace')
|
2016-02-01 08:30:05 -05:00
|
|
|
end
|
|
|
|
|
2016-01-15 07:56:43 -05:00
|
|
|
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-06-29 13:06:35 -04:00
|
|
|
visit download_project_job_artifacts_path(@project, @build)
|
2016-01-15 07:56:43 -05:00
|
|
|
end
|
2016-02-04 07:13:01 -05:00
|
|
|
|
|
|
|
step 'I see details of a build' do
|
2017-01-26 06:52:58 -05:00
|
|
|
expect(page).to have_content "Job ##{@build.id}"
|
2016-02-04 07:13:01 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see build trace' do
|
|
|
|
expect(page).to have_css '#build-trace'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see the build' do
|
2016-03-09 10:24:02 -05:00
|
|
|
page.within('.build') do
|
2016-02-04 07:13:01 -05:00
|
|
|
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
|
2016-01-05 07:46:42 -05:00
|
|
|
end
|