Commit 22f49d16 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '60462-empty-pipeline-section' into 'master'

Fixes empty block in MR widget

Closes #60462

See merge request gitlab-org/gitlab-ce!27462
parents 91acefb1 61cb27b0
...@@ -94,8 +94,8 @@ export default { ...@@ -94,8 +94,8 @@ export default {
</script> </script>
<template> <template>
<div v-if="hasPipeline || hasCIError" class="ci-widget media js-ci-widget"> <div class="ci-widget media js-ci-widget">
<template v-if="hasCIError"> <template v-if="!hasPipeline || hasCIError">
<div <div
class="add-border ci-status-icon ci-status-icon-failed ci-error js-ci-error append-right-default" class="add-border ci-status-icon ci-status-icon-failed ci-error js-ci-error append-right-default"
> >
......
---
title: Fix empty block in MR widget when user doesn't have permission
merge_request: 27462
author:
type: fixed
...@@ -670,4 +670,26 @@ describe 'Merge request > User sees merge widget', :js do ...@@ -670,4 +670,26 @@ describe 'Merge request > User sees merge widget', :js do
end end
end end
end end
context 'when MR has pipeline but user does not have permission' do
let(:sha) { project.commit(merge_request.source_branch).sha }
let!(:pipeline) { create(:ci_pipeline_without_jobs, status: 'success', sha: sha, project: project, ref: merge_request.source_branch) }
before do
project.update(
visibility_level: Gitlab::VisibilityLevel::PUBLIC,
public_builds: false
)
merge_request.update!(head_pipeline: pipeline)
sign_out(:user)
visit project_merge_request_path(project, merge_request)
end
it 'renders a CI pipeline error' do
within '.ci-widget' do
expect(page).to have_content('Could not retrieve the pipeline status.')
end
end
end
end end
...@@ -78,6 +78,19 @@ describe('MRWidgetPipeline', () => { ...@@ -78,6 +78,19 @@ describe('MRWidgetPipeline', () => {
); );
}); });
it('should render CI error when no pipeline is provided', () => {
vm = mountComponent(Component, {
pipeline: {},
hasCi: true,
ciStatus: 'success',
troubleshootingDocsPath: 'help',
});
expect(vm.$el.querySelector('.media-body').textContent.trim()).toContain(
'Could not retrieve the pipeline status. For troubleshooting steps, read the documentation.',
);
});
describe('with a pipeline', () => { describe('with a pipeline', () => {
beforeEach(() => { beforeEach(() => {
vm = mountComponent(Component, { vm = mountComponent(Component, {
......
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