2019-07-25 05:24:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-11 05:44:43 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-16 18:09:01 +00:00
|
|
|
RSpec.describe 'User browses jobs' do
|
2017-09-11 05:44:43 +00:00
|
|
|
let!(:build) { create(:ci_build, :coverage, pipeline: pipeline) }
|
|
|
|
let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.sha, ref: 'master') }
|
|
|
|
let(:project) { create(:project, :repository, namespace: user.namespace) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
2018-07-11 14:36:08 +00:00
|
|
|
project.add_maintainer(user)
|
2017-09-11 05:44:43 +00:00
|
|
|
project.enable_ci
|
|
|
|
project.update_attribute(:build_coverage_regex, /Coverage (\d+)%/)
|
|
|
|
|
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
visit(project_jobs_path(project))
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows the coverage' do
|
|
|
|
page.within('td.coverage') do
|
|
|
|
expect(page).to have_content('99.9%')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows the "CI Lint" button' do
|
|
|
|
page.within('.nav-controls') do
|
|
|
|
ci_lint_tool_link = page.find_link('CI lint')
|
|
|
|
|
2018-04-23 14:53:21 +00:00
|
|
|
expect(ci_lint_tool_link[:href]).to end_with(project_ci_lint_path(project))
|
2017-09-11 05:44:43 +00:00
|
|
|
end
|
|
|
|
end
|
2018-04-05 21:04:42 +00:00
|
|
|
|
|
|
|
context 'with a failed job' do
|
|
|
|
let!(:build) { create(:ci_build, :coverage, :failed, pipeline: pipeline) }
|
|
|
|
|
|
|
|
it 'displays a tooltip with the failure reason' do
|
|
|
|
page.within('.ci-table') do
|
|
|
|
failed_job_link = page.find('.ci-failed')
|
2018-08-09 11:05:13 +00:00
|
|
|
expect(failed_job_link[:title]).to eq('Failed - (unknown failure)')
|
2018-04-05 21:04:42 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-09-11 05:44:43 +00:00
|
|
|
end
|