Commit 66aae5f1 authored by Nathan Friend's avatar Nathan Friend

Make MR pipeline widget text more descriptive (EE)

This change updates the text of the pipeline widget that appears on the
merge request page. The text has been made more consistent between
different types of pipelines; this makes the front-end implementation
simpler and more maintainable.  In addition, the type of pipeline is
(i.e. regular pipeline, merge request pipeline, detached pipeline)
included in the text, making this type more obvious to the end user.

Some information has been removed from the widget as part of this
change; however, any information that was removed already appears
elsewhere on the merge request page.
parent 4a57c020
......@@ -24,6 +24,15 @@ FactoryBot.modify do
end
end
trait :with_merge_train_pipeline do
with_merge_request_pipeline
after(:create) do |merge_request, evaluator|
merge_request.pipelines_for_merge_request.last
.update(ref: merge_request.train_ref_path)
end
end
trait :add_to_merge_train_when_pipeline_succeeds do
auto_merge_enabled true
auto_merge_strategy AutoMergeService::STRATEGY_ADD_TO_MERGE_TRAIN_WHEN_PIPELINE_SUCCEEDS
......
......@@ -47,6 +47,24 @@ describe 'Merge request > User sees merge widget', :js do
end
end
context 'when the head pipeline is merge train pipeline' do
let(:traits) { [:with_merge_train_pipeline] }
let(:options) { { merge_sha: project.commit.sha } }
let(:pipeline) { merge_request.all_pipelines.first }
before do
merge_request.update_head_pipeline
end
it 'shows head pipeline information' do
visit project_merge_request_path(project, merge_request)
within '.ci-widget-content' do
expect(page).to have_content("Merge train pipeline ##{pipeline.id} pending for #{pipeline.short_sha}")
end
end
end
context 'when merge request is submitted from a forked project' do
let(:source_project) { fork_project(project, user, repository: true) }
let(:traits) { [:with_detached_merge_request_pipeline] }
......
......@@ -3,6 +3,7 @@ import pipelineComponent from '~/vue_merge_request_widget/components/mr_widget_p
import mountComponent from 'spec/helpers/vue_mount_component_helper';
import mockData from 'ee_spec/vue_mr_widget/mock_data';
import mockLinkedPipelines from 'ee_spec/pipelines/graph/linked_pipelines_mock_data';
import { trimText } from 'spec/helpers/text_helper';
describe('MRWidgetPipeline', () => {
let vm;
......@@ -55,4 +56,53 @@ describe('MRWidgetPipeline', () => {
});
});
});
describe('for each type of pipeline', () => {
let pipeline;
beforeEach(() => {
({ pipeline } = JSON.parse(JSON.stringify(mockData)));
pipeline.ref.tag = false;
pipeline.ref.branch = false;
});
const factory = () => {
vm = mountComponent(Component, {
pipeline,
hasCi: true,
ciStatus: 'success',
troubleshootingDocsPath: 'help',
sourceBranchLink: mockData.source_branch_link,
});
};
describe('for a merge train pipeline', () => {
it('renders a pipeline widget that reads "Merge train pipeline <ID> <status> for <SHA>"', () => {
pipeline.details.name = 'Merge train pipeline';
pipeline.merge_request_event_type = 'merge_train';
factory();
const expected = `Merge train pipeline #${pipeline.id} ${pipeline.details.status.label} for ${pipeline.commit.short_id}`;
const actual = trimText(vm.$el.querySelector('.js-pipeline-info-container').innerText);
expect(actual).toBe(expected);
});
});
describe('for a merged result pipeline', () => {
it('renders a pipeline widget that reads "Merged result pipeline <ID> <status> for <SHA>"', () => {
pipeline.details.name = 'Merged result pipeline';
pipeline.merge_request_event_type = 'merged_result';
factory();
const expected = `Merged result pipeline #${pipeline.id} ${pipeline.details.status.label} for ${pipeline.commit.short_id}`;
const actual = trimText(vm.$el.querySelector('.js-pipeline-info-container').innerText);
expect(actual).toBe(expected);
});
});
});
});
......@@ -4226,9 +4226,6 @@ msgstr ""
msgid "Could not remove the trigger."
msgstr ""
msgid "Could not retrieve the pipeline status. For troubleshooting steps, read the %{linkStart}documentation.%{linkEnd}"
msgstr ""
msgid "Could not revoke impersonation token %{token_name}."
msgstr ""
......@@ -11017,6 +11014,9 @@ msgstr ""
msgid "Pipeline|Commit"
msgstr ""
msgid "Pipeline|Could not retrieve the pipeline status. For troubleshooting steps, read the %{linkStart}documentation.%{linkEnd}"
msgstr ""
msgid "Pipeline|Coverage"
msgstr ""
......@@ -11083,18 +11083,12 @@ msgstr ""
msgid "Pipeline|for"
msgstr ""
msgid "Pipeline|into"
msgstr ""
msgid "Pipeline|on"
msgstr ""
msgid "Pipeline|success"
msgstr ""
msgid "Pipeline|with"
msgstr ""
msgid "Pipeline|with stage"
msgstr ""
......
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