Commit e42de89a authored by Filipa Lacerda's avatar Filipa Lacerda

Changes after review

Changes after review

Fix tooltip title

Remove unneeded string interpolation
parent 23f4d182
...@@ -645,14 +645,6 @@ ...@@ -645,14 +645,6 @@
margin-bottom: 0; margin-bottom: 0;
line-height: 1.2; line-height: 1.2;
} }
li:first-child {
padding-top: 6px;
}
li:last-child {
padding-bottom: 6px;
}
} }
.dropdown-build { .dropdown-build {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
- klass = "ci-status-icon ci-status-icon-#{status}" - klass = "ci-status-icon ci-status-icon-#{status}"
- if status.has_details? - if status.has_details?
= link_to status.details_path, data: { toggle: 'tooltip', title: "#{subject.name} - #{status}" } do = link_to status.details_path, data: { toggle: 'tooltip', title: "#{subject.name} - #{status.label}" } do
%span{ class: klass }= custom_icon(status.icon) %span{ class: klass }= custom_icon(status.icon)
.ci-status-text= subject.name .ci-status-text= subject.name
- else - else
...@@ -14,6 +14,6 @@ ...@@ -14,6 +14,6 @@
- if status.has_action? - if status.has_action?
= link_to status.action_path, method: status.action_method, = link_to status.action_path, method: status.action_method,
title: "#{subject.name}: #{status.action_title}", class: 'ci-action-icon-container' do title: status.action_title, class: 'ci-action-icon-container' do
%i.ci-action-icon-wrapper %i.ci-action-icon-wrapper
= icon(status.action_icon, class: status.action_class) = icon(status.action_icon, class: status.action_class)
- is_playable = subject.playable? && can?(current_user, :update_build, @project)
- if is_playable
= link_to play_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, data: { toggle: 'tooltip', title: "#{subject.name} - play", container: '.js-pipeline-graph', placement: 'bottom' } do
= ci_icon_for_status('play')
.ci-status-text= subject.name
- elsif can?(current_user, :read_build, @project)
= link_to namespace_project_build_path(subject.project.namespace, subject.project, subject), data: { toggle: 'tooltip', title: "#{subject.name} - #{subject.status}", container: '.js-pipeline-graph', placement: 'bottom' } do
%span{class: "ci-status-icon ci-status-icon-#{subject.status}"}
= ci_icon_for_status(subject.status)
.ci-status-text= subject.name
- else
%span{class: "ci-status-icon ci-status-icon-#{subject.status}"}
= ci_icon_for_status(subject.status)
%a{ data: { toggle: 'tooltip', title: "#{subject.name} - #{subject.status}", container: '.js-pipeline-graph', placement: 'bottom' } }
- if subject.target_url
= link_to subject.target_url do
%span{class: "ci-status-icon ci-status-icon-#{subject.status}"}
= ci_icon_for_status(subject.status)
%span.ci-status-text= subject.name
- else
%span{class: "ci-status-icon ci-status-icon-#{subject.status}"}
= ci_icon_for_status(subject.status)
%span.ci-status-text= subject.name
...@@ -38,65 +38,90 @@ describe "Pipelines", feature: true, js: true do ...@@ -38,65 +38,90 @@ describe "Pipelines", feature: true, js: true do
expect(page).to have_css('#js-tab-pipeline.active') expect(page).to have_css('#js-tab-pipeline.active')
end end
context 'pipeline graph' do describe 'pipeline graph' do
context 'when pipeline has running builds' do
it 'shows a running icon and a cancel action for the running build' do it 'shows a running icon and a cancel action for the running build' do
title = "#{@running.name} - #{@running.status}" page.within('a[data-title="deploy - running"]') do
page.within("a[data-title='#{title}']") do
expect(page).to have_selector('.ci-status-icon-running') expect(page).to have_selector('.ci-status-icon-running')
expect(page).to have_content('deploy') expect(page).to have_content('deploy')
end end
page.within("a[data-title='#{title}'] + .ci-action-icon-container") do page.within('a[data-title="deploy - running"] + .ci-action-icon-container') do
expect(page).to have_selector('.ci-action-icon-container .fa-ban') expect(page).to have_selector('.ci-action-icon-container .fa-ban')
end end
end
it 'should be possible to cancel the running build' do
find('a[data-title="deploy - running"] + .ci-action-icon-container').trigger('click')
expect(page).not_to have_content('Cancel running')
end
end end
context 'when pipeline has successful builds' do
it 'shows the success icon and a retry action for the successfull build' do it 'shows the success icon and a retry action for the successfull build' do
title = "#{@success.name} - #{@success.status}" page.within('a[data-title="build - passed"]') do
page.within("a[data-title='#{title}']") do
expect(page).to have_selector('.ci-status-icon-success') expect(page).to have_selector('.ci-status-icon-success')
expect(page).to have_content('build') expect(page).to have_content('build')
end end
page.within("a[data-title='#{title}'] + .ci-action-icon-container") do page.within('a[data-title="build - passed"] + .ci-action-icon-container') do
expect(page).to have_selector('.ci-action-icon-container .fa-refresh') expect(page).to have_selector('.ci-action-icon-container .fa-refresh')
end end
end end
it 'shows the failed icon and a retry action for the failed build' do it 'should be possible to retry the success build' do
title = "#{@failed.name} - #{@failed.status}" find('a[data-title="build - passed"] + .ci-action-icon-container').trigger('click')
page.within("a[data-title='#{title}']") do expect(page).not_to have_content('Retry build')
end
end
context 'when pipeline has failed builds' do
it 'shows the failed icon and a retry action for the failed build' do
page.within('a[data-title="test - failed"]') do
expect(page).to have_selector('.ci-status-icon-failed') expect(page).to have_selector('.ci-status-icon-failed')
expect(page).to have_content('test') expect(page).to have_content('test')
end end
page.within("a[data-title='#{title}'] + .ci-action-icon-container") do page.within('a[data-title="test - failed"] + .ci-action-icon-container') do
expect(page).to have_selector('.ci-action-icon-container .fa-refresh') expect(page).to have_selector('.ci-action-icon-container .fa-refresh')
end end
end end
it 'shows the skipped icon and a play action for the manual build' do it 'should be possible to retry the failed build' do
title = "#{@manual.name} - #{@manual.status}" find('a[data-title="test - failed"] + .ci-action-icon-container').trigger('click')
page.within("a[data-title='#{title}']") do expect(page).not_to have_content('Retry build')
end
end
context 'when pipeline has manual builds' do
it 'shows the skipped icon and a play action for the manual build' do
page.within('a[data-title="manual build - manual play action"]') do
expect(page).to have_selector('.ci-status-icon-skipped') expect(page).to have_selector('.ci-status-icon-skipped')
expect(page).to have_content('manual') expect(page).to have_content('manual')
end end
page.within("a[data-title='#{title}'] + .ci-action-icon-container") do page.within('a[data-title="manual build - manual play action"] + .ci-action-icon-container') do
expect(page).to have_selector('.ci-action-icon-container .fa-play') expect(page).to have_selector('.ci-action-icon-container .fa-play')
end end
end end
it 'should be possible to play the manual build' do
find('a[data-title="manual build - manual play action"] + .ci-action-icon-container').trigger('click')
expect(page).not_to have_content('Play build')
end
end
context 'when pipeline has external build' do
it 'shows the success icon and the generic comit status build' do it 'shows the success icon and the generic comit status build' do
expect(page).to have_selector('.ci-status-icon-success') expect(page).to have_selector('.ci-status-icon-success')
expect(page).to have_content('jenkins') expect(page).to have_content('jenkins')
end end
end end
end
context 'page tabs' do context 'page tabs' do
it 'shows Pipeline and Builds tabs with link' do it 'shows Pipeline and Builds tabs with link' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment