Commit 2c7b3384 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Added specs for displaying the button

Ensures the create new value stream
button is available when the feature
flag is on

Update gitlab pot file
parent 186e8c43
...@@ -113,7 +113,7 @@ export default { ...@@ -113,7 +113,7 @@ export default {
// https://gitlab.com/gitlab-org/gitlab/-/issues/223735 // https://gitlab.com/gitlab-org/gitlab/-/issues/223735
return this.featureFlags.hasFilterBar && this.currentGroupPath; return this.featureFlags.hasFilterBar && this.currentGroupPath;
}, },
canCreateMultipleValueStreams() { shouldDisplayCreateMultipleValueStreams() {
return Boolean(this.featureFlags.hasCreateMultipleValueStreams); return Boolean(this.featureFlags.hasCreateMultipleValueStreams);
}, },
isLoadingTypeOfWork() { isLoadingTypeOfWork() {
...@@ -220,17 +220,20 @@ export default { ...@@ -220,17 +220,20 @@ export default {
<template> <template>
<div> <div>
<div <div
class="mb-3 gl-display-flex gl-flex-direction-column gl-sm-flex-direction-row gl-justify-content-space-between" class="gl-mb-3 gl-display-flex gl-flex-direction-column gl-sm-flex-direction-row gl-justify-content-space-between"
> >
<h3>{{ __('Value Stream Analytics') }}</h3> <h3>{{ __('Value Stream Analytics') }}</h3>
<div <div
v-if="shouldDisplayCreateMultipleValueStreams"
class="gl-align-self-center" class="gl-align-self-center"
:class="{ :class="{
'gl-w-full': isXSBreakpoint, 'gl-w-full': isXSBreakpoint,
'gl-mt-5': !isXSBreakpoint, 'gl-mt-5': !isXSBreakpoint,
}" }"
> >
<gl-button @click="onCreateValueStream">{{ __('Create new value stream') }}</gl-button> <gl-button data-testid="create-value-stream" @click="onCreateValueStream">{{
__('Create new value stream')
}}</gl-button>
</div> </div>
</div> </div>
<div class="mw-100"> <div class="mw-100">
......
...@@ -48,4 +48,16 @@ RSpec.describe 'Group value stream analytics' do ...@@ -48,4 +48,16 @@ RSpec.describe 'Group value stream analytics' do
expect(page).to have_pushed_frontend_feature_flags(valueStreamAnalyticsFilterBar: false) expect(page).to have_pushed_frontend_feature_flags(valueStreamAnalyticsFilterBar: false)
end end
end end
context 'when `value_stream_analytics_create_multiple_value_streams` is disabled for a group' do
before do
stub_feature_flags(value_stream_analytics_create_multiple_value_streams: false, thing: group)
end
it 'pushes disabled feature flag to the frontend' do
visit group_analytics_cycle_analytics_path(group)
expect(page).to have_pushed_frontend_feature_flags(valueStreamAnalyticsCreateMultipleValueStreams: false)
end
end
end end
...@@ -51,6 +51,7 @@ const defaultFeatureFlags = { ...@@ -51,6 +51,7 @@ const defaultFeatureFlags = {
hasDurationChartMedian: true, hasDurationChartMedian: true,
hasPathNavigation: false, hasPathNavigation: false,
hasFilterBar: false, hasFilterBar: false,
hasCreateMultipleValueStreams: false,
}; };
const initialCycleAnalyticsState = { const initialCycleAnalyticsState = {
...@@ -169,6 +170,10 @@ describe('Cycle Analytics component', () => { ...@@ -169,6 +170,10 @@ describe('Cycle Analytics component', () => {
expect(wrapper.find(FilterBar).exists()).toBe(flag); expect(wrapper.find(FilterBar).exists()).toBe(flag);
}; };
const displaysCreateValueStream = flag => {
expect(wrapper.find('[data-testid="create-value-stream"]').exists()).toBe(flag);
};
beforeEach(() => { beforeEach(() => {
mock = new MockAdapter(axios); mock = new MockAdapter(axios);
wrapper = createComponent({ wrapper = createComponent({
...@@ -232,6 +237,9 @@ describe('Cycle Analytics component', () => { ...@@ -232,6 +237,9 @@ describe('Cycle Analytics component', () => {
it('does not display the path navigation', () => { it('does not display the path navigation', () => {
displaysPathNavigation(false); displaysPathNavigation(false);
}); });
it('does not display the create multiple value streams button', () => {
displaysCreateValueStream(false);
});
describe('hideGroupDropDown = true', () => { describe('hideGroupDropDown = true', () => {
beforeEach(() => { beforeEach(() => {
...@@ -247,6 +255,21 @@ describe('Cycle Analytics component', () => { ...@@ -247,6 +255,21 @@ describe('Cycle Analytics component', () => {
expect(wrapper.find(GroupsDropdownFilter).exists()).toBe(false); expect(wrapper.find(GroupsDropdownFilter).exists()).toBe(false);
}); });
}); });
describe('hasCreateMultipleValueStreams = true', () => {
beforeEach(() => {
mock = new MockAdapter(axios);
wrapper = createComponent({
featureFlags: {
hasCreateMultipleValueStreams: true,
},
});
});
it('displays the create multiple value streams button', () => {
displaysCreateValueStream(true);
});
});
}); });
describe('after a filter has been selected', () => { describe('after a filter has been selected', () => {
......
...@@ -6833,6 +6833,9 @@ msgstr "" ...@@ -6833,6 +6833,9 @@ msgstr ""
msgid "Create new label" msgid "Create new label"
msgstr "" msgstr ""
msgid "Create new value stream"
msgstr ""
msgid "Create new..." msgid "Create new..."
msgstr "" 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