Commit 54aadc79 authored by Dmytro Zaporozhets (DZ)'s avatar Dmytro Zaporozhets (DZ)

Merge branch '267537-edit-custom-vsa-feature-specs' into 'master'

Add edit value stream feature specs

See merge request gitlab-org/gitlab!54209
parents 19afbc58 359a9319
...@@ -7,7 +7,7 @@ export const i18n = { ...@@ -7,7 +7,7 @@ export const i18n = {
EDIT_FORM_TITLE: s__('CreateValueStreamForm|Edit Value Stream'), EDIT_FORM_TITLE: s__('CreateValueStreamForm|Edit Value Stream'),
EDIT_FORM_ACTION: s__('CreateValueStreamForm|Save Value Stream'), EDIT_FORM_ACTION: s__('CreateValueStreamForm|Save Value Stream'),
FORM_CREATED: s__("CreateValueStreamForm|'%{name}' Value Stream created"), FORM_CREATED: s__("CreateValueStreamForm|'%{name}' Value Stream created"),
FORM_EDITED: s__("CreateValueStreamForm|'%{name}' Value Stream edited"), FORM_EDITED: s__("CreateValueStreamForm|'%{name}' Value Stream saved"),
RECOVER_HIDDEN_STAGE: s__('CreateValueStreamForm|Recover hidden stage'), RECOVER_HIDDEN_STAGE: s__('CreateValueStreamForm|Recover hidden stage'),
RESTORE_HIDDEN_STAGE: s__('CreateValueStreamForm|Restore stage'), RESTORE_HIDDEN_STAGE: s__('CreateValueStreamForm|Restore stage'),
RESTORE_DEFAULTS: s__('CreateValueStreamForm|Restore defaults'), RESTORE_DEFAULTS: s__('CreateValueStreamForm|Restore defaults'),
......
...@@ -89,7 +89,7 @@ export default { ...@@ -89,7 +89,7 @@ export default {
}; };
</script> </script>
<template> <template>
<div> <div data-testid="value-stream-stage-fields">
<div class="gl-display-flex"> <div class="gl-display-flex">
<gl-form-group <gl-form-group
class="gl-flex-grow-1" class="gl-flex-grow-1"
......
...@@ -59,7 +59,7 @@ export default { ...@@ -59,7 +59,7 @@ export default {
}; };
</script> </script>
<template> <template>
<div class="gl-mb-4"> <div class="gl-mb-4" data-testid="value-stream-stage-fields">
<div class="gl-display-flex"> <div class="gl-display-flex">
<gl-form-group <gl-form-group
class="gl-flex-grow-1 gl-mb-0" class="gl-flex-grow-1 gl-mb-0"
......
...@@ -42,9 +42,15 @@ RSpec.describe 'Multiple value streams', :js do ...@@ -42,9 +42,15 @@ RSpec.describe 'Multiple value streams', :js do
def add_custom_stage_to_form def add_custom_stage_to_form
page.find_button(s_('CreateValueStreamForm|Add another stage')).click page.find_button(s_('CreateValueStreamForm|Add another stage')).click
fill_in "custom-stage-name-6", with: "Cool custom stage - name"
select_dropdown_option_by_value "custom-stage-start-event-6", :merge_request_created index = page.all('[data-testid="value-stream-stage-fields"]').length
select_dropdown_option_by_value "custom-stage-end-event-6", :merge_request_merged last_stage = page.all('[data-testid="value-stream-stage-fields"]').last
within last_stage do
find('[name*="custom-stage-name-"]').fill_in with: "Cool custom stage - name #{index}"
select_dropdown_option_by_value "custom-stage-start-event-", :merge_request_created
select_dropdown_option_by_value "custom-stage-end-event-", :merge_request_merged
end
end end
def create_value_stream def create_value_stream
...@@ -54,6 +60,14 @@ RSpec.describe 'Multiple value streams', :js do ...@@ -54,6 +60,14 @@ RSpec.describe 'Multiple value streams', :js do
wait_for_requests wait_for_requests
end end
def create_custom_value_stream
toggle_value_stream_dropdown
page.find_button(_('Create new Value Stream')).click
add_custom_stage_to_form
create_value_stream
end
describe 'Create value stream' do describe 'Create value stream' do
before do before do
select_group(group) select_group(group)
...@@ -87,6 +101,40 @@ RSpec.describe 'Multiple value streams', :js do ...@@ -87,6 +101,40 @@ RSpec.describe 'Multiple value streams', :js do
end end
end end
describe 'Edit value stream' do
before do
select_group(group)
create_custom_value_stream
page.find_button(_('Edit')).click
end
it 'includes additional form fields' do
expect(page).to have_selector(extended_form_fields_selector)
expect(page).to have_button("Save Value Stream")
end
it 'can update the value stream name' do
edited_name = "Edit new value stream"
fill_in 'create-value-stream-name', with: edited_name
page.find_button(_('Save Value Stream')).click
wait_for_requests
expect(page).to have_text(_("'%{name}' Value Stream saved") % { name: edited_name })
end
it 'can add a custom stage' do
add_custom_stage_to_form
page.find_button(_('Save Value Stream')).click
wait_for_requests
expect(page).to have_text(_("'%{name}' Value Stream saved") % { name: custom_value_stream_name })
end
end
describe 'with the `value_stream_analytics_extended_form` feature flag disabled' do describe 'with the `value_stream_analytics_extended_form` feature flag disabled' do
before do before do
stub_licensed_features(cycle_analytics_for_groups: true, type_of_work_analytics: true) stub_licensed_features(cycle_analytics_for_groups: true, type_of_work_analytics: true)
......
...@@ -275,12 +275,9 @@ describe('ValueStreamForm', () => { ...@@ -275,12 +275,9 @@ describe('ValueStreamForm', () => {
}); });
it('displays a toast message', () => { it('displays a toast message', () => {
expect(mockToastShow).toHaveBeenCalledWith( expect(mockToastShow).toHaveBeenCalledWith(`'${initialData.name}' Value Stream saved`, {
`'${initialData.name}' Value Stream edited`, position: 'top-center',
{ });
position: 'top-center',
},
);
}); });
}); });
......
...@@ -976,6 +976,9 @@ msgstr "" ...@@ -976,6 +976,9 @@ msgstr ""
msgid "'%{name}' Value Stream deleted" msgid "'%{name}' Value Stream deleted"
msgstr "" msgstr ""
msgid "'%{name}' Value Stream saved"
msgstr ""
msgid "'%{name}' stage already exists" msgid "'%{name}' stage already exists"
msgstr "" msgstr ""
...@@ -8707,7 +8710,7 @@ msgstr "" ...@@ -8707,7 +8710,7 @@ msgstr ""
msgid "CreateValueStreamForm|'%{name}' Value Stream created" msgid "CreateValueStreamForm|'%{name}' Value Stream created"
msgstr "" msgstr ""
msgid "CreateValueStreamForm|'%{name}' Value Stream edited" msgid "CreateValueStreamForm|'%{name}' Value Stream saved"
msgstr "" msgstr ""
msgid "CreateValueStreamForm|Add another stage" msgid "CreateValueStreamForm|Add another stage"
...@@ -25962,6 +25965,9 @@ msgstr "" ...@@ -25962,6 +25965,9 @@ msgstr ""
msgid "Save Changes" msgid "Save Changes"
msgstr "" msgstr ""
msgid "Save Value Stream"
msgstr ""
msgid "Save application" msgid "Save application"
msgstr "" msgstr ""
......
...@@ -15,7 +15,7 @@ module CycleAnalyticsHelpers ...@@ -15,7 +15,7 @@ module CycleAnalyticsHelpers
end end
def toggle_dropdown(field) def toggle_dropdown(field)
page.within("[data-testid='#{field}']") do page.within("[data-testid*='#{field}']") do
find('.dropdown-toggle').click find('.dropdown-toggle').click
wait_for_requests wait_for_requests
...@@ -26,7 +26,7 @@ module CycleAnalyticsHelpers ...@@ -26,7 +26,7 @@ module CycleAnalyticsHelpers
def select_dropdown_option_by_value(name, value, elem = '.dropdown-item') def select_dropdown_option_by_value(name, value, elem = '.dropdown-item')
toggle_dropdown name toggle_dropdown name
page.find("[data-testid='#{name}'] .dropdown-menu").find("#{elem}[value='#{value}']").click page.find("[data-testid*='#{name}'] .dropdown-menu").find("#{elem}[value='#{value}']").click
end end
def create_commit_referencing_issue(issue, branch_name: generate(:branch)) def create_commit_referencing_issue(issue, branch_name: generate(:branch))
......
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