Commit 8bff67db authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Add feature specs for editing a value stream

Adds additional feature specs for the edit flow
for custom value streams.

Minor cleanup specs
parent ae0d4796
......@@ -7,7 +7,7 @@ export const i18n = {
EDIT_FORM_TITLE: s__('CreateValueStreamForm|Edit Value Stream'),
EDIT_FORM_ACTION: s__('CreateValueStreamForm|Save Value Stream'),
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'),
RESTORE_HIDDEN_STAGE: s__('CreateValueStreamForm|Restore stage'),
RESTORE_DEFAULTS: s__('CreateValueStreamForm|Restore defaults'),
......
......@@ -40,11 +40,11 @@ RSpec.describe 'Multiple value streams', :js do
wait_for_requests
end
def add_custom_stage_to_form
def add_custom_stage_to_form(index = 6)
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
select_dropdown_option_by_value "custom-stage-end-event-6", :merge_request_merged
fill_in "custom-stage-name-#{index}", with: "Cool custom stage - name #{index}"
select_dropdown_option_by_value "custom-stage-start-event-#{index}", :merge_request_created
select_dropdown_option_by_value "custom-stage-end-event-#{index}", :merge_request_merged
end
def create_value_stream
......@@ -54,6 +54,14 @@ RSpec.describe 'Multiple value streams', :js do
wait_for_requests
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
before do
select_group(group)
......@@ -87,6 +95,40 @@ RSpec.describe 'Multiple value streams', :js do
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(7)
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
before do
stub_licensed_features(cycle_analytics_for_groups: true, type_of_work_analytics: true)
......
......@@ -275,12 +275,9 @@ describe('ValueStreamForm', () => {
});
it('displays a toast message', () => {
expect(mockToastShow).toHaveBeenCalledWith(
`'${initialData.name}' Value Stream edited`,
{
position: 'top-center',
},
);
expect(mockToastShow).toHaveBeenCalledWith(`'${initialData.name}' Value Stream saved`, {
position: 'top-center',
});
});
});
......
......@@ -976,6 +976,9 @@ msgstr ""
msgid "'%{name}' Value Stream deleted"
msgstr ""
msgid "'%{name}' Value Stream saved"
msgstr ""
msgid "'%{name}' stage already exists"
msgstr ""
......@@ -8692,7 +8695,7 @@ msgstr ""
msgid "CreateValueStreamForm|'%{name}' Value Stream created"
msgstr ""
msgid "CreateValueStreamForm|'%{name}' Value Stream edited"
msgid "CreateValueStreamForm|'%{name}' Value Stream saved"
msgstr ""
msgid "CreateValueStreamForm|Add another stage"
......@@ -25938,6 +25941,9 @@ msgstr ""
msgid "Save Changes"
msgstr ""
msgid "Save Value Stream"
msgstr ""
msgid "Save application"
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