Commit 24e7f9fe authored by Martin Wortschack's avatar Martin Wortschack

Merge branch 'ek-fix-custom-vsa-transition-group-key' into 'master'

Initialize VSA custom stages with a transition key

See merge request gitlab-org/gitlab!65409
parents 6f1851a0 27789634
...@@ -281,7 +281,7 @@ export default { ...@@ -281,7 +281,7 @@ export default {
}, },
handleResetBlank() { handleResetBlank() {
this.name = ''; this.name = '';
Vue.set(this, 'stages', [{ ...defaultCustomStageFields }]); Vue.set(this, 'stages', initializeStages(this.defaultStageConfig, this.selectedPreset));
}, },
onSelectPreset() { onSelectPreset() {
if (this.selectedPreset === PRESET_OPTIONS_DEFAULT) { if (this.selectedPreset === PRESET_OPTIONS_DEFAULT) {
......
...@@ -15,6 +15,7 @@ RSpec.describe 'Multiple value streams', :js do ...@@ -15,6 +15,7 @@ RSpec.describe 'Multiple value streams', :js do
end end
let(:extended_form_fields_selector) { '[data-testid="extended-form-fields"]' } let(:extended_form_fields_selector) { '[data-testid="extended-form-fields"]' }
let(:preset_selector) { '[data-testid="vsa-preset-selector"]' }
let!(:default_value_stream) { create(:cycle_analytics_group_value_stream, group: group, name: 'default') } let!(:default_value_stream) { create(:cycle_analytics_group_value_stream, group: group, name: 'default') }
3.times do |i| 3.times do |i|
...@@ -58,6 +59,15 @@ RSpec.describe 'Multiple value streams', :js do ...@@ -58,6 +59,15 @@ RSpec.describe 'Multiple value streams', :js do
expect(page).to have_text(_("'%{name}' Value Stream created") % { name: custom_value_stream_name }) expect(page).to have_text(_("'%{name}' Value Stream created") % { name: custom_value_stream_name })
end end
it 'can create a value stream with only custom stages' do
page.find(preset_selector).choose("Create from no template")
fill_in_custom_stage_fields
save_value_stream(custom_value_stream_name)
expect(page).to have_text(_("'%{name}' Value Stream created") % { name: custom_value_stream_name })
end
it 'can create a value stream with a custom stage and hidden defaults' do it 'can create a value stream with a custom stage and hidden defaults' do
add_custom_stage_to_form add_custom_stage_to_form
......
...@@ -12,9 +12,7 @@ module CycleAnalyticsHelpers ...@@ -12,9 +12,7 @@ module CycleAnalyticsHelpers
page.all('.gl-path-button').collect(&:text).map {|name_with_median| name_with_median.split("\n")[0] } page.all('.gl-path-button').collect(&:text).map {|name_with_median| name_with_median.split("\n")[0] }
end end
def add_custom_stage_to_form def fill_in_custom_stage_fields
page.find_button(s_('CreateValueStreamForm|Add another stage')).click
index = page.all('[data-testid="value-stream-stage-fields"]').length index = page.all('[data-testid="value-stream-stage-fields"]').length
last_stage = page.all('[data-testid="value-stream-stage-fields"]').last last_stage = page.all('[data-testid="value-stream-stage-fields"]').last
...@@ -25,6 +23,12 @@ module CycleAnalyticsHelpers ...@@ -25,6 +23,12 @@ module CycleAnalyticsHelpers
end end
end end
def add_custom_stage_to_form
page.find_button(s_('CreateValueStreamForm|Add another stage')).click
fill_in_custom_stage_fields
end
def save_value_stream(custom_value_stream_name) def save_value_stream(custom_value_stream_name)
fill_in 'create-value-stream-name', with: custom_value_stream_name fill_in 'create-value-stream-name', with: custom_value_stream_name
......
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